Skip to main content
Last Reviewed: April 02, 2024

Performant Translations on Pantheon

How to manage and generate performant translations on WordPress sites hosted on Pantheon.


This section provides information on how to use performant translation files in WordPress on Pantheon.

What are "Performant Translations"?

WordPress 6.5 introduces the concept of Performant Translations into the core CMS. This new feature introduces a .l10n.php translation file format that has been shown to load binary .mo files far faster than the previous language handling in WordPress core, supports loading multiple locales at the same time and makes locale switching faster. Since the files are PHP, they can be cached by OPcache, which can provide additional performance improvements.

Generating PHP Translation Files

When you update your language files (e.g. via terminus wp -- <site>.<env> i18n update), you should receive the normal .mo and .po files as well as the new .l10n.php files if they are available. However, it's possible the language files have not been recently updated and you lack the .l10n.php files. In this case, you can generate the .l10n.php files manually from the .po and .mo files on your environment.

WP-CLI 2.10.0 introduced a new make-php command. On Pantheon, you can use this command via Terminus to generate the .l10n.php files for your site. Note: you will need to switch your environment to SFTP mode to use this command.

terminus connection:set <site>.<env> sftp
terminus wp -- <site>.<env> i18n make-php wp-content/languages
terminus env:commit <site>.<env> --message="Generate .l10n.php files"

The example above does three things: 1) sets the environment to SFTP mode, 2) generates the .l10n.php files, and 3) commits the changes to the environment. You can then switch back to Git mode if you prefer.

Considerations