WordPress 6.5 plans to incorporate high-performance translation into the core

After proving that loading translations had a significant impact on response times, the core performance team spent a lot of time this year studying the performance of the i18n/l10n system in WordPress. This led to in-depth performance analysis, followed by a dedicated high-performance translation feature plug-in that provided significant performance improvements for all zero-configuration WordPress websites. Thousands of websites have successfully tested the plug-in under various conditions. Now, the team believes the solution is ready to be incorporated into the core of WordPress.

Recommended reading: WordPress.org has launched a high-performance translation plug-in to solve performance problems caused by translation

what it can do

Performant Translations is supported by the new lightweight i18n library, which loads binary MO files faster and uses less memory. It even supports loading multiple locales simultaneously, which makes locales switching faster. In addition, it supports translations included in PHP files, avoids binary file formats and leverages OPCache (if available). If the MO translation file has a corresponding PHP file, the latter will be loaded, making it faster and using less memory. From the raw data, the optimization effect of this method is as follows:

language environment loading mode memory usage load time
en_US default 15MB 159 milliseconds
de_DE default 29MB 217 milliseconds
de_DE High-performance translation 17MB 166 milliseconds

These numbers were obtained by testing the Performance Translations plug-in against WordPress 6.5-alpha-57028 using the “Twenty Twenty-One” theme and some activity plug-ins. As you can see, memory usage and load time overhead have been minimized.

next step

The core performance team has opened #59656 to keep track of consolidating Performant Translations into the core of the next 6.5 release. Pull requests are now available and code review is currently underway. Once completed, it will be ready to be merged into the backbone, and the library will be able to be tested more extensively.

There is also a Meta patch that can serve PHP files as part of the language pack provided by translate.wordpress.org, which is based on GlotPress PR. Both now require code review. Although these two changes release the full functionality of Performance Translations, they are not obstacles to core mergers and may even be implemented later.

Even after the core merger, the Performant Translations plug-in will continue to be maintained to build on top of the core solution with unique additional capabilities. As is the case today, if no PHP file currently exists, the plug-in will automatically convert any MO file to a PHP file. This is very useful for translating websites that do not come from translate.wordpress.org or exist only locally on the server.

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注