Preparing Content for Translation



Extension .xml
Smartling Identifier xml
Example File customxml.xml
Resources XML Standards 

Smartling supports XML 1.0 files by processing text within specified tags and attributes. You must specify the tags and attributes you want translated using the translate_paths directive.


Key and Variant metadata must be enabled and configured using the source_key_paths and variants_enabled directives.

Specifying Paths

Some directives require you to specify a path or set of paths to keys or strings in the file. A path is a slash-separated string which uses an Xpath-like syntax (although not all features of Xpath are supported). The node separator is always / (slash).

Wildcards are not allowed in path definitions.

To specify an attribute, use dot notation: node.attribute.

To specify paths based on an attribute value, use the syntax /node[@attribute="value"].

For the translate_paths directive, ending the path with a trailing / (slash) will also translate all child nodes.

For example, in the following file:


      <string name="home-button">Smartling Hotels</string>
   <string name="back-button">Back</string>
      <localize name="navigation">
        <string>Browse Hotels</string>
        <string>About Us</string>
        <string>Site Map</string>
      <localize name="description">
<string>An excellent budget hotel in New York City</string>
      <img src="/img/0156849.png" title="Bedroom - Basic Suite"/>
      <img src="/img/0156849.png" title="Bathroom - Basic Suite"/>

  • data/localize/string - will match “Browse Hotels”, “About Us”, “Site Map” and “An excellent budget hotel in New York City”.
  • data/images/img.title - will match “Bedroom - Basic Suite” and “Bathroom - Basic Suite”.
  • data/localize[@name="description"]/string - will match “An excellent budget hotel in New York City.”

HTML-like Files

Some XML files closely resemble HTML files and are more effectively translated by parsing them as HTML files. Smartling allows you to specify HTML as the file type when uploading an XML file in the dashboard to cope with this type of XML files. If uploading via API, give html as the Smartling identifier for the file.

Managing Untranslated Strings

If using File API to download Custom XML files from Smartling, the parameter includeOriginalStrings=false can be set to return an empty string if no translation is available. By default (includeOriginalStrings=true) Smartling returns the original string.

Standard Placeholder Format

See Placeholders in Resource Files for more on placeholders.



<!-- smartling.[directive_name] = [value] -->



Exact delivery depends on file type.

Values auto (default)
true (or yes)
false (or no)
Description Can control whether or not characters will be "escaped" into entities when delivering translations. This can be set universally for the whole file via API, or by setting the directive at the top/start of the file. The directive can also be placed inline to control the behavior of specific strings.

To use inline:
<!-- smartling.entity_escaping = false -->

<!-- smartling.entity_escaping = auto -->

For example, your translation might look like this:
Smartling HTML escaping < > & " example string4

By default, using the "auto" setting, we would assume this is HTML from the <hr> tag and it would be converted to:
Smartling HTML escaping &lt; &gt; &amp; &quot; example string4

Using smartling.entity_escaping = false would allow Smartling HTML escaping < > & " example string4 to appear as it should.


Values  true|TRUE|on|ON OR false|FALSE|off|OFF

When enabled, Smartling will make strings unique using variant metadata. Must be used in conjunction with the source_key_paths directive, which provides the information needed to generate variant metadata. 

If you have previously uploaded a file with variants turned off, and reupload the file with variants on, Smartling will capture all content as new strings. You can configure Smartmatch to automatically match the existing translations.

Examples  <!-- smartling.variants_enabled = TRUE --> 



Values  A comma-separated list of paths to be captured as strings for translation. 
Description When included in this list, all plain text within the specified tag will be considered a translatable string. Optionally, you can append a “.” and a relevant attribute name to the path to translate tag attributes with the file. You can end the path with a trailing slash, “/” and it will treat all child nodes as translatable (content must still be text within a tag). 

<!-- smartling.translate_paths = data/localize/string, data/localize.title, data/localize/root/ --> 

Smartling will translate content in the data/localize/string & data/localize/root nodes. The title attribute of the data/localize node will also be translated.



Values  The value of this directive is expressed as [format]:[paths].

Specifies the format of strings for the specified paths and can enable HTML inside another file format. 

Currently supported formats are:

HTML - string value will be parsed as HTML
@default - (note the leading at-sign) string value will be treated as simple text.
TXT - string value will be parsed as plain text with strings separated by new lines.
block - passes all elements within the block as a single Smartling string.
Separate multiple formats by commas.

You may specify a single path for a format or a comma-separated list of paths enclosed in square brackets. The list may be empty.


<!-- smartling.string_format_paths = -->

Disables the effect of the previous string_format_paths instruction.

<!-- smartling.string_format_paths = html: /product/description -->

Enables HTML in /product/description only.

<!-- smartling.string_format_paths = html: /product/description/ -->

Enables HTML in /product/description and all its child nodes.

<!-- smartling.string_format_paths = html: /product/description/, html: /product/title -->

Enables HTML in /product/description and all its child nodes, and the product/title node.

<!-- smartling.string_format_paths = block: /product/description -->

Enables block and everything inside of root to be one string.



Values 1) Custom Perl compatible regular expression.
2) NONE - disables any current custom placeholders 
Description  Specifies a custom placeholder format. Any text in your file matching the regular expression you provide will be captured as a placeholder.

<!-- smartling.placeholder_format_custom = \[.+?\] -->

Any characters surrounded by square brackets will be treated as a placeholder.



Description  Used to specify a standard placeholder format. 

<!-- smartling.placeholder_format = IOS -->

Specifies iOS-style placeholders for the file.



Values  translate OR notranslate 
Description  Use this directive to enable or disable processing of translation strings in the file. You must turn translation back on after the strings you want to exclude.

<!-- smartling.sltrans = notranslate -->

Strings after this directive will be captured as strings but excluded from translation. (It is the entire string that is excluded, not just a portion of the string.)

<!-- smartling.sltrans = translate -->

Strings after this directive will be translated.




A comma separated list of paths to use create “keys” for strings on translate_paths.

The key will be a space separated string of all the keys leading to the source string. For example: “string”, “group1 string”.


Used to define the schema for capturing a key for each source string. Keys are required:

If you want to import pre-existing translations from a file with the same structure
If you want to create variants of strings that would otherwise be duplicates (By default Smartling does not create duplicate strings.)
Creating or updating variants for previously uploaded strings cause new strings to be created that will not have translations. The SmartMatch feature can be configured to automatically apply the existing translations, or translators can use the 100% match from the Translation to manually apply the translation.

Specify the full path to the value, then indicate which part of the path should be used as the key using {} notation.


<!-- smartling.source_key_paths = data/item/{} -->

Smartling will capture the name atribute of the data/item/string node as the key.

<!-- smartling.source_key_paths = data/item/{string_name} -->

Smartling will capture the content of the string_name node as the key.



Values Integer - Accepted values are 0 - 100
Description Sets the percentage by which original strings are inflated when downloading pseudo translations. If this directive is not set, pseudo translations are 30 percent longer than the original strings.

<!-- smartling.pseudo_inflation = 80 -->

Downloaded pseudo translations will increase the length of original strings by 80 percent.



Values  Instruction text
Description Instructions from XML file. Order is important. The element with the instruction must be a sibling of the corresponding element with the translation (as specified by translate_paths), and it must appear before the translation in the file. 

<!-- smartling.instruction_paths = data/unit/instruction --> 

(See code sample below.)

instruction_paths code example:

      <instruction>instruction text</instruction>
      <string>translation text</string>


Values  Integer - Values such as 10, 20, etc.

Source string level instructions for character length. character_limit_paths point to elements that define character limits.

Order is important. The element with the limit must be a sibling of the corresponding element with the translation (as specified by translate_paths), and it must appear before the translation in the file.


<!-- smartling.character_limit_paths = data/unit/limit, data/sub-level/unit/limit, data/item/limit -->

(See code sample below)

character_limit_paths code example:

      <string id="id1">data 0</string>
      <string id="id2">data 1</string>
   <string id="id3">data 2</string>
   <string id="id4">data 3</string>
   <string id="id5">data 4</string>
   <string id="id6">data 5</string>
   <string id="id7">data 6</string>
   <string id="id8">data 7</string>
   <string id="id9">data 8</string>
   <string id="id10">data 9</string>
   <text name="name1">data 10</text>


Values  Tags such as: <ol>, <li>, <strong>, <icon>
Description This directive allows for specified tags to be treated as inline tags (visible and moveable for translators and editors) versus block-level tags (creates a new string and are not visible).

<!-- smartling.force_inline_for_tags = icon, tooltip -->

Was this article helpful?