Skip Navigation

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

Problem:
My problem now is that I want to add en-GB as a language. When I try to add English with a code of 'uk' I get an error that 'The Language code already exists.'. I assume this is because the database is pre-populated with Ukraine as a language. This is not unreasonable, but people in the UK often refer to the country as UK not GB, and even if I could change my folder for UK English to be GB it is pre-existing as UK, so this would cost me in SEO which I cannot accept.

Solution:
Deleting a language from WPML is not a good idea.
Instead, you can go to WPML → Languages → Site Languages, press the Add / Remove languages, add the Ukraininan language, then press the Edit Languages link. This way you'll be able to "transform" Ukrainian into UK English.

Relevant Documentation:
https://wpml.org/documentation/getting-started-guide/language-setup/#site-languages

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 3.98 hours from now. Thank you for your understanding.

This topic contains 4 replies, has 2 voices.

Last updated by anthonyW-6 4 years, 5 months ago.

Assisted by: Radu.

Author Posts
April 10, 2020 at 7:23 pm #5885981

anthonyW-6

I have a WordPress single domain multisite setup which already exists. I am trying to add WPML to it. These are my domains and languages:

mydomain - US english
mydomain/uk/ - UK english
mydomain/de/ - German

I have figured out that I need to use sunrise.php, and I also figured out the setup needs to be driven from the main US english site.

My problem now is that I want to add en-GB as a language BUT I NEED THAT LANGUAGE CODE TO BE UK.

When I try to add English with a code of 'uk' I get an error that 'The Language code already exists.'. I assume this is because the database is pre-populated with Ukraine as a language. This is not unreasonable, but people in the UK often refer to the country as UK not GB, and even if I could change my folder for UK English to be GB it is pre-existing as UK, so this would cost me in SEO which I cannot accept.

Following other threads here I ran this database query:
DELETE FROM `wp_icl_translations` WHERE language_code = 'uk'
but I still get the error 'The Language code already exists.' when trying to add English after running this query.

Please can you advise me how to add English with a language code of 'uk'?

April 13, 2020 at 2:00 pm #5896851

Radu

Hey Anthony,

Can you tell me exactly what's the location where you are trying to add this code of uk so I can understand exactly what you're looking for (and give it a try on my testing website too), please? I just want to make sure that I understand exactly what's the change that you are looking for.

Thanks,
Radu

April 13, 2020 at 5:31 pm #5898263

anthonyW-6

Hi Radu,

Yes of course, details below...

While in the WP dashboard of the main site (this is a multisite setup, but I'm looking at the dashboard for the master site), I navigate to:
WPML > Languages > Site Languages > Edit Languages
which is at this URL:
/wp-admin/admin.php?page=sitepress-multilingual-cms%2Fmenu%2Flanguages.php&trop=1

On that page there are 2 languages set up which are English and German, they have language codes: en, de.

On this page if I click "add new language" I get a new row which is highlighted in yellow.

I fill out the row choosing "uk" as the new language code. I can guess there may be a problem as the system suggests the Ukraine flag, and when I click "Save" the page reloads and I get the error "The Language code already exists".

I've attached a screenshot of this error.

Thanks for your help 🙂

uk_language_code_error.png
April 15, 2020 at 7:54 am #5910821

Radu

Hey Anthony,

Deleting a language from the plugin is not a good idea.

Instead, you can go to WPML → Languages → Site Languages, press the Add / Remove languages, add the Ukraininan language, then press the Edit Languages link.

I just did this, changed the values as in the screenshot I attached, and everything works fine. Can you give this a try and tell me how it works for you, please?

Thanks,
Radu

Screenshot 2020-04-15 at 11.54.30.png
Screenshot 2020-04-15 at 11.54.25.png
April 15, 2020 at 12:49 pm #5913585

anthonyW-6

Thanks Radu that has done the trick, much appreciated!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.