Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client needs to use a specific language translation code such as "es-419" for translations, but is unsure if the default locale field is the correct place to define this code, especially since there is an issue with using a dash "-" in the language default locale.
Solution:
We explained that the XLIFF uses the hreflang to pull the source language for the target-language attribute. However, we currently do not have a feature that allows for the overwriting of this attribute specifically for XLIFF while keeping it unchanged for the site. If this solution does not seem relevant to your issue, please feel free to open a new support ticket with us.

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.

This topic contains 3 replies, has 2 voices.

Last updated by Bobby 1 year, 7 months ago.

Assisted by: Bobby.

Author Posts
November 29, 2023 at 11:28 am #14949869

jean-marcd-2

Hello,
I would like if we could use the language default locale to specify a required and specific language translation code like for "es" which is fine for the code, page url and hreflang we need to have "es-419" for the translations.
I know there is an issue with the dash "-" in the language default locale and it should be "es_419", but the main question is: "is it right to use the default locale to define specific translation code es-419? Or should we use another field and which one?

Thank you for your help on this matter.

Best regards

JM Duchi

November 29, 2023 at 6:18 pm #14954967

Bobby
WPML Supporter since 04/2015

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Hi JM Duchi,

What is the goal you would like to achieve by adding the code es-419?

The problem with changing the default locale is that WordPress & our plugin uses the default locale as a means to pull existing translations from .mo files and it's own servers onto your site.

Almost all major plugins as well use the default locale to link languages to their .mo files.

While you can always change it, the default locale recommend is the one set by WordPress -- you can find it here https://make.wordpress.org/polyglots/teams/

For Spanish(Spain) it's es_ES

Then the language code field is what is used to display in your URL, for example in Spanish it's already set to es, therefore, your URL will display as hidden link

You can change this only by creating a new custom language.

To do this go to WPML->Languages->Edit languages and add a custom language then set your code to es-418, however, your URL will also start showing as hidden link

More documentation on how to add a custom language can be found here:
https://wpml.org/documentation/getting-started-guide/language-setup/editing-wpmls-languages-table/

November 30, 2023 at 10:48 am #14961045

jean-marcd-2

Hello,

The goals are to:

- Keep URLs with /es/
- Export into XLF files with: 'target-language="es-419"' and 'target xml:lang="es-419"'

So is there any Language WPML field with could store "es-419" without impacting the URL or the HReflang?

Thank you.

JM Duchi

November 30, 2023 at 5:59 pm #14965949

Bobby
WPML Supporter since 04/2015

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Hello,

Thank you for clarifying, the XLIFF will use the hreflang to pull the source language for the target-language attribute.

Unfortunately, no feature would allow us to overwrite this just for XLIFF and leave it as is for the site.