Skip Navigation

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

Problem:
The client wants to change the language code for Chinese simplified and Portuguese Portugal without affecting the existing content
Solution:
We recommend creating a new custom language with the desired language code instead of changing the existing one, as altering the language code directly in the database could break your site. For Chinese, you can create a language with the code 'ZH'. Please refer to our documentation on editing WPML's languages table and watch this helpful video: video guide.
For the existing translated content in 'zh-hans' or 'pt-pt', you can duplicate them in bulk to the new languages using the WPML Translation Management Dashboard. For more details, check out how to duplicate pages and posts in bulk.

If this solution does not apply to your case, or if it seems outdated, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If you still need assistance, please open a new support ticket.

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 3 voices.

Last updated by Bigul 6 months ago.

Assisted by: Bigul.

Author Posts
June 24, 2024 at 5:38 pm #15810054

juergenS-23

Background of the issue:
I'm using this format 'Different languages in directories (hidden link - English, hidden link - Arabic)' for my site hidden link. I have an issue with 2 languages whose format are as follows: hidden link - From Chinese simplified, hidden link - From Portuguese Portugal. I need to use this format instead: hidden link, hidden link. I already have content existing on the site and translated into those languages.

Symptoms:
I need to change the URL format for Chinese simplified and Portuguese Portugal without affecting the existing content.

Questions:
Can I edit the code to change the URL format for Chinese simplified and Portuguese Portugal without affecting the existing content?

June 24, 2024 at 6:03 pm #15810331

Lucas Vidal de Andrade
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Thank you for contacting WPML support. While you are waiting for one of my colleagues to take this ticket and work on it, let me provide you with first debugging steps or if I can perhaps help with the issue quickly.

Please check this other ticket, where a client had a similar questions:
https://wpml.org/forums/topic/changing-language-code/#:~:text=It's%20not%20possible%20to%20change,content%20into%20the%20new%20language.

If that does not help, one of my colleagues will soon come to continue support.

June 25, 2024 at 4:16 am #15815214

juergenS-23

I tried the solution on the thread, I have quite a number of translated pages, and I have also tried adding custom languages, but I keep getting the error " Please, enter required data." despite filling in all the needed information.

Please suggest how we can edit the existing code.

June 25, 2024 at 12:46 pm #15820769

Bigul
Supporter

Languages: English (English )

Timezone: Europe/Vienna (GMT+01:00)

Hello,

Thank you for the updates. Please share a screenshot for a better understanding of the following.

I keep getting the error " Please, enter required data." despite filling in all the needed information.

The language code is a unique value and it will not be possible to change the language code from the *zh-hans* to *zh*. Because it is stored in the database and connected with multiple tables. And also there are high chances of breaking the site if we change it directly from the database.

Therefore as a workaround, you can create a new custom language Chinese with language code ZH. Please refer to the following documentation for more details.

https://wpml.org/documentation/getting-started-guide/language-setup/editing-wpmls-languages-table/

hidden link

For the existing translated pages/posts(*zh-hans* or *pt-pt*), you can bulk duplicate them to the new languages from the WPML Translation Management Dashboard. Please check this article for more details

https://wpml.org/documentation/translating-your-contents/displaying-untranslated-content-on-pages-in-secondary-languages/#how-to-duplicate-pages-and-posts-in-bulk

--
Thanks!

Bigul