TMX TMX Localization

TMX file (Wikipedia) is an XML-based translation memory exchange file format. Soluling can use TMX files in several ways. The most common usage of TMX files is to import translations from a TMX file into Soluling projects or to translations memories using Import Wizard. Another important feature is to export translations from project or translation memory into TMX files. Soluling can also use TMX files as a glossary source. Use Glossary Wizard to take your TMX glossary in use. Finally, Soluling localization tool and service can be used to localize TMX files.

Localization process of TMX files

TMX file contains one body element that has zero or more tu elements. Each tu element includes one or more tuv element that stores a string value in one language. Here is a simple TMX file:

<?xml version="1.0" encoding="utf-8"?>
<tmx version="1.4">
  <header creationtool="Soluling" creationtoolversion="1.0.0" datatype="plaintext" segtype="sentence" o-tmf="Soluling" adminlang="en" srclang="en"/>
  <body>
    <tu>
      <tuv xml:lang="en">
        <seg>One</seg>
      </tuv>
      <tuv xml:lang="fi">
<seg>Yksi</seg>
</tuv>
<tuv xml:lang="de"> <seg>Eins</seg> </tuv><tuv xml:lang="ja"> <seg></seg> </tuv> </tu> </body> </tmx>

The above TMX file contains one tuv element in English, Finnish, German, and Japanese. Because TMX already contains strings in four languages, you don't have to localize it unless you want to add new languages. However the following TMX file (<data-dir>\Samples\TMX\Simple.tmx) contains only English strings.

<?xml version="1.0" encoding="utf-8"?>
<tmx version="1.4">
  <header creationtool="Soluling" creationtoolversion="1.0.0" datatype="plaintext" segtype="sentence" o-tmf="Soluling" adminlang="en" srclang="en"/>
  <body>
    <tu>
      <tuv xml:lang="en">
        <seg>One</seg>
      </tuv>
    </tu>
  </body>
</tmx>

To make the file useful, we have to add translations to that. Let's see how. Create a new project that contains the above file and add German, Finnish, and Japanese as target languages. Soluling will make three localized TMX files. The first file is fi\Simple.tmx that contains original English strings and the Finnish translations you entered into the project.

<?xml version="1.0" encoding="utf-8"?>
<tmx version="1.4">
  <header creationtool="Soluling" creationtoolversion="1.0.0" datatype="plaintext" segtype="sentence" o-tmf="Soluling" adminlang="en" srclang="en"/>
  <body>
    <tu>
      <tuv xml:lang="en">
        <seg>One</seg>
      </tuv>
      <tuv xml:lang="fi">
        <seg>Yksi</seg>
      </tuv>
    </tu>
  </body>
</tmx>

The second file is de\Sample.tmx that contains German translations.

<?xml version="1.0" encoding="utf-8"?>
<tmx version="1.4">
  <header creationtool="Soluling" creationtoolversion="1.0.0" datatype="plaintext" segtype="sentence" o-tmf="Soluling" adminlang="en" srclang="en"/>
  <body>
    <tu>
      <tuv xml:lang="en">
        <seg>One</seg>
      </tuv>
      <tuv xml:lang="de">
        <seg>Eins</seg>
      </tuv>
    </tu>
  </body>
</tmx>

The third file is ja\Sample.tmx that contains Japanese translations.

<?xml version="1.0" encoding="utf-8"?>
<tmx version="1.4">
  <header creationtool="Soluling" creationtoolversion="1.0.0" datatype="plaintext" segtype="sentence" o-tmf="Soluling" adminlang="en" srclang="en"/>
  <body>
    <tu>
      <tuv xml:lang="en">
        <seg>One</seg>
      </tuv>
      <tuv xml:lang="ja">
        <seg>一</seg>
      </tuv>
    </tu>
  </body>
</tmx>

If you want to have all four languages in the same file, you have to turn on the multilingual output. To change the output settings, edit the source. Right-click Simple.tmx on the project tree and choose Properties menu. Select the Output sheet, uncheck Localized, and check Multilingual.

Output

Now Soluling creates adds Finnish, German, and Japanese tuv elements in the one multilingual output file (all\Simple.tmx) it creates.

<?xml version="1.0" encoding="utf-8"?>
<tmx version="1.4">
  <header creationtool="Soluling" creationtoolversion="1.0.0" datatype="plaintext" segtype="sentence" o-tmf="Soluling" adminlang="en" srclang="en"/>
  <body>
    <tu>
      <tuv xml:lang="en">
        <seg>One</seg>
      </tuv>
      <tuv xml:lang="fi">
        <seg>Yksi</seg>
      </tuv>
      <tuv xml:lang="de">
        <seg>Eins</seg>
      </tuv><tuv xml:lang="ja">
        <seg>一</seg>
      </tuv>
    </tu>
  </body>
</tmx>

Files using tuid attributes

Most TMX files do not contain any content value, so Soluling uses the actual string value as context value. However, TMX specification allows using tuid attribute in tu elements. This attribute specifies the id or context value of the tu element.

<?xml version="1.0" encoding="utf-8"?>
<tmx version="1.4">
  <header creationtool="Soluling" creationtoolversion="1.0.0" datatype="plaintext" segtype="sentence" o-tmf="Soluling" adminlang="en" srclang="en"/>
  <body>
    <tu tuid="one">
      <tuv xml:lang="en">
        <seg>One</seg>
      </tuv>
    </tu>
  </body>
</tmx>

If your TMX file has tuid attribute values, you can use a different localization method. When you create a new project, Project Wizard shows a sheet where you can select context and localization methods.

Properties

By default, Soluling uses string values to create context value and adds localized tuv elements into localized files. However, you can change this.

Properties

The above settings make Soluling to use tuid value as a context (Context method) and not to add localized tuv elements but to localize exiting tuv elements (Localization method).

<?xml version="1.0" encoding="utf-8"?>
<tmx version="1.4">
  <header creationtool="Soluling" creationtoolversion="1.0.0" datatype="plaintext" segtype="sentence" o-tmf="Soluling" adminlang="en" srclang="fi"/>
  <body>
    <tu tuid="one">
      <tuv xml:lang="fi">
        <seg>Yksi</seg>
      </tuv>
    </tu>
  </body>
</tmx>

The Finnish file that Soluling creates is identical to the original English file except the Finnish file contains seg elements in Finnish and language ids use "fi" instead of "en".

Original file is multilingual

In some cases, you have a TMX file that already contains translations. You might want to edit the translations or to add a new language. Soluling can handle this too. Take a look at the following TMX file (<data-dir>\Samples\TMX\SimpleMultilingual.tmx).

<?xml version="1.0" encoding="utf-8"?>
<tmx version="1.4">
  <header creationtool="Soluling" creationtoolversion="1.0.0" datatype="plaintext" segtype="sentence" o-tmf="Soluling" adminlang="en" srclang="en"/>
  <body>
    <tu>
      <tuv xml:lang="en">
        <seg>One</seg>
      </tuv>
      <tuv xml:lang="fi">
        <seg>Yksi</seg>
      </tuv>
      <tuv xml:lang="de">
        <seg>Eins</seg>
      </tuv>
      <tuv xml:lang="ja">
        <seg>一</seg>
      </tuv>
    </tu>
  </body>
</tmx>

The above TMX file contains English, Finnish, German, and Japanese. Let's add French into that. When you create a new project, Soluling automatically adds Finnish, German, and Japanese into project languages. Add French manually by dragging French from the left side list to the right side list.

Languages

When Soluling creates the project, it automatically imports the existing translations into the new project. Enter the French translations and click Home | Build All button to create the localized multilingual file. The file looks like this.

<?xml version="1.0" encoding="utf-8"?>
<tmx version="1.4">
  <header creationtool="Soluling" creationtoolversion="1.0.0" datatype="plaintext" segtype="sentence" o-tmf="Soluling" adminlang="en" srclang="en"/>
  <body>
    <tu>
      <tuv xml:lang="en">
        <seg>One</seg>
      </tuv>
      <tuv xml:lang="fi">
        <seg>Yksi</seg>
      </tuv>
      <tuv xml:lang="de">
        <seg>Eins</seg>
      </tuv>
      <tuv xml:lang="ja">
        <seg>一</seg>
      </tuv>
      <tuv xml:lang="fr">
        <seg>Un</seg>
      </tuv>
    </tu>
  </body>
</tmx>

If you edit the original TMX file outside Soluling, the translation values might become different than your current Soluling project. This is why Soluling can synchronize translations between the original file and the project file. By default, Soluling imports translations during the scan operation. Translations are only imported if there is no current translation in the project file. To change this, edit the source: Right-click SimpleMultilingual.tmx on the project tree and choose Properties menu. Select the Options sheet.

Options

Choose Never to disable translation synchronizing. Choose Import all translations and overwrite the possible existing value in the project to import all translation from the original file to the project and overwrite any values that might be in the project.

Samples

<data-dir>\Samples\TMX contains following TMX sample files:

File Description
Simple A simple TMX file that contains only one string in English. Study this first.
SimpleTuid As above but the string contains also an id.
SimpleMultilingual As Simple but the string is in multiple languages.
Numbers Contains numbers from 1 to 3 in multiple languages.
Sport Contains description of various sports in English.
SportTuid As above but the strings contain also an id.

Configuring TMX Localization

You can configure how to localize your TMX file by selecting the item in the project tree, right-clicking, and choosing the Options menu. A source dialog appears that lets you edit the options. This source uses the following option sheets.

Read more about other data files such as XML, JSON, YAML, INI, Excel, SVG, TMX, XLIFF, text and binary files.