XML Import / Export for Web

Using the XML file format to import/export content

Within the Localize dashboard we provide you with an ability to import and export phrases and website translations in various file formats.

You can also import/export Glossary terms.

Importing / Exporting

To see a general explanation of how importing and exporting works in Localize, click here. Be sure to adhere to the file requirements below so that Localize will be able to successfully read your files.

File Requirements

🚧

UTF-8 Character Encoding

Be sure that you are using the UTF-8 character encoding when working with the external files you are creating for importing purposes, so that special characters like accents are encoded properly.

XML is a format that's used to exchange data between participants in a translation project.
Use the following sample for guidance when creating your XML file for importing into Localize.

The following data is required:

  • <resources> element: parent element of all other elements that follow
  • <source-language> element: the source language code
  • <target-language> element: the target language code
  • <string>: For each phrase ( element):
    • name: this is the source language phrase

The following data is optional for each phrase ( element):

  • id attribute: this internal ID will be seen in any files exported from Localize
  • context attribute: a string which provides context for your translators
  • labels attribute: A comma-separated list of strings which are labels to apply to the phrase
    • Note that any pre-existing labels on the phrase will be replaced by the ones in the import file.
    • Any labels added to the phrase in the file being imported will be added to the Localize dashboard.
  • translation: this will be the contents of the element
    • If present, this is the translation of the source text
<?xml version = "1.0" encoding="UTF-8"?>
<resources>
  <source-language>en</source-language>
  <target-language>es</target-language>
  <string name="Here’s another new sentence." 
          context="this is some context" 
          id="5e3325d441c51b0f14d4bcbb">
  </string>
  <string name="We can’t possibly run irrigation to this tree, so it will have to survive on its own." 
          id="5e05ff60b5f2a4f81803b695">No es posible que podamos regar este árbol, por lo que tendrá que sobrevivir por sí solo.
  </string>
  <string name="What we do | Localize — LZ Product Demo" 
          context="Translator: google" 
          labels="lzm-meta-og:title, lz-page-title">Lo que hacemos | Localize - LZ Product Demo
  </string>
</resources>

Troubleshooting

If your import fails you will see a message on screen after the failure occurs. Or you can view the error here under Import History.