Skip Navigation

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

Problem:
The client wants to translate a few hardcoded strings from a plugin.

Solution:
Wrapped the strings in the gettext functions __() by following this doc:
https://wpml.org/documentation/support/enabling-text-translation-for-themes-not-compatible-with-wpml/ solved the issue

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

Last updated by Noman 1 year, 6 months ago.

Assisted by: Noman.

Author Posts
July 26, 2023 at 9:26 am #14101553

julijaL-3

Hello, I can't translate certain strings. I need help. Screenshots are attached.

July 26, 2023 at 11:01 am #14102779

Noman
Supporter

Languages: English (English )

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

To take a closer look at this issue, please provide temporary access (WP-Admin and FTP Login info) to your site (preferably staging site), so that I can look into your setup and debug the issue.

Your next answer will be private which means only you and I have access to it.

=== Please backup your database and website ===

✙ I would additionally need your permission to deactivate and reactivate Plugins and the Theme and to change configurations on the site. This is also a reason the backup is really important.

Thank you

July 26, 2023 at 3:45 pm #14105653

Noman
Supporter

Languages: English (English )

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

After thoroughly reviewing your site, I discovered that the two strings causing the issue were originating from the ShopEngine plugin and were not wrapped in the gettext function, which is essential for making them translatable.

To address this problem, I followed the steps outlined below:

1. I edited the "shopengine/widgets/product-tabs/product-tabs.php" file and wrapped the problematic strings in the gettext function.

For the "Average rating" string, I replaced the original code:

$htm .= '<h2>Average rating</h2>';

With the following code:

$htm .= '<h2>'.__('Average rating','shopengine-custom').'</h2>';

And for the "Review" string, I made the following modification:

$htm .= '<strong class="se-avg-count">' . $count . ' Review</strong>';

By changing it to:

$htm .= '<strong class="se-avg-count">' . $count . ' '.__('Review','shopengine-custom').'</strong>';

2. After making the code adjustments, I proceeded to the WPML >> Theme and plugins localization page and scanned the ShopEngine plugin.

3. Next, I accessed the WPML >> String Translation page and added the necessary translations. You can find and update them using this link: hidden link

I am pleased to confirm that these actions have successfully resolved the issue. You can verify the fix by visiting the following link: hidden link

For future reference, I recommend contacting the author of the ShopEngine plugin about this issue so that they can apply this fix to their plugin files. This way, future updates of the plugin won't cause the loss of these changes on your site.

If you require any further assistance or have additional concerns, please don't hesitate to let me know. Thank you for your cooperation and understanding.