[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?
Thanks Radu that has done the trick, much appreciated!
Manage Cookie Consent
We use cookies to optimize our website and services. Your consent allows us to process data such as browsing behavior. Not consenting may affect some features.
Functional
Always active
Required for our website to operate and communicate correctly.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
We use these to analyze the statistics of our site. Collected information is completely anonymous.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
These cookies track your browsing to provide ads relevant to you.