Skip Navigation

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

Problem:
You are trying to translate the Better Messages plugin but the translations are not showing. This issue arises because the strings are JavaScript strings, which WPML currently cannot translate directly.
Solution:
We recommend installing the Loco Translate plugin as a workaround to translate these JavaScript strings. You can add the translations using Loco Translate and then deactivate the plugin if desired. For more details on translating JavaScript strings, please visit this page.

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 you still need assistance, please open a new support ticket.

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

Last updated by Osama Mersal 10 months, 2 weeks ago.

Assisted by: Osama Mersal.

Author Posts
June 3, 2024 at 8:54 am

laszloA

Background of the issue:
I'm trying to translate the Better Messages plugin (hidden link) on my site hidden link. I added all the string translations.

Symptoms:
The translations don't show.

Questions:
How can I solve this?
How can I find what causes the problem?

June 3, 2024 at 9:15 am
June 3, 2024 at 9:17 am #15697069

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

Please log in to this sandbox site and install the Better Messages plugin. (hidden link)

After that, please try to replicate the issue. If it is replicable, please let me know so I can consult our compatibility team about it.

Best regards,
Osama

June 13, 2024 at 7:23 am #15734446

laszloA

Sorry, I didn't get any notification about your reply. Could you create a new sandbox please?

June 13, 2024 at 7:30 am #15734493

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

Here is a new sandbox site. (hidden link)

Best regards,
Osama

June 13, 2024 at 11:55 am #15736023

laszloA

Thanks.

I added the plugin and the translation. You can check it here: hidden link

June 13, 2024 at 12:13 pm #15736041

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

Thanks for replicating the issue. I searched for the strings and found that they are JavaScript strings, which WPML can't translate currently. Kindly check this page. (https://wpml.org/errata/translating-strings-from-javascript-files-using-wp_set_script_translations/)

As a workaround, you can install the Loco Translate plugin and translate the JS strings using it.

Best regards,
Osama

June 13, 2024 at 12:59 pm #15736269

laszloA

As I only need a few customer-facing strings to be translated: can I do it with code through functions.php or something similar? I'm a bit worried about installing a second translation plugin becaue of the conflicts and site speed.

June 13, 2024 at 1:14 pm #15736413

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+03:00)

Hi,

I'm not sure if there is an approach to translating JS strings using code.

You can install Loco, add the translations, and deactivate it. I did the same on the sandbox site to test this method. Kindly check this page. (hidden link)

Best regards,
Osama

June 13, 2024 at 5:56 pm #15737508

laszloA

Thanks, it worked