Saltar navegación
26

We’re ready with a beta for WPML 3.5. This release includes major improvements to String Translation, both in functionality and in performance.

Almost every site that uses WPML uses String Translation. So, you can imagine that making WPML’s String Translation better is very high on our priorities. This release of WPML is almost exclusively devoted to improving String Translation.

Faster and Leaner String Translation

In order to translate strings, WPML needs to load the translation from the database. We’ve experimented with different loading techniques and it looks like the approach in WPML 3.5 is the definite winner.

In previous releases we tried to:

  • Only translations, exactly when they’re needed
  • Pre-load all strings by context
  • Pre-load all the strings from the database

Each of these approaches had its cons and pros. The problem was, for each site that benefited from one of these approaches, another site suffered.

WPML 3.5 uses a new approach to preloading string translations. It keeps an additional table, telling WPML which strings are needed for each page. Then, it preloads exactly the strings needed for that page, no matter which context they belong to. The obvious advantage to this is fewer strings preloaded and no strings need to be loaded while the page renders. As a result, both memory consumption and CPU utilization are way down. The downside of this new approach is tiny new PHP code that keeps track of which string is used where. That additional code runs very fast, due to dedicated DB access and caching that we developed for it.

The performance gain that you should expect depends on different factors:

  • The number of strings in your site – the more strings you have, the greater the benefit (relatively, fewer strings pre-loaded now).
  • The server’s PHP version – PHP 7 is way more efficient than PHP 5.6. If you’re still on PHP 5.x, you’ll get a much more significant performance boost, but you’ll feel it on PHP 7 too.
  • The number of other plugins that you’re running, the amount of content, theme, etc. – obviously, if your site has other slow code, the improvement to String Translation is not going to be that significant.

For our own WPML.org Website, we get the following performance improvements:

PHP version Page Memory consumption saving CPU utilization saving
PHP 5.6 Home 60% 41%
Admin dashboard 41% 33%
PHP 7 Home 50% 16%
Admin dashboard 33% 15%

Translation for Links in Strings

The other major improvement in WPML 3.5 is the ability to translate links in strings (automatically). Why does this mean and why do you need it?

We use ‘strings’ for many different things. For example, if your theme stores the ‘lead’ text of your homepage in an ‘option’, WPML will use String Translation for it. Until now, you would need to keep track of strings that have URLs and adjust them to translated content manually. If many strings have links, this could be a very tiring task.

Now, WPML handles links in String Translation, the same as it handles links in ‘posts’ (posts, pages and custom types). When you translate any string that has any link, that link would automatically adjust to point to the translated content. I’ll write a separate blog post that shows how this works with our Toolset Layouts plugin.

Update Aug/2

Hey, we found another source of very significant time waste on the admin. This one is trivial and should have been handled a while back. There’s a «WPML widget» on the WordPress admin, which probably nobody needs anymore. That widget pulls content from many places in the DB, as well as recent blog posts from wpml.org Website. Removing this will eliminate a number of DB calls, as well as potentially slow external calls.

We’re taking care of that widget (removing it) and reviewing all external calls, to make sure they don’t slow down your site.

Download and Try

WPML 3.5 is going into QA now. We’ve already fully tested the change to String Translation, but there’s a lot more to test before we can release it as a production version.

We’d love to get your feedback about this new upcoming version. If your site has performance issues, related to String Translation, this version is for you.

Please remember that this is a beta version, so only try it on development sites (not on production sites).

This beta is only available to «Multilingual CMS» account holders, as it mainly revolves around improvements to String Translation.

Log in to your WPML account and click on Downloads. Scroll to the bottom and download the CMS Beta Package. Unzip and upload all the WPML components that you’re using to WordPress.

Feedback?

Let us know how this version is working for you by leaving comments here. If you’re running into a problem, start a new thread in WPML support forum AND leave a comment here with a brief description and a link to that thread.

We’re looking forward to your feedback, questions, ideas and suggestions!