Skip Navigation

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

Problem:
The client has translations in .po/.mo files within the languages directory of their child theme and wants WPML to use these translations instead of its own.

Solution:
We recommended ensuring that the translation file names match the language locale. The client can verify the language locale by navigating to WPML >> Languages >> Edit Languages. We provided a link to the WordPress developer documentation for further guidance on using

load_child_theme_textdomain

:
https://developer.wordpress.org/reference/functions/load_child_theme_textdomain/

If the solution provided here does not apply or is outdated, we suggest opening a new support 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. For further assistance, please contact us through the WPML support forum: https://wpml.org/forums/forum/english-support/.

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 18 replies, has 2 voices.

Last updated by Noman 8 months, 1 week ago.

Assisted by: Noman.

Author Posts
March 13, 2024 at 10:30 am #15402986

dariod-33

OK; I understand why my Model Template does not work in your Sanbox. I added thsi instruction to the page template

```
if (extension_loaded('intl') && class_exists('IntlDateFormatter')) {
echo "IntlDateFormatter is available.";
} else {
echo "IntlDateFormatter is not available. Please ensure the Intl extension is installed and enabled.";
}
```

and the result is that intl module is not installed in your PHP. Can you please add it so that I can test the template? Thank you in advance.

March 13, 2024 at 10:49 am #15403061

dariod-33

OK; I solved the problem.

I have to use it_IT.po instead of it.po and zh_CN.po instead of zh.po

March 13, 2024 at 10:50 am #15403065

dariod-33

Thank you for your support. I appreciated it. Using the sandbox it helped me to trouvbleshoot the problem. It is a good facility.

March 13, 2024 at 10:52 am #15403066

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

I’ve set the translation file names according to the language locale and now it seems to be working correctly as you can see in the attached screenshots.

You can check the language locale from WPML >> Languages >> Edit Languages as you can see in the attached screenshot:
hidden link

Here is a doc for more details:
https://developer.wordpress.org/reference/functions/load_child_theme_textdomain/

Could you please check and confirm?

Thank you

default locale.png
correct file names.png
Italian.png
Chinese.png
Edit languages page.png
March 13, 2024 at 10:59 am #15403168

dariod-33

Oh, we found the same solution at the same time! GREAT WORK, Noman. Thank you very much. That was the problem: naming conventions of PO/MO files.

By way, it looks like WordPress uses zh_CN for simplified chinese, international standard is zh_HANS, and WPML uses zh-hans. 🙂