The XLIFF File Has An Invalid Target Language.

XLIFF files used for translation must follow specific file format and context rules in order for the translation to occur (see XLIFF Files).

One of these rules is: The target locale of the XLIFF file must match with one of the ones from the context. 

For example, let' say a project has a source that is German with English and French as the target languages. You want to mark an XLIFF file for online translation that has German as the source language and Italian as the target language. The system will not accept this file as the target language does not match the context of the project, order form, etc.


Received Error

In these instances, you will receive an error message similar to what is shown below: 

"The xliff target language 'zh-CN' is invalid. It must be one of: en,de,fr.”

The listed target language will vary, as it is based on the defined target languages within the XLIFF file and context as defined in the project, order form, etc. 


Explanation

You will encounter this error if you try to mark an XLIFF file with a target language that is not defined in the context of a project. For example, if the target language within the XLIFF file is explicitly set to zh-CN (Chinese) for the online translation and the project currently has "en" (English), "de" (German), and "fr" (French) defined as the target languages, then the operation will fail.  

 

If your Wordbee project has “en”, “de” and “fr” as target, the following file will fail to process:

Example - Invalid Target Language
<xliff version="1.0">
      <file target-language="zh-CN" source-language="it" datatype="plaintext" original="messages2" date="2011-10-18T18:20:51Z" product-name="my-ext">
             <header/>
             <body>
                     <trans-unit id="headerComment" xml:space="preserve">
                             <source>The default Header Comment.</source>
                     </trans-unit>
                     <trans-unit id="generator" xml:space="preserve">
                             <source>The "Generator" Meta Tag.</source>
                     </trans-unit>
             </body>
     </file>
</xliff>

 

Fixing the Problem

There are two ways to fix this problem and ensure that the XLIFF file can be translated.

  1. If you really want to translate to Chinese, add this locale to your project. 
  2. If you want to translate to English, German, or French, either: 
    1. Remove the “target-language” attribute from your XLIFF file
    2. (or) change the value of the attribute to one of the languages defined in the project (en, de, or fr)

Copyright Wordbee - Buzzin' Outside the Box since 2008