[Resolved] Adding UK English as a language with a language code of 'uk'
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.
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'?
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.
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".
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?