Skip Navigation

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.

Sun Mon Tue Wed Thu Fri Sat
- 8:00 – 10:00 8:00 – 10:00 8:00 – 13:00 8:00 – 13:00 9:00 – 13:00 -
- 11:00 – 17:00 11:00 – 17:00 14:00 – 17:00 13:00 – 17:00 13:00 – 18:00 -

Supporter timezone: America/New_York (GMT-05:00)

This topic contains 0 replies, has 0 voices.

Last updated by Lauren 3 days, 13 hours ago.

Assisted by: Lauren.

Author Posts
February 19, 2025 at 5:04 pm #16726138

timothyB-8

Background of the issue:
I recently upgraded to version 4.7 of WPML. I want to change our current simplified Chinese language folder from /zh-hans/ to /zh/. Prior to version 4.7, it seemed necessary to create a new version of simplified Chinese and copy over the content from the old one to use /zh/. However, this does not seem possible in version 4.7.

Symptoms:
I am unable to change the language folder for simplified Chinese from /zh-hans/ to /zh/ in WPML version 4.7.

Questions:
Is there a known way to change the language folder from /zh-hans/ to /zh/ in WPML version 4.7? Also, we plan to use AI translation for the Chinese site (and several other languages too). I just want to make sure this won't affect that either.

February 20, 2025 at 1:03 pm #16729636

timothyB-8

So, with the help of our developer we've turned off our custom theme and are using the default 2023 theme. We've deactivated all plug-ins except WPML and we tried adding the Portuguese with a code of PT (this is something we needed to do in addition to changing our Chinese path to /ZH/), but still got the following error:

[20-Feb-2025 10:19:21 UTC] PHP Fatal error: Uncaught Error: Call to undefined method WP_Error::filter() in /nas/content/live/siemondev/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/Fns.php:189
Stack trace:
#0 [internal function]: WPML\FP\Fns::WPML\FP\{closure}(Object(Closure), Object(WP_Error))
#1 /nas/content/live/siemondev/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/functions.php(154): call_user_func_array(Object(Closure), Array)
#2 [internal function]: WPML\FP\{closure}(Object(WP_Error))
#3 /nas/content/live/siemondev/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/functions.php(50): call_user_func_array(Object(Closure), Array)
#4 /nas/content/live/siemondev/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/Either.php(105): WPML\FP\{closure}(Object(WP_Error))
#5 /nas/content/live/siemondev/wp-content/plugins/sitepress-multilingual-cms/menu/edit-languages.php(1380): WPML\FP\Left->bimap(Object(Closure), Object(Closure))
#6 /nas/content/live/siemondev/wp-content/plugins/sitepress-multilingual-cms/menu/edit-languages.php(790): SitePress_EditLanguages->saveLanguageMapping(Array)
#7 /nas/content/live/siemondev/wp-content/plugins/sitepress-multilingual-cms/menu/edit-languages.php(118): SitePress_EditLanguages->update()
#8 /nas/content/live/siemondev/wp-content/plugins/sitepress-multilingual-cms/menu/languages.php(30): SitePress_EditLanguages->__construct(Object(WPML_Flags))
#9 /nas/content/live/siemondev/wp-admin/admin.php(293): include('/nas/content/li...')
#10 {main}
thrown in /nas/content/live/siemondev/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/Fns.php on line 189

February 20, 2025 at 7:25 pm #16731155

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-05:00)

Please make sure you are using the latest version of WPML plugins. Go to Plugins -> Add New -> Commercial and click Check for updates and update any as needed.

With minimal settings, please be sure to make a full backup of your site and database.

Then, go to WPML -> Support -> Troubleshooting.

Look for 'Clean up' and click the following:
- Synchronize posts taxonomies
- Clear the cache in WPML
- Remove ghost entries from the translation tables
- Fix element_type collation
- Set language information
- Synchronize local job IDs
- Fix Terms count
- Fix post assignment for translations

If that does not resolve the issue, I'd like to request credentials so that I can login and take a closer look. The next reply will be marked as private so that you can share login details in the included private fields.

February 21, 2025 at 4:05 pm #16734528

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-05:00)

I logged in to the test site and the first thing I saw was the message from WPML asking if the site was a copy or moved. I marked it as a copy, as this banner not being resolved could be related to the error. I then went to WPML -> Languages -> Edit languages and mapped both Chinese languages. I then attempted to add a custom pt language, but got the message that the locale already exists. Sure enough, the standard locale for Portuguese (Portugal) is pt. WPML will not allow you to create a custom language with the same language code that already exists in the database. So you can either create a custom language with something other than pt, or you can use the standard Portuguese (Portugal) language. I was not able to recreate any fatal errors with these steps. Please let me know if there is something else you are doing that is causing the error, and what steps I should take to reproduce it. Thanks!

February 24, 2025 at 5:29 pm #16742532

timothyB-8

Hi Lauren, thanks for your help so far. Okay, focusing on the Simplified Chinese that lives on /zh/ - we get the following warning:

-----------------
WordPress cannot automatically download translations for the following languages:

Chinese (current locale: zh) - suggested locale(s): zh_TW, zh_HK, zh_CN

To fix, open "Edit Languages" and set the "default locale" values as shown above.
----------------

We wanted to be able to create this /zh/ so we can copy all the contents of /zh-hans/ over to it. We are also going to want to be able to use AI translations, so that's a problem. Is there some configuration we missed?

Thanks!

Tim

Screenshot 2025-02-24 122735.png
February 25, 2025 at 11:04 pm #16748520

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-05:00)

I can no longer access the site, so if you can update the previous reply where you shared credentials that would be helpful for me to further troubleshoot.

The language mapping is what is used for automatic translation, so as long as it is mapped correctly you should be fine to use the automatic translations.

As for the locale, this can be changed any time. Could you use zh_HK for now, then copy all the content over from zh_hans to zh, and then update the locale? The locale is not what shows in the URL, that's the language code that you see in the second column.

Please let me know if that works as a workaround for you.

February 27, 2025 at 9:52 pm #16758335

timothyB-8

Hi Lauren, apologies - I've restored your log in to our Dev site. I think we are getting closer. We have the Chinese as we need it (using /zh/). So, I think we're good there. Just a couple other, hopefully minor, issues:

1.) We created a new Portuguese language (so it's using /pt/), however we got an error that auto translations would fail because of the "Default locale". It was just "pt", so we tried "pt_PT" and "pt_BR" and neither worked because it said they already existed. I tried changing it to "pt_AO" and it accepted that. However, we really want to use "pt_BR". Is there a reason why it says they still exist? We only have this one Portuguese language listed.

2.) We have an old Chinese (traditional) language that we deleted quite a while ago. However we get this notice asking if we want to fully delete it - choosing to delete the content does not delete it - it just reappears (see screenshot). It doesn't seem to give an error.

Any insights would be appreciated!

Tim

Screenshot 2025-02-27 164804.png
Screenshot 2025-02-27 164603.png
February 28, 2025 at 9:47 pm #16762906

Lauren
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-05:00)

Glad the Chinese is working now. As for Portugeuse, the reason it can't be added as a custom language with pt_BR is because it already exists as a standard language, so that locale is already in the database for Portuguese (Brazil). You can simply use the Portuguese (Brazil) standard language but if you want it to be a custom language than you need to use a locale that does not already exist. Here's a list of current codes: hidden link

2. Do you have access to the database to confirm if this content actually exists, or if it's a false message? You can use a plugin such as Adminer to acccess the database or contact your hosting provider. If you find the content in the database, remove the old language entries and let me know if this resolves the issue. If you don't find the content and it's a false error, let me know and we can further troubleshoot.