Skip to content Skip to sidebar

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

Problem:
You want to rename built-in language names in the WPML language switcher dropdown, such as changing 'Norwegian Bokmål' to 'Norwegian (no)' and 'Portuguese, Brazil' to 'Brazil (Pt)'. However, you encounter issues because there is no option to edit a language once added, and attempting to add a custom language with an existing language code results in an error.
Solution:
To change the default language names for the language switcher, follow these steps:
1. Activate the pre-configured language you want to rename by going to WPML → Languages.
2. Change its locale by editing the language and assigning it a new locale (e.g., en_EN or a custom value).
3. Save the changes.
4. Now, add your custom language using the now-free original locale.
For more detailed instructions on adding custom languages, visit Adding Custom Languages.

If this solution does not apply to your case, or if it seems outdated, we recommend opening a new support ticket. Also, check related known issues at https://wpml.org/known-issues/, verify the version of the permanent fix, and confirm that you have installed the latest versions of themes and plugins. For further assistance, please contact us at WPML 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.

Tagged: 

This topic contains 3 replies, has 1 voice.

Last updated by operationM 1 month ago.

Assisted by: Andrey.

Author Posts
July 28, 2025 at 10:11 pm #17276879

operationM

Background of the issue:
I want to rename some of the built-in language names in the WPML language switcher dropdown. For example, I want to change 'Norwegian Bokmål' to 'Norwegian (no)' and 'Portuguese, Brazil' to 'Brazil (Pt)'. I tried editing the language on the edit language page, but there is no option to edit a language once added. I also attempted to remove 'Norwegian Bokmål' and re-add it as a custom language mapped to 'Norwegian Bokmål' but named 'Norwegian (no)', but it says the language code already exists.

Symptoms:
There is no option to edit a language name once added in the WPML language switcher, and attempting to add a custom language with an existing language code results in an error.

Questions:
How can I change the default language name for the language switcher?

July 29, 2025 at 6:18 am #17277149

Dražen
Supporter

Languages: English (English )

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

Hello,

Thanks for contacting us.

While you wait for my colleague to take over the ticket, let me try to help you with the issue quickly.

As you have said, you can change language name from Edit languages screen, but you can not change language code, that is static and not possible. Only way would be to create new custom language with custom language code, but yes you need to make sure same language code does not already exist and is used by other existing real language.

Hope this helps.

Regards,
Drazen

July 29, 2025 at 11:07 am #17278464

operationM

Hello, so this is the end product I need to achieve (screenshot) 🙂

I guess I could not use the language switcher and just create a dropdown however when languages have been installed/setup they won't automatically show there so I'd hope to use the built in functionality and just edit.

I asked AI regarding changing the names and it seems to suggest I can use "wpml_get_language_display_name" function. Is this suggestion correct?

hidden link

Perhaps there is a better way if not this?

Kind regards and thank you for your time.

language-switcher-dropdown.jpg
July 30, 2025 at 6:23 am #17280585

Andrey
WPML Supporter since 06/2013

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

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

Thank you for your feedback.

I asked AI regarding changing the names and it seems to suggest I can use "wpml_get_language_display_name" function. Is this suggestion correct?

This won't help you.

As Drazen mentioned, you need to change the language name from the Edit languages screen.

For the existing language codes (pre-configured languages), you can rename the language names. For the new language codes, you need new custom languages.

When you add custom language, for example, using en_US, you can get the following message:

“'The Language name already exists.' During setup, adding custom language en_US also says it already existed.”

This behavior is expected because the locale en_US is already assigned to another language — specifically, to the default pre-configured English language in WPML.

To resolve this and add your custom language using en_US as its locale, please follow these steps:
1. First, activate the pre-configured language:
Go to WPML → Languages and activate English.
2. Change its locale:
Edit the English language and change its locale to something else (e.g., en_EN or a custom value that fits your needs).
3. Save the changes.
4. Now add your custom language:
Once the default locale en_US is free, you can create your custom language and assign en_US to it.

en_US - is just an example, you might get this behavior with another locale. However, you know how it can be handled.

Add Custom Languages:
https://wpml.org/documentation/getting-started-guide/language-setup/editing-wpmls-languages-table/#add-custom-languages

I hope this helps.

July 31, 2025 at 4:57 pm #17286022

operationM

Thank you, I understand that the edit languages page with the different translations are effectively the label for the language switcher 🙂

Thanks for your help.