Skip Navigation

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

Problem:
The client was unable to import a PO file for the English language because the English option was not appearing in the dropdown list during the import process in WPML. Additionally, even after importing, the translated strings were not reflecting on the frontend.
Solution:
To address the dropdown issue, we recommended modifying the WPML String Translation plugin code. Specifically, the client should edit the file at

/wp-content/plugins/wpml-string-translation/menu/string-translation.php

and make the following changes:
1. Around line 671, replace the existing code with:

foreach ($active_languages as $al) : ?>

2. Repeat the modification around line 746.
It's crucial to back up the database and website before making these changes.
For the issue of translations not appearing on the frontend, it was identified as a custom plugin text domain loading issue. The solution was to add the text domain "wc-wintree" in WPML under Theme and plugins localization > Localization options > Automatically load the theme's .mo file using 'load_textdomain'.

If these solutions do not resolve your issue or seem outdated, please check the related known issues and ensure you have the latest versions of themes and plugins installed. If the problem persists, we highly recommend opening a new support ticket here.

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

Last updated by royE-2 2 weeks, 2 days ago.

Assisted by: Long Nguyen.

Author Posts
April 12, 2024 at 8:18 am

royE-2

Hi, we have troubles with a po/mo file from apl that isn't used for translations. While another plugin can read the po/mo files and we can edit it.

April 12, 2024 at 9:53 am
April 15, 2024 at 1:28 am #15516866

Long Nguyen
Supporter

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

There is a workaround to make the English language show in the dropdown list when importing the PO file. Please follow steps below:

1. Edit the file /wp-content/plugins/wpml-string-translation/menu/string-translation.php

2. Around line 671, replace the code:

foreach ( $active_languages as $al ) :
	if ( $al['code'] == $string_settings['strings_language'] ) {
		continue;}
	?>

with this one

foreach ( $active_languages as $al ) :	?>

3 Around line 746, repeat step 2.

❌ IMPORTANT: Please backup your database and website before proceeding ❌

Looking forward to your reply.
Thanks

April 19, 2024 at 9:21 am #15542540

royE-2

We were able to import the english string translations and now see that multiple strings are indeed translated. However when we go to the front end and then switch to the english language nothing changes like we didn't switch at all while in the backend it show that it is translated. And yes the string i am talking about strings that encoded like this : are __('string', 'translation-domain')

Do you have any idea what is going wrong? I added 2 images. "translated-string.PNG" shows that the string is translated in backend and "front-end-not-translated.PNG" shows that in the english language in the frontend the string is not getting translated. Could you tell me what is going wrong?

Kind regards,

Martijn

translated-string.PNG
front-end-not-translated.PNG
April 22, 2024 at 1:15 am #15547865

Long Nguyen
Supporter

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

After updating the plugin WPML String Translation to the new version 3.2.10, the translation strings are displayed in the frontend as well. Please check the attached screenshot.
However, it doesn't work with the latest version 3.2.11. I'm not sure what's wrong with your custom plugin.

I made a test by adding the code below to the file functions.php in the custom plugin and a standard theme of WordPress (2021). Only the translation string in the theme is displayed.

add_action( 'wp_footer', function() {
    echo __( "WPML test string", 'wc-wintree');
});

I suggest you get in touch with your developer and check the issue with the custom plugin. If you are not able to accomplish this, I would recommend you contact one of our certified partners who will be more than happy to help you with this. In this link, you will find a list of our certified partners: https://wpml.org/contractors/

Looking forward to your reply.
Thanks

Dashboard – Boomkwekerij Udenhout 2024-04-22 08-08-41.jpg
April 24, 2024 at 2:03 pm #15561072

royE-2

I am the developer of that plugin and i checked the plugin and cannot find anything why it wouldn't be translated in the newest version of the plugin. I also cannot see anything within the update 3.2.11 that would cause this?

Kind regards,

Martijn

April 25, 2024 at 4:08 am #15563104

Long Nguyen
Supporter

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

I'm not sure what the root issue is on your site but I tried to replicate the issue on a clean installation of WordPress, install only your plugin and didn't see that. If you want to take a look, please click on this link hidden link

Also, after restoring your site on my localhost, I find a workaround to fix the issue with your instance when using WPML String Translation 3.2.11.

1. Go to WPML > Languages > Change the default language to English.
2. Go to WPML > Theme and plugins localization > Scan strings in the custom plugin wc-wintree.
3. Go to WPML > String Translation > Import the PO file.
4. Check the translation strings in the frontend, if it works properly, you can change the default language back to Dutch.

I hope that helps.

Dashboard – Boomkwekerij Udenhout 2024-04-25 11-07-26.png
May 3, 2024 at 8:35 am #15590190

royE-2

Sorry for my late response. I will look into this!

Kind regards,

Martijn

May 6, 2024 at 1:11 am #15594812

Long Nguyen
Supporter

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

I'm waiting for your feedback.

Thanks.

May 6, 2024 at 11:51 am #15597031

royE-2

Hi,

I updated the string-translation plugin and did the 4 steps you said i could do to fix it but sadly it did not fix the problem. I made a backup of the older version of string translation so can put back if needed.

In the backend the strings are shown as dutch strings and it shows that it has an English translation as it has a pencil for the English language.

Kind regard,

Martijn

May 7, 2024 at 2:39 am #15599562

Long Nguyen
Supporter

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

It looks like a specific issue on your site only. I'm discussing this with our 2nd tier support and I will update you here when I have something to share.

Thanks.

May 8, 2024 at 8:19 am #15604795

Long Nguyen
Supporter

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

I got some information from our 2nd tier support. It could be a custom plugin text domain loading issue. The issue has been solved by adding the text domain "wc-wintree" to WPML > Theme and plugins localization > Localization options > Automatically load the theme's .mo file using 'load_textdomain'.

Looking forward to your reply.
Thanks

May 14, 2024 at 10:07 am #15624670

royE-2

That fixed the problem, thx for the support!

Kind regard,

Martijn

royE-2 confirmed that the issue was resolved on 2024-05-14 10:08:31.
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.