You are here:
XLIFF File Format for Importing Commerce Translations
The Translation Workbench supports the XML Localization Interchange File Format (XLIFF) and Salesforce Translation File (STF) file formats.
Required Editions
Salesforce recommends that you use the XLIFF format. You can export the metadata and data translation source files and use them as a template to enter the initial translation of your store’s metadata, and Product, Promotion, and Category data fields. See Export Data Translation Files.
| Element | Purpose | Attributes |
|---|---|---|
<trans-unit> |
Represents a translatable unit within the XLF file. This element is used to encapsulate the source text and its corresponding translation |
|
<source> |
The original text that needs to be translated. Can include HTML encoding or CDATA sections for formatting. | None |
<target> |
The translated version of the text found in the <source> element. |
Doesn't have mandatory attributes but can include optional attributes to provide additional context or metadata about the translation. Some common attributes can include:
|
Tips for XLIFF File Management
- Context Information: Help your translators with message translation by adding a
<note>tag in the<target>that explains the content of the message.<trans-unit id="homepage.greeting"> <source>Hello, world!</source> <target>Bonjour, le monde!</target> <note>This is a greeting message displayed on the homepage.</note> </trans-unit> - Handling Placeholders and Variables: If your source text includes placeholders or variables (for example {0}, %s), make
sure the placeholders are preserved in the target text and clearly documented for translators.
<trans-unit id="product.price"> <source>The price is {0}.</source> <target>Le prix est {0}.</target> <note>{0} will be replaced with the actual price</note> </trans-unit> - Validation and Testing: Validate the XLF file to make sure it's well-formed and adheres to the XLIFF standard. Use XML validation tools or editors that support XLIFF validation. Test the translations in a staging environment to make sure they appear correctly and that there are no formatting or display issues.
- Consistent Language Codes: Use standard language codes (for example,
enfor English,frfor French,defor German) consistentlythroughout the file. xml <file source-language="en" target-language="fr" datatype="plaintext" original="example.txt"> </file> - Version Control and Backup: Keep version control and backups of your XLF files. This is important for tracking changes, rolling back if needed, and maintaining a history of translations.
- Integration with Translation Management Systems (TMS): If you're using a Translation Management System (TMS), make sure that the XLF files are compatible with the TMS and that the import/export processes are well-defined.
- Handling Special Characters: Use CDATA sections or escape special characters (for example, &, <`, `>) to avoid XML parsing errors.
<trans-unit id="special.characters"> <source><p>Click & learn more.</p></source> <target><p>Cliquez & apprenez plus.</p></target> </trans-unit> - Rich Text Formatting: Use CDATA sections to include rich text formatting (HTML tags) within
the <source> and <target> elements to prevent XML parsing issues.
<trans-unit id="rich.text"> <source><p>Welcome to <b>Salesforce</b>!</p></source> <target><p>Bienvenue chez<b>Salesforce</b>!</p></target> </trans-unit>

