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 1 reply, has 2 voices.

Last updated by Yuri 2 years, 8 months ago.

Assigned support staff: Yuri.

Author Posts
November 9, 2017 at 11:43 am #1425776

Neil Hillman


Our site's structure used two letter COUNTRY codes, instead of LANGUAGE codes as it's directories, so for example, Denmark is "DK" for the country code, instead of "DA" for the Danish language.

To do this, we have had to edit a few of the WPML languages, to change the "code" from the default two letter values.

But we want to keep the correct "Default locale" and "Language tag" for Denmark, as this is then used for the <html lang="da"> tag in the HTML.

But when I try to edit the language I get the messages "The default locale already exists." and "The tag already exists.", trying to force me to use new values.

Won't this result in the pages having the wrong HTML lang attribute values in the <html> tag?

How do I fix this?


November 9, 2017 at 12:33 pm #1425896


Hi, WPML will normally not allow you to create another language with the same language tag and default locale codes. This is because there is already a preset language that is using them. To circumvent this configuration without having to edit the database records directly you can execute the following procedure:

- add the default language that has the locale and tag codes that you want to use. For example, I want to add the Portuguese (Brazil) language with "BR" instead of "PT-BR". I will add the default Portuguese (Brazil) language first.
- edit the languages and change the locale and tag for the default language with any other value
- add your custom language and set it up with the locale and tag you want
- remove the default language you added before.

I'm attaching an image showing how I've configured my own installation with a default language and a custom language changing the values around. Take notice that this screenshot is before I delete the default language.

Let me know if you need any further assistance with this issue.