Skip Navigation

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

Problem:
If you're experiencing issues with translating hard-coded theme strings using WPML, and facing problems with permalinks and slugs resulting in 404 errors, this might be due to the theme not being properly scanned for translatable strings. You might notice that despite using the 'Look for strings while pages are rendered' setting and regenerating .mo files, the translated strings do not display correctly, showing in the default language instead of the expected translation.
Solution:
We recommend going to your WordPress dashboard, navigating to WPML > Theme and Plugins Localization, and selecting the plugin or theme containing the problematic code. Click the scan button to ensure the code is scanned properly. After scanning, return to the String Translation page and search for the string in question to check if there's an untranslated instance. For detailed guidance, visit finding strings that don't appear on the string translation page.
If the issue persists or the solution seems outdated or irrelevant to your case, 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 further assistance is needed, please open a new support ticket at WPML support forum.

0% of people find this useful.

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.

This topic contains 0 replies, has 0 voices.

Last updated by Christopher Amirian 1 week, 5 days ago.

Assisted by: Christopher Amirian.

Author Posts
January 27, 2025 at 10:39 pm #16639432

cliffA

Background of the issue:
I am trying to translate hard coded theme strings using WPML. I have the 'Look for strings while pages are rendered' setting checked. I attempted to regenerate the .mo files and have a text domain configured. Yes, I am using the Gettext functions with appropriate text-domain. Link to a page where the issue can be seen: hidden link

This is also causing issues with permalinks and slugs(custom post types with translated permalinks are giving 404 errors).

Symptoms:
The translated strings are not displaying correctly. Instead of showing the French translation 'Bleu = événement OCO', the text displays in English as 'Blue = OCO Event'.

Questions:

January 28, 2025 at 7:30 am #16640040

Christopher Amirian
Supporter

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi,

Welcome to WPML Support. Would you please go to WordPress dashboard > WPML > theme and plug-ins localization and select the plug-in or theme that you have that code and click the cam button to make sure that the code is scanned.

Then please go back to string translation and search for the string question, see if you can find another instance of the same street there that is still not translated.

For more information:

https://wpml.org/documentation/getting-started-guide/string-translation/finding-strings-that-dont-appear-on-the-string-translation-page/

If the issue persists, I'd appreciate it if you could give me the URL/User/Pass of your WordPress dashboard after you make sure that you have a backup of your website.
It is absolutely important that you give us a guarantee that you have a backup so if something happens you will have a point of restore.

Make sure you set the next reply as private.

I also will need to know what is the address of the file that contains the drinking question.

Thank you.

January 29, 2025 at 2:18 pm #16647270

Christopher Amirian
Supporter

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi,

Thank you for the login information. The issue is fixed:

hidden link

The Theme that you had the code in, was not correctly scanned,

I went to WP Dashboard > WPML > Theme and plugins localization and scanned the theme.

Then checked the string translation and by searching the string in question I found another instance of the text and I translated it.

If you add additional changes please use the scan section of the documentation below to know how to scan the changes:

https://wpml.org/documentation/getting-started-guide/string-translation/finding-strings-that-dont-appear-on-the-string-translation-page/

Thanks.