Skip Navigation

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

Problem:
You are trying to translate hardcoded theme strings using WPML and have enabled the 'Look for strings while pages are rendered' setting. Despite regenerating the .mo files and configuring a text domain, the French translations are not displaying correctly. Instead of showing 'Bleu = événement OCO', the text displays in English as 'Blue = OCO Event'.
Solution:
We recommend ensuring that you have used the Gettext functions to display these custom strings. For guidance on how to implement this, please refer to our documentation on Translating the Theme You Created.

If this solution does not resolve your issue or 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 the problem persists, please open a new support ticket at WPML support forum for further assistance.

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 1 reply, has 0 voices.

Last updated by Carlos Rojas 1 month ago.

Assisted by: Carlos Rojas.

Author Posts
January 10, 2025 at 2:56 am #16580201

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. The issue can be seen on this page: hidden link. The code used is: .

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:
Why are the translated strings not displaying correctly?
Is there a specific step I am missing in the translation process?

January 10, 2025 at 10:14 am #16581267

Carlos Rojas
Supporter

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

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

Hello,
Thank you for contacting us

Have you used the Gettext functions to display this custom string?

Check this example: https://wpml.org/documentation/support/translating-the-theme-you-created/#wrap-all-texts-in-gettext-calls

Regards,
Carlos