Skip to content Skip to sidebar

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

Problem:
You are trying to translate strings using WPML and have noticed that the strings are displayed in the original language on the front end, despite being fully translated. The issue persists unless the 'Look for strings while pages are rendered' option is checked.
Solution:
We have resolved this issue by adding your theme's text domain to be automatically loaded from WPML > Theme and plugin localization. This adjustment should ensure that the translated strings display correctly on the front end without needing to check 'Look for strings while pages are rendered'.

If this solution does not resolve your issue, or if it seems outdated or irrelevant to your current setup, we recommend opening a new support ticket. Additionally, 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. For further assistance, please visit our support forum at WPML support forum.

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

Last updated by Dražen 1 year ago.

Assisted by: Dražen.

Author Posts
August 21, 2024 at 7:16 am #16088828

andreaP-96

Background of the issue:
I am trying to translate strings using WPML. I have some strings like this: . They are fully translated, but I see all of them on the front end in the original language. I have regenerated .mo files, but nothing has changed. If I check 'Look for strings while pages are rendered', I can see the translated strings on the front end, but when I uncheck it, the issue comes back. Link to a page where the issue can be seen: hidden link

Symptoms:
Strings are displayed in the original language on the front end instead of the translated version.

Questions:
How can I solve the issue of strings not being translated on the front end?
Why do the translated strings appear only when 'Look for strings while pages are rendered' is checked?

August 21, 2024 at 7:26 am #16088860

Dražen
Supporter

Languages: English (English )

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

Hello,

You have been inactive for a while so I have created a ticket.

1) Can you please share where these strings originally came from? Is this theme PHP strings, or you add it somehow?

2) Is the theme you are using custom-coded theme or?

Thanks,
Drazen

August 21, 2024 at 7:35 am #16088912

andreaP-96

I can't understand the first question.

The theme is custom coded.

August 21, 2024 at 7:57 am #16088935

Dražen
Supporter

Languages: English (English )

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

Hello,

okay, please note we can not debug custom-coded solutions and whole code, but I will be glad to help and try to direct you to the correct solutions.

Can you explain how these strings are being added to default language, via some code? If so, which one?

Regards,
Drazen

August 21, 2024 at 8:11 am #16088969

andreaP-96

I use strings like this one:

_e('Facilities','os2');

August 21, 2024 at 8:16 am #16088990

Dražen
Supporter

Languages: English (English )

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

Hello,

can you please try to use a different method, something like this:

__( 'Thank you!', 'my-plugin-domain' );

- https://wpml.org/documentation/support/enabling-text-translation-for-themes-not-compatible-with-wpml/

Rescan your theme and then re-translate.

Check if it works fine now.

Regards,
Drazen

August 21, 2024 at 8:29 am #16089133

andreaP-96

With this code I can't see any string on the front end.

August 21, 2024 at 9:15 am #16089409

Dražen
Supporter

Languages: English (English )

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

Hello,

Yes, that would need further adaptation of the code to show on the frontend.

Since it is custom-coded not much I can advise, it should work fine, probably there is some issue in your code of the theme or configuration of the theme.

I can advise you to try next:

1) Check if the issue happens without any additional plugins only WPML plugins enabled.

2) Check if the issue happens when using the WP default theme, you can add your string code somewhere random, like header.php, and then translate to check if it works fine.

3) Check your theme configuration and make sure files are setup correctly:
https://developer.wordpress.org/themes/basics/main-stylesheet-style-css/

Regards,
Drazen

August 21, 2024 at 9:58 am #16089568

andreaP-96

Hi,
I just tested the astra theme and the twentynineteen theme, the issue still persists.

August 21, 2024 at 11:40 am #16090183

Dražen
Supporter

Languages: English (English )

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

Hi,

please share the access details of your website, so I can log in and take a look.

I’m enabling a private message for the following reply.

We have strict policies regarding privacy and access to your information.

Please see:
https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/


- Please backup the site files and database before providing us access. 

- If you have a staging site where the problem can be reproduced, it is better to share access to the staging site.



Thanks,
Drazen

August 22, 2024 at 6:29 am #16092760

Dražen
Supporter

Languages: English (English )

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

Hello,

I have added your theme text domain to be automatically loaded from WPML > Theme and plugin localization, and it works fine, image is attached.

Please check.

Regards,
Drazen

Screenshot (6).png
August 22, 2024 at 6:54 am #16092865

andreaP-96

thank you!