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="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, both inline and via our API. Directives are specified in comments within the files, in the following format:
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 |
Values |
|
Smartling Translate Supported | Yes |
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. |
Examples |
<!-- smartling.segment_code_strategy=span --> Smartling will parse a long string into one long string. |
Change String Parsing
Directive | string_format |
Values |
Currently, supported formats are: |
Smartling Translate Supported | Yes |
Description |
Specifies the format of strings for the specified paths, and can enable HTML inside another file format. It is important to consider the side effects of HTML parsing, including losing keys, and precedence rules for other formats. |
Examples | <!-- smartling.string_format =html-->
Smartling parses values of all nodes as HTML. |
Use Case |
If your document has disparate kinds of strings that are used in different contexts, for example, if your single XLIFF file contains application UI strings, with standard string formatting and placeholders, together with one or few keys that are just giant HTML documents (example; TOS or Privacy Policy). |
Reference <originalData> Elements
Directive | original_data_type |
Values |
Currently, supported formats are:
|
Smartling Translate Supported | Yes |
Description |
Allows for <originalData> XLIFF elements to be referenced. |
Examples | <!-- smartling.original_data_type = html-->
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. |
Examples |
<!-- smartling.xliff_notes_to_instruction=group, unit --> The translator instructions will consist of group-level notes and unit-level notes. |
Standard Placeholder Format
Directive |
placeholder_format |
Values | NONE; C; IOS; PYTHON; JAVA; YAML; QT, RESX |
Smartling Translate Supported | Yes |
Description | Used to specify a standard placeholder format. |
Examples | <!-- smartling.placeholder_format = IOS -->
Specifies iOS-style placeholders for the file. |
Custom Placeholder Format
Directive | placeholder_format_custom |
Values | 1) Custom Java regular expression. 2) NONE - disables any current custom placeholders |
Smartling Translate Supported | Yes |
Description | Specifies a custom placeholder format. Any text in your file matching the regular expression you provide will be captured as a placeholder. |
Examples |
<!-- smartling.placeholder_format_custom = REGEX--> <!-- smartling.placeholder_format_custom=\{([^}]+)\} --> 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 |
Values |
on|yes|true or off|no|false or leading|trailing The default value is on. |
Smartling Translate Supported | Yes |
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 trim whitespaces, as it enables or disables whitespace trim management for the ingested strings. Whitespace is optionally trimmed from content then re-inserted on download for convenience so that translators do not have to manage the extra spaces. However, content owners may want to retain surrounding whitespace so that translators can 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 only be used as the API request parameter. |
Examples |
<!-- smartling.whitespace_trim=on --> Smartling will trim leading and trailing whitespaces (default) <!-- smartling.whitespace_trim=off --> Smartling will not trim leading or trailing whitespaces <!-- smartling.whitespace_trim=leading --> Smartling will trim only leading whitespaces <!-- smartling.whitespace_trim=trailing --> Smartling will trim only trailing whitespaces |