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.

This topic contains 3 replies, has 2 voices.

Last updated by Nicolas V. 1 year, 8 months ago.

Assisted by: Nicolas V..

Author Posts
August 18, 2023 at 6:10 am #14249483

cedricP-6

We have a custom plugin named qc-carrers in which we have some custom strings and we have made them translatable using _e() function. We have also translated them in the wpml string translations but their translated version is not showing in the frontend.

Here is the site url: hidden link

In the menu click on the english flag then you will get redirected to english version of the page then scroll to bottom and you will see that section.

Thanks!

Home-Damers-Beaulne-Careers.png
Traduction-de-chaînes-‹-Demers-Beaulne-Carrières-—-WordPress.png
Screenshot 2023-08-18 113541.png
August 18, 2023 at 6:48 pm #14254811

Nicolas V.
Supporter

Languages: English (English ) French (Français )

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

Hello,

Welcome to the WPML support forum.
Let's try some basic debug steps:
1. I don't think that's the issue here but could you try with single quotes instead of double quotes?

_e('Postuler', 'qc-carrers')

2. Go to "WPML > Theme and plugins localization" and rescan your plugin
3. Then go to "WPML > String Translation" and update the translation by adding a space at the end
4. Make sure you purge your caches

If it doesn't work:
1. At the bottom of the "String Translation" in "Auto register strings for translation, check the box "Look for strings while pages are rendered" just for a moment
2. Refresh the frontend to see if the translation appears
3. Uncheck that option right after (pretty heavy in ressources, can slow down the site)

If the translation appears only when that option is activated it could mean that there is an issue with your .mo files.
1. Go to "WPML > Support > Troubleshooting (link)
2. Click on "Show custom MO Files Pre-generation dialog box"
3. Then go back to "WPML > Theme and plugins localization", and you should have a pop-up with a button to "Generate .mo files".

August 21, 2023 at 8:35 am #14261043

cedricP-6

Hi,

Thanks for your response.
I have tried the above steps and when I check the box "Look for strings while pages are rendered" it works in the frontend.
I didn't find the option for the "Show custom MO Files Pre-generation dialog box" on the troubleshooting page, But I get an error on the page here is the error details.

Fatal error: Uncaught Error: Call to a member function toArray() on int in /home/152725.cloudwaysapps.com/hckyursczw/public_html/wp-content/plugins/wpml-string-translation/classes/MO/Generate/DomainsAndLanguagesRepository.php: 50 Stack trace: #0 /home/152725.cloudwaysapps.com/hckyursczw/public_html/wp-content/plugins/wpml-string-translation/classes/MO/Generate/DomainsAndLanguagesRepository.php(38): WPML\ST\MO\ Generate\DomainsAndLanguagesRepository->getAllDomains() #1 /home/152725.cloudwaysapps.com/hckyursczw/public_html/wp-content/plugins/wpml-string-translation/classes/Troubleshooting/BackendHooks.php(30): WPML\ST\ MO\Generate\DomainsAndLanguagesRepository->get() #2 /home/152725.cloudwaysapps.com/hckyursczw/public_html/wp-includes/class-wp-hook.php(310): WPML\ST\Troubleshooting\BackendHooks->displayButtons () #3 /home/152725.cloudwaysapps.com/hckyursczw/public_html/wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters() #4 /home/152725.cloudwaysapps.com/hckyursczw/public_html/wp-includes/plugin.php( 517): WP_Hook->do_ac in/home/152725.cloudwaysapps.com/hckyursczw/public_html/wp-content/plugins/wpml-string-translation/classes/MO/Generate/DomainsAndLanguagesRepository.php on line 50

Can you please look into this please?

Thanks!

Troubleshooting-‹-Demers-Beaulne-Careers-—-WordPress.png
August 21, 2023 at 5:14 pm #14266103

Nicolas V.
Supporter

Languages: English (English ) French (Français )

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

Hello,

Ok, so we're on the right path. There is something causing an issue with the option to "generate .mo files".

I found a similar issue here: https://wpml.org/forums/topic/wpml-string-translation-is-attempting-to-write-mo-files-with-translations-to-fo-6/

1. Make sure you have the latest version of WPML (v.4.6.5) and String Translation (v. 3.2.7)
You can download them here:
https://wpml.org/download/wpml-multilingual-cms/?section=changelog
https://wpml.org/download/wpml-string-translation/?section=changelog

2. Make sure that a /languages folder exist in /wp-content and that the folder's permissions are 755