Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 8:00 – 13:00 9:00 – 13:00 9:00 – 13:00 8:00 – 12:00 8:00 – 12:00 -
- 14:00 – 17:00 14:00 – 18:00 14:00 – 18:00 13:00 – 17:00 13:00 – 17:00 -

Supporter timezone: Europe/Zagreb (GMT+01:00)

This topic contains 1 reply, has 0 voices.

Last updated by Bruno Kos 1 week, 1 day ago.

Assisted by: Bruno Kos.

Author Posts
January 28, 2025 at 1:58 pm #16642152

cornelisS

Background of the issue:
I am trying to edit the target language in an XLIFF file for a translation from Dutch to English. I want to change the target language from 'NL-EN (US)' to 'NL-EN (GB)'.

Symptoms:
I am unsure how to change the target language in the XLIFF file.

Questions:
How can I change the target language in an XLIFF file from 'NL-EN (US)' to 'NL-EN (GB)'?

January 29, 2025 at 7:49 am #16644602

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+01:00)

Hi,

Yes, you can change the target language in an XLIFF file by modifying the `<target-language>` attribute and updating the `<target>` elements inside `<trans-unit>` sections. However, this may not work properly in WPML because WPML creates translation jobs based on language pairs. If a job for a specific language is missing, you might encounter an error message stating that the translation jobs do not exist.

You can do something like this:

- Use a text editor (e.g., Notepad++, VS Code, Sublime Text) or an XML editor.
- Locate the `<file>` element at the beginning of the file. It contains the `target-language` attribute.

For example:

<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
    <file original="1-571e0f7e2d992e738adff8b1bd43a521" source-language="nl" target-language="en-US" datatype="plaintext">

If you want to change the target language from NL → EN (US) to NL → EN (GB), modify it:

<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
    <file original="1-571e0f7e2d992e738adff8b1bd43a521" source-language="nl" target-language="en-GB" datatype="plaintext">

Furthermore, each `<trans-unit>` section contains a `<source>` and a `<target>` element. If needed, update the translations manually.

It looks something like this:

<trans-unit id="1">
    <source>Hallo</source>
    <target>Hello</target>
</trans-unit>

That being said, a more effective approach is to add custom languages and set up translation jobs. You can find detailed guidance in these resources: https://wpml.org/documentation/getting-started-guide/language-setup/editing-wpmls-languages-table/ https://wpml.org/documentation/translating-your-contents/#assigning-the-translations-to-a-translator.