XML Import / Export for Mobile

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:

  • <?xml version = "1.0" encoding="UTF-8"?>: standard XML tag
  • <resources> element: parent element of all other elements that follow
  • <string>: For each phrase:
    • phraseKey attribute: this is the phrase key for the string, a unique identifier
    • source/translation: this will be the contents of the <string> element
      • This is either the source phrase or the translation of the source phrase, depending on the language of the file being imported.
      • Localize doesn't check for the language in the file, it's up to the person importing/exporting the file to know what language is in the file. We recommend including the language code in the filename.

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 that provides context for your translators
  • labels attribute: A space-separated list of strings that are labels to apply to the phrase
    • Any labels added to the phrase in the file being imported will be added to that phrase in the Localize dashboard.
    • Note that any pre-existing labels on the phrase will be replaced by the ones in the import file.
<?xml version = "1.0" encoding="UTF-8"?>
<resources>
  <string phraseKey="another-sentence" 
          context="this is some context">
    Here’s another new sentence.
  </string>
  <string phraseKey="irrigation">
    We can’t possibly run irrigation to this tree, so it will have to survive on its own.
  </string>
  <string phraseKey="what-we-do" 
          context="This is a page title." 
          labels="page-title human-translate">
    What we do | Localize — LZ Product Demo
  </string>
</resources>
<?xml version = "1.0" encoding="UTF-8"?>
<resources>
  <string phraseKey="another-sentence" 
          context="this is some context"
          id="1234567890abcdefghijklmn">
    Aquí hay otra oración nueva.
  </string>
  <string phraseKey="irrigation"
          id="234567890abcdefghijklmno">
    No es posible que podamos regar este árbol, por lo que tendrá que sobrevivir por sí solo.
  </string>
  <string phraseKey="what-we-do" 
          context="This is a page title." 
          labels="page-title human-translate"
          id="34567890abcdefghijklmnop">
    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.