Internationalization improvements in 6.8

Various internationalization (i18n) improvements are in WordPress 6.8, and this developers note focuses on these.

Localized PHPMailer messages

Over 12 years after #23311 was reported, WordPress 6.8 now properly localizes any user-visible PHPMailer error messages. To achieve this, a new WP_PHPMailer class extending PHPMailer was introduced to leverage the WordPress i18ni18n Internationalization, or the act of writing and preparing code to be fully translatable into other languages. Also see localization. Often written with a lowercase i so it is not confused with a lowercase L or the numeral 1. Often an acquired skill. system with PHPMailer. Note that developers don’t typically interact with this class directly outside of wp_mail() or the phpmailer_init action.

See [59592] for more context.

PluginPlugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party update emails in the adminadmin (and super admin)’s localeLocale A locale is a combination of language and regional dialect. Usually locales correspond to countries, as is the case with Portuguese (Portugal) and Portuguese (Brazil). Other examples of locales include Canadian English and U.S. English.

This was reported and fixed in #62496. It’s a follow-up to the email localization change introduced in WordPress 6.7, where this instance was missed. Now, plugin update emails are correctly sent in the admin locale (if the admin email matches a user on the site).

See [59460] and [59478] for details.

Just-in-time translationtranslation The process (or result) of changing text, words, and display formatting to support another language. Also see localization, internationalization. loading for plugins/themes not in the WordPress.orgWordPress.org The community site where WordPress code is created and shared by the users. This is where you can download the source code for WordPress core, plugins and themes as well as the central location for community conversations and organization. https://wordpress.org/ directory

Back in version 4.6, WordPress introduced just-in-time translation loading for any plugin or theme that is hosted on WordPress.org. That meant plugins no longer had to call load_plugin_textdomain() or load_theme_textdomain().

With WordPress 6.8, this is now expanded to all other plugins and themes by looking at the text domain information provided by the plugin/theme. Extensions with a custom Text Domain and Domain Path headerHeader The header of your site is typically the first thing people will experience. The masthead or header art located across the top of your page is part of the look and feel of your website. It can influence a visitor’s opinion about your content and you/ your organization’s brand. It may also look different on different screen sizes. no longer need to call load_plugin_textdomain() or load_theme_textdomain(). This reduces the risk of calling them too late, after some translation calls already happened, and generally makes it easier to properly internationalize a plugin or theme.

In short:

  • If your plugin/theme is hosted on WordPress.org and requires WordPress 4.6 or higher: you don’t need to use load_*_textdomain()
  • Else, if your plugin/theme provides the Text Domain and Domain Path headers and requires WordPress 6.8 or higher: you don’t need to use load_*_textdomain()

See #62244 for more.


Props to @audrasjb, @stevenlinx for review.

#6-8, #dev-notes, #dev-notes-6-8, #i18n