| Extension | .xml, .xlf, .xliff |
| Smartling Identifier | xliff2 |
| Example File | (see example below) |
| Resources |
Example File
<?xml version="1.0" encoding="UTF-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:2.0"
xmlns:xmrk="urn:xmarker"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:oasis:names:tc:xliff:document:2.0 xliff_core_2.0.xsd"
version="2.0"
srcLang="en-US"
trgLang="uk-UA">
<file id="description.properties">
<unit id="1">
<segment>
<source>Various types of model.</source>
<target></target>
</segment>
</unit>
<unit id="2">
<segment>
<source>Machine Learning has drawn a lot of attention.</source>
</segment>
<ignorable>
<source> </source>
</ignorable>
<segment>
<source>Then we introduce the needed mathematical notation.</source>
</segment>
</unit>
</file>
</xliff>Smartling supports .xlf, .xliff, and .xml files that use the XML Localization Interchange File Format v 2.0 (XLIFF2).
Articulate XLIFF 2.0 is not supported, meaning you cannot upload a translation XLIFF 2.0 file to Articulate Storyline. You must translate XLIFF 1.2 and choose the articulate option for translations to be compatible with Articulate import.
Visual Context
Visual context is not automatically provided for XLIFF files. To provide visual context for your XLIFF file, you can upload a context file manually, or integrate with Smartling’s JavaScript Library, or the Context Capture Google Chrome Extension, or an API.
An alternative method of providing visual context is to allow translators to view the raw XLIFF file as context. Large files can split into chunks of strings or kilobytes by your Smartling Representative.
To enable raw file image context for a project:
- Go to Settings > Contexts
- Under Use file content as visual context, switch XLIFF on
String Instructions
Smartling automatically captures XLIFF notes and makes them translator instructions. See xliff_note_to_instruction for more information.
Excluding Strings
To exclude content from translation, you can use XLIFF’s translate attribute. To exclude a string from translation, set translate=no. See XLIFF Resource Documentation for details on the translate attribute.
Plurals in XLIFF 2.0 Files
XLIFF 2.0 does not support plural translation.
Standard Placeholder Format
See Placeholders in Resource Files for more on placeholders.
XML Characters
The following XML character are always escaped. You can control this by using the entity_escaping directive.
| Character (character name) | Escape sequence |
| < (less-than) | < |
| > (greater-than) | > |
| & (ampersand) | & |
| ' (apostrophe or single quote) | ' |
| " (double-quote) | " |
Return Untranslated Strings as Empty
If using File API to download Custom XLIFF files from Smartling, the parameter includeOriginalStrings=false can be set to return an empty string if no translation is available. By default, Smartling returns the original source string if no translation is available, meaning the parameter is set to includeOriginalStrings=true
Directives
File directives are supported via API, and some are also supported inline. Inline file directives are specified as comments directly within the source file, while API file directives are added as parameters when uploading a source file via API.
Inline File Format
<!-- smartling.[directive_name] = [value] -->
API Parameter
smartling.[directive_name] = [value]
Here are examples of supported directives for XLIFF 2:
Control String Length
| Directive | xliff_segment_code_strategy |
| Smartling Translate Supported | Yes |
| Values |
|
| Description |
Controls how long strings should be parsed; either as a separate string or as one long string. string - every segment is ingested as a separate original string. |
| Example |
Smartling will parse a long string into one long string. |
Change String Parsing
| Directive | string_format_paths |
| Values |
Syntax The directive value must be a JSON object where:
Basic Example
This example says:
XPath Selector Syntax The directive uses XPath expressions to match units. Currently, only |
| Description |
The This is particularly useful when working with content management systems like Contentful that mix different content types in a single XLIFF file. |
| Important Notes |
|
| Examples |
Basic Attribute Matching: Multiple Conditions with Logical Operators:
Attribute Presence Check: |
Reference <originalData> Elements
| Directive | original_data_type |
| Smartling Translate Supported | Yes |
| Values |
Currently, supported formats are:
|
| Description | Allows for <originalData> XLIFF elements to be referenced. When this directive is set to "html" and the directive "string_format" is also set to "html", <originalData> XLIFF elements will be referenced to enable block and inline tag parsing, similar to raw HTML parsing. |
| Example |
Smartling references <originalData> elements and parses them as HTML. Please note that in this example, the directive "string_format" should also be set to "html". |
Translator Instructions
| Directive | xliff_notes_to_instruction |
| Values |
|
| Description |
Controls where translator instructions are located in the file. By default, all notes inside a unit are ingested as translation instructions. none - disables the ingestion of translator instructions. |
| Example |
The translator instructions will consist of group-level notes and unit-level notes. |
Standard Placeholder Format
| Directive | placeholder_format |
| Smartling Translate Supported | Yes |
| Values |
|
| Description | Used to specify a standard placeholder format. |
| Example |
Specifies iOS-style placeholders for the file. |
Custom Placeholder Format
| Directive | placeholder_format_custom |
| Smartling Translate Supported | Yes |
| Values |
|
| Description |
Specifies a custom placeholder format. Any text in your file matching the regular expression you provide will be captured as a placeholder. See Placeholders in Resource Files for more on placeholders. |
| Example |
Any characters surrounded by curly brackets, e.g., {first name}, will be treated as a placeholder. |
See Placeholders in Resource Files for more on placeholders.
Trim Whitespace
| Directive | whitespace_trim |
| Smartling Translate Supported | Yes |
| Values |
on|yes|true OR off|no|false OR leading|trailing The default value in on. |
| Description |
A whitespace is any character or series of characters that represent horizontal or vertical space in typography. When rendered, a whitespace character is not a visible mark, but does occupy an area or space on a page. Although whitespaces are necessary within a string (typically to separate words), unnecessary whitespaces can be found at the start of a string (leading) and at the end of a string (trailing). With this directive, you can manage whitespace trimming. By default, the leading and trailing whitespaces are trimmed. You can choose to disable trimming or specify trimming for leading or trailing whitespaces. The directive can be used inline or as the API request parameter. |
| Example |
|