Saltar navegación
69

Today we released the first public beta of a completely new String Translation, which avoids all database calls to translate strings on the front-end and WordPress admin.

The way String Translation in WPML works has changed over the years. Our goal was always to allow you to translate every piece of text on your site and to load the server as little as possible.

In recent years, plugins and themes have grown bigger, using many more translatable strings. A typical admin page which opens a page builder, WooCommerce and several other big plugins could load over 30K strings from the database. This growth in the number of translatable strings has made sites slower with String Translation. WPML allows you to translate everything on the page and when it filters these many strings, the CPU and database get loaded.

Today, we’re ready with a new version that completely changes how String Translation works. This new release does two major changes:

  • Only touch strings that you want to translate
  • Rely on .mo files to apply translations

The first change means that the String Translation table will not include all texts by all plugins and the theme by default. For the vast majority of the sites, themes and plugins come with their own .mo files with good and complete translations. There’s no need for WPML to filter (and make translatable) all these strings. If you want to override the translation of texts from a plugin, you can still do it. You’ll be able to choose which plugins you want and WPML will register the strings coming from it.

The second big change means that WPML does not call the database for the translation of any string. WPML compiles .mo files for your translations and lets WordPress load them. The size of these .mo files depends on the number of strings that you translate. On most servers, loading a file is significantly faster than loading multiple entries from the database (the DB is the performance bottleneck for many sites).

Generation of the .mo files

WPML String Translation handles the generation and maintenance of the .mo files automatically. This happens every time you translate a string on the WPML -> String Translation page.

However, after upgrading to this beta, you will need to generate the files for the first time.

If your site had any translated strings before the upgrade, you will see the following dialog on any admin page after updating String Translation:


.mo files generation dialog

You can regenerate the .mo if something goes wrong while testing the beta.

To do so:

  1. Go to WPML -> Support.
  2. Click the Troubleshooting link.
  3. Scroll towards the end of the page, and click Show custom MO Files Pre-generation dialog box.
  4. Reload the page (this step won’t be needed in the final release).
  5. The dialog which allows you to regenerate the .mo files will appear.

The Results

This version is already running on all our production websites (WPML.org, Toolset.com and ICanLocalize.com). It’s working smoothly and the servers are happy. String Translation was never a significant factor in our sites’ performance, so we’re using other sites for performance analysis.

We received dozens of sites form clients, where String Translation was a lot more significant. On all these sites, we confirm that the server load due to String Translation has practically dropped to zero. These sites now load at about half the time they loaded before (hurrah!).

Current Development Status

This beta is ready for your testing. The only caveat is that it’s not yet working on multisite installations. If you have a single-site (regular) WordPress install and you suspect that you have performance issues due to String Translation, try this beta. We’re going to let this beta run for several weeks and collect client feedback in the meanwhile. We’ll be completing the support for multisite while profiling more client sites.

If you’ve switched to this beta and are still getting significant performance issues related to WPML, we want to see your site. We may find other pockets of performance issues that we need to handle. We want to make sure that by the time this goes into production, nobody has any performance issues related to WPML. Our aim is to release WPML 4.3 for production at the first half of September.

Download and Try

Remember, this version doesn’t yet work on multisite installations!

It’s OK to use it on development sites and on production sites, but with some caution.

Automatic update

To get this beta, go to the Plugins -> Add New and click Commercial tab:

Commercial tab

From this page, enable the Beta channel and update the plugins automatically.

Visit our page about installing beta versions of WPML for more details.

To get the automatic updates or switch to the beta channel, you must register your site.

Manual update

You can also update manually.

To do so, follow the directions in Updating WPML manually (even if it refers to an old version of WPML, the process is exactly the same).

Feedback?

After you try this beta of WPML, we’d love to get your feedback. Please share all the information that you can with us. We want to know when this beta fixes performance issues and about any remaining performance problems that we need to handle.

Leave your comments and we’ll get back to you.

Update – 2019-08-16

We have released a new beta which fixes the following issues:

  1. Incompatibility with WooCommerce Multilingual: you can install either the current release or the beta of WooCommerce Multilingual included with this release.
  2. Bad performance when saving the post with a big number of custom fields.

Known issues so far

We are still working on polishings some parts. As of today, this is the list of known issues:

  1. Multisite is not supported yet.
  2. Deleting strings from String Translation does not update the generated .mo file.
  3. Deleting all the strings of a domain, will not delete the generated .mo file.
  4. After deleting all the strings of a domain, the .mo files regeneration (see «Generation of the .mo files» above to find how to regenerate the files) will not delete the corresponding .mo file.
  5. Translated admin texts returned original in icl_translate function (affecting WooCommerce Multilingual: «Custom subject of new order emails isn’t translated»).