Skip to content Skip to sidebar

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

Problem:
If you're experiencing issues with translating custom block contents despite having wrapped them in localization tags, it might be because these are JavaScript strings.
Solution:
We recommend following our guide on adding gettext calls to JavaScript code, which you can find here: Translating JavaScript strings in WPML.
However, be aware of a known issue where WPML might not currently translate JavaScript strings effectively. You can learn more about this problem here: Translating strings from JavaScript files issue.
Additionally, strings like "Choose file" and "No file chosen" are dependent on the browser's language setting and may not be influenced by WPML.

If this solution does not apply to your case, or if it seems outdated, we highly recommend checking related known issues at WPML Known Issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If issues persist, 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.

This topic contains 3 replies, has 2 voices.

Last updated by Andrey 11 months ago.

Assisted by: Andrey.

Author Posts
August 15, 2024 at 8:22 pm #16076147

karelR-3

2. Custom block contents not being translateable despite having wrapped them in localisation tags

August 15, 2024 at 8:30 pm #16076157

Andrey
WPML Supporter since 06/2013

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+03:00)

I would like to know what custom block you are referring to, how it was created, and how you wrapped the tags. Please also show the issue on a screenshot.

August 15, 2024 at 8:31 pm #16076180

karelR-3

Screenshots from both src and build files.

Screenshot 2024-08-15 at 21.31.26.png
Screenshot 2024-08-15 at 21.30.22.png
August 15, 2024 at 8:56 pm #16076244

Andrey
WPML Supporter since 06/2013

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+03:00)

As far as I can see, those are JavaScript strings. To translate them, follow this guide: https://wpml.org/documentation/support/translating-the-theme-you-created/#adding-gettext-calls-to-javascript-js-code.

However, you may encounter a problem https://wpml.org/errata/translating-strings-from-javascript-files-using-wp_set_script_translations/ that WPML can't currently translate.

I also noticed stings like "Choose file" and "No file chosen." Those strings depend on the browser language.