Skip Navigation

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

Problem:
The client was experiencing issues with mapping a custom language code for Chinese Simplified (zh-CN) in WPML. Despite multiple attempts to save the settings, the language showed errors and was not mapping correctly, which prevented automatic translations.

Solution:
We recommended the following steps:
1. Ensure a full site backup is created.
2. Replace the function

get_languages_supported_by_automatic_translations()

in the file

\sitepress-multilingual-cms\classes\ATE\API\class-wpml-tm-ate-api.php

with a new function that includes a case mapping for 'zh-CN' to 'zh-cn'.
3. Save the changes and verify if the issue is resolved.

This solution might become outdated or may not directly address similar issues due to different configurations or WPML updates. If this solution does not resolve your issue, or if you encounter other problems, please visit our support forum and open a new ticket. We also 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.

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 2 replies, has 1 voice.

Last updated by Carlos Rojas 2 months, 2 weeks ago.

Assisted by: Carlos Rojas.

Author Posts
November 25, 2024 at 3:01 pm #16440644

sonT-3

Background of the issue:
I created a new language (Chinese (Simplified)2) for custom code zh-CN, and mapped it to Language mapping in WPML. I saved it multiple times, but that language still shows an error.
"Content in this language cannot be automatically translated unless you map it to a supported language."
Because of that I cannot use the Translation Management for that language.

Symptoms:
Content in this language cannot be automatically translated unless you map it to a supported language.

Questions:
Why does the new language show an error when Language mapping?

November 25, 2024 at 4:55 pm #16441376

Andrey
Supporter

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

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

One of my colleagues will take on your ticket. In the meantime, I would like to provide some helpful information.

Check out our list of supported languages to see which translation engines and languages are available.

hidden link

November 26, 2024 at 1:55 pm #16445236

sonT-3

I've not seen any supporter assigned to my ticket?

And the problem language is zh-Hans Chinese (Simplified) zh-hans, that is fully supported by WPML. I just edit to have the code zh-CN instead of zh-hans

November 27, 2024 at 10:57 am #16448750

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

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

Hello,
My name is Carlos and I will continue working on this ticket

I want to take a closer look at the site configuration. I have set your next message private so you can securely share the access credentials.

Please don't forget to create a full site backup before sharing the credentials.

Regards,
Carlos

November 27, 2024 at 12:37 pm #16449333

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

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

Thank you for sharing the credentials.

When I visited the site configuration the Chinese Simplified was deactivated. I activated it again and selected the language. It works correctly.

November 27, 2024 at 12:54 pm #16449800

sonT-3

It's not what I want.
I want to create a new Chinese Simplified with the code zh-CN, instead of the defalt Chinese Simplified with the code zh-hans.

It just have problem with custom Chinese Simplified language. For custom Chinese Traditional (zh-TQ) and Portuguese (pt), I got no problem.

November 27, 2024 at 1:03 pm #16449861

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

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

Hi,

It is done already -check the attached image-

FireShot Capture 050 - Languages ‹ UrbanAna — WordPress - urbanana.su.png
November 27, 2024 at 1:18 pm #16449940

sonT-3

I mean this code (in RED rectangle, pic1.png ). I want it to be zh-CN, instead of default zh-hans.

So we can access Chinese Simplified via hidden link , instead of hidden link

I've success with pt and zh-TW (attachment, pic2.png), only Chinese Simplified cannot map.

pic2.png
pic1.png
November 27, 2024 at 1:30 pm #16450011

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

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

Thank you for your clarification.

I added the Chinese Simplified with zn_CN code. Now you just need to add the correct language name translations and the flag.

Can you confirm that the issue is solved?

November 27, 2024 at 1:35 pm #16450139

sonT-3

Yup, I see that your setting still have the error like we have. You can refresh the page and see the warning like in attachment image.

And the code we want is zh-CN. Not zn-CN

chrome_osryXl6FZ5.png
November 27, 2024 at 1:49 pm #16450178

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

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

Thank you for your feedback.

I took a look at the database and the Chinese (Simplified) that comes with WPML has 'zh_CN' code in the default locale column. So, you have two options here:
- Edit the entry in the database for that particular language and adjust the language code -> These changes can be overwritten when everytime you update the WPML plugins
- Or add a new custom language with a different default local code (different than 'zh_CN') -> This is the recommended option.

November 27, 2024 at 2:04 pm #16450328

sonT-3

I've follow these topic to change the hreflang

https://wpml.org/forums/topic/hreflang-code-change/
https://wpml.org/vi/faq/how-can-i-assign-or-change-language-code-to-existing-content/

So following those topic, in order to create a custom code for the language (hreflang code), I changed the Default locale of the default language (in RED, to zh_CN2), then create a new language (in Blue).

And it work for pt and zh-TW.

I'm perplexed why it just not work for zh-CN. Can you investigate this?

Untitled.png
November 27, 2024 at 2:21 pm #16450436

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

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

Hi,

I fixed the hreflang column and it seems that the message under the language mapping is just a false positive. You can see in hidden link -> Language Mappings that it is correctly mapped.

November 27, 2024 at 2:40 pm #16450612

sonT-3

I hope that it is just a false positive, but it's not.

When I use the Translation Dashboard, If I set Chinese (Simplified) as Translate automatically, it will show the lack of mapping error, and not allow me to click Translate (pic1.png)

So I have to set it to Translate myself and I can click Translate (pic2.png). Then I need to go the the Page, and manually using WPML Translation Editor to translate Chinese (Simplified), just that 1 language.

This is just the setup, so I want to make it correctly.

I'm gonna have much more posts and pages. Then having to go through each of them and manually go through WPML Translation Editor is not a good idea.

pic2.png
pic1.png
November 28, 2024 at 9:56 am #16453902

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

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

Hi there,
I'm consulting this issue with my colleagues, we suspect there is an issue on our side.

I will get back to you as soon as get more information.