Open

Topic Tags: String Translation

Symptoms

WordPress Block (“Gutenberg”) editor comes with a new strategy for string translation. It’s now possible to translate a string inside a JavaScript function. The consequence of this new feature is that all strings of the related script need to be loaded on the browser side. This is not compliant with the current WPML strategy to scan and filter the translations.

As the Block editor code is evolving quickly, we decided to wait until it’s merged into WordPress, and with a clear and stable API. Meanwhile, all the string translations in the Block editor will be loaded through the standard WordPress API regardless of WPML localization settings. Because of this, the Block editor strings will not be translated using WPML String Translation.

This should not affect the user experience too much since this new feature is only used in the backend (Block editor) and it is already significantly translated by the community.

Update 26/02/2019: Since WPML 4.2.0, the JavaScript translation files (JED) are imported and the translations can be adjusted. WPML is creating its own JED files with custom translations. However, we are also now working on a solution to scan strings inside JavaScript files.

Workaround

4 Responses to “Issue with string translation inside WordPress Block (“Gutenberg”) editor”

  1. Would be nice to see a JS solution sooner rather than later, as I’d like to use string translation on Gutenberg blocks I wrote myself. Thanks.

    • Hi @martinS-123,

      We are working to support this feature, but the WordPress API is still evolving and some new filters (which are required) are planned for after WP 5.0.0.

      We’ll keep you updated as soon as possible.

      Thanks,
      Pierre

  2. Hi, this is just to inform you that since WPML 4.2.0, the JS translation files (JED) are imported and the translations can be adjusted. WPML is creating its own JED files with custom translations. However, we are now working on a solution to scan strings inside JS files.

Leave a Reply

Please leave here comments about this page only.
For technical support and feature suggestions, head to our forum. We are waiting there!

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>