Skip Navigation

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

Problem:
You are trying to change the default locale, hreflang, and language mapping to Portuguese-Brazil on your website but encountered an error stating 'The default locale already exists.' You were able to change the mapping but not the locale or hreflang.
Solution:
To resolve this issue, follow these steps:
1) Activate the pre-defined Portuguese (Brazil) language on your site.
2) Go to the language settings and click to edit the languages. Initially, change the default locale for the Portuguese (Brazil) language to a temporary one, such as

pt_BRtt

, and save the changes.
3) After this, you can set the new language data with default-locale:

pt_BR

.

If this solution does not apply to your case, or if it seems outdated, we recommend opening a new support ticket. Also, check the related known issues and ensure you have the latest versions of themes and plugins installed. For further assistance, please visit our support forum.

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.

Our next available supporter will start replying to tickets in about 4.34 hours from now. Thank you for your understanding.

This topic contains 3 replies, has 2 voices.

Last updated by Andrey 4 months, 3 weeks ago.

Assisted by: Andrey.

Author Posts
June 18, 2024 at 4:25 pm #15750093

alinaC-9

<b>Background of the issue: </b>
At my website hidden link, I have a directory for Portuguese language gologin.com/pt/.

I would like to change the default locale, hreflang, and language mapping to Portuguese-Brazil to locate my content to the Brazil region.
Current language data: default-locale: pt_PT, hreflang: pt, mapping: portuguese. - Screen1
New language data (Portuguese-Brazil): default-locale: pt_BR, hreflang: pt-br (or just br), mapping: portuguese-brasil. - Screen2

I was able to make it for mapping only.

<b>Symptoms: </b>
I've got an error that 'The default locale already exists.'

<b>Questions: </b>
How could I make such changes to the default locale, hreflang, and language mapping?
I have not fpund info about the use of default locale at your documents, could you also provide a link with this settings description?
What is the correct way to change the default locale to pt_BR?

Screen2.png
Screen1.png
June 18, 2024 at 8:21 pm #15750857

Andrey
Supporter

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+02:00)

Thank you for contacting WPML support.

It means that the default locale pt_BR already exists for the pre-defined language. Instead of changing it, I recommend activating the existing Portuguese (Brazil) language in WPML → Languages → Site languages and clicking the "Add / Remove languages" button.

https://wpml.org/documentation/getting-started-guide/language-setup/pre-configured-languages/

Languages-‹-WCML-Plugin-GUI-—-WordPress(5).png
June 19, 2024 at 7:08 am #15753413

alinaC-9

Hi, Andrey

Actually I'm trying to change the locale of existing language. We have posts and pages translated. If there any way to make such a changes?
Or if there is any way to migrate my translations to the newly created language?

Best regards

June 19, 2024 at 12:23 pm #15755589

Andrey
Supporter

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+02:00)

You can actually change the default locale for an existing language, but since the locale you are going to use already exists, you need to first change it for another language to something else.

For example:

1) Activate the pre-defined Portuguese (Brazil) language.

2) Click to Edit the languages. First, change the default locale for the Portuguese (Brazil) language to something else, such as pt_BRtt, and save.

3) Then, for new language data, you can use default-locale: pt_BR.

June 20, 2024 at 6:25 am #15761228

alinaC-9

Thank you Andrey, everything went perfect and I've managed to change hreflang and locale with your adwise.

BR,

alinaC-9 confirmed that the issue was resolved on 2024-06-20 06:25:20.
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.