<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[53874] trunk: I18N: Introduce `WP_Textdomain_Registry` to store text domains and their language directory paths.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/53874">53874</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/53874","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>swissspidy</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2022-08-11 12:37:05 +0000 (Thu, 11 Aug 2022)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>I18N: Introduce `WP_Textdomain_Registry` to store text domains and their language directory paths.
Previously, when using `switch_to_locale()` all current loaded text domains were unloaded and added to the `$l10n_unloaded` global. This prevented the just-in-time loading for text domains after a switch. The just-in-time loading was also only possible if the translations were stored in `WP_LANG_DIR`. Both issues have been fixed.
* Adds `WP_Textdomain_Registry` to keep track of the language directory paths for all plugins and themes.
* Updates all `load_*_textdomain()` functions to store the path in `WP_Textdomain_Registry`.
* Adds `$locale` parameter to `load_textdomain()` to specify the locale the translation file is for.
* Adds `$reloadable` parameter to `unload_textdomain()` to define whether a text domain can be loaded just-in-time again. This is used by `WP_Locale_Switcher::load_translations()`.
* Extends `_load_textdomain_just_in_time()` to also support text domains of plugins and themes with custom language directories.
* Fixes the incorrect `test_plugin_translation_after_switching_locale_twice()` test which should have caught this issue earlier.
* Adds a new test plugin and theme to test the loading of translations with a custom language directory.
* Deprecates the now unused and private `_get_path_to_translation()` and `_get_path_to_translation_from_lang_dir()` functions.
Previously added in <a href="https://core.trac.wordpress.org/changeset/49236">[49236]</a> and reverted in <a href="https://core.trac.wordpress.org/changeset/49236">[49236]</a> to investigate concerns which are now addressed here.
Props yoavf, swissspidy, dd32, ocean90.
See <a href="https://core.trac.wordpress.org/ticket/26511">#26511</a>.
Fixes <a href="https://core.trac.wordpress.org/ticket/39210">#39210</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesclasswplocaleswitcherphp">trunk/src/wp-includes/class-wp-locale-switcher.php</a></li>
<li><a href="#trunksrcwpincludesdeprecatedphp">trunk/src/wp-includes/deprecated.php</a></li>
<li><a href="#trunksrcwpincludesl10nphp">trunk/src/wp-includes/l10n.php</a></li>
<li><a href="#trunksrcwpsettingsphp">trunk/src/wp-settings.php</a></li>
<li><a href="#trunktestsphpunitdatalanguagespluginsinternationalizedpluginde_DEmo">trunk/tests/phpunit/data/languages/plugins/internationalized-plugin-de_DE.mo</a></li>
<li><a href="#trunktestsphpunitdatalanguagespluginsinternationalizedpluginde_DEpo">trunk/tests/phpunit/data/languages/plugins/internationalized-plugin-de_DE.po</a></li>
<li><a href="#trunktestsphpunitdatalanguagesthemesinternationalizedthemede_DEmo">trunk/tests/phpunit/data/languages/themes/internationalized-theme-de_DE.mo</a></li>
<li><a href="#trunktestsphpunitdatalanguagesthemesinternationalizedthemede_DEpo">trunk/tests/phpunit/data/languages/themes/internationalized-theme-de_DE.po</a></li>
<li><a href="#trunktestsphpunitdatapluginshellophp">trunk/tests/phpunit/data/plugins/hello.php</a></li>
<li><a href="#trunktestsphpunitincludesbootstrapphp">trunk/tests/phpunit/includes/bootstrap.php</a></li>
<li><a href="#trunktestsphpunittestsadminincludesPluginphp">trunk/tests/phpunit/tests/admin/includesPlugin.php</a></li>
<li><a href="#trunktestsphpunittestsl10nloadTextdomainphp">trunk/tests/phpunit/tests/l10n/loadTextdomain.php</a></li>
<li><a href="#trunktestsphpunittestsl10nloadTextdomainJustInTimephp">trunk/tests/phpunit/tests/l10n/loadTextdomainJustInTime.php</a></li>
<li><a href="#trunktestsphpunittestsl10nwpLocaleSwitcherphp">trunk/tests/phpunit/tests/l10n/wpLocaleSwitcher.php</a></li>
<li><a href="#trunktestsphpunitteststhemethemeDirphp">trunk/tests/phpunit/tests/theme/themeDir.php</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesclasswptextdomainregistryphp">trunk/src/wp-includes/class-wp-textdomain-registry.php</a></li>
<li><a href="#trunktestsphpunitdatalanguagespluginsinternationalizedplugines_ESmo">trunk/tests/phpunit/data/languages/plugins/internationalized-plugin-es_ES.mo</a></li>
<li><a href="#trunktestsphpunitdatalanguagespluginsinternationalizedplugines_ESpo">trunk/tests/phpunit/data/languages/plugins/internationalized-plugin-es_ES.po</a></li>
<li>trunk/tests/phpunit/data/plugins/custom-internationalized-plugin/</li>
<li><a href="#trunktestsphpunitdatapluginscustominternationalizedplugincustominternationalizedpluginphp">trunk/tests/phpunit/data/plugins/custom-internationalized-plugin/custom-internationalized-plugin.php</a></li>
<li>trunk/tests/phpunit/data/plugins/custom-internationalized-plugin/languages/</li>
<li><a href="#trunktestsphpunitdatapluginscustominternationalizedpluginlanguagescustominternationalizedpluginde_DEmo">trunk/tests/phpunit/data/plugins/custom-internationalized-plugin/languages/custom-internationalized-plugin-de_DE.mo</a></li>
<li><a href="#trunktestsphpunitdatapluginscustominternationalizedpluginlanguagescustominternationalizedpluginde_DEpo">trunk/tests/phpunit/data/plugins/custom-internationalized-plugin/languages/custom-internationalized-plugin-de_DE.po</a></li>
<li><a href="#trunktestsphpunitdatapluginscustominternationalizedpluginlanguagescustominternationalizedplugines_ESmo">trunk/tests/phpunit/data/plugins/custom-internationalized-plugin/languages/custom-internationalized-plugin-es_ES.mo</a></li>
<li><a href="#trunktestsphpunitdatapluginscustominternationalizedpluginlanguagescustominternationalizedplugines_ESpo">trunk/tests/phpunit/data/plugins/custom-internationalized-plugin/languages/custom-internationalized-plugin-es_ES.po</a></li>
<li>trunk/tests/phpunit/data/themedir1/custom-internationalized-theme/</li>
<li><a href="#trunktestsphpunitdatathemedir1custominternationalizedthemefunctionsphp">trunk/tests/phpunit/data/themedir1/custom-internationalized-theme/functions.php</a></li>
<li><a href="#trunktestsphpunitdatathemedir1custominternationalizedthemeindexphp">trunk/tests/phpunit/data/themedir1/custom-internationalized-theme/index.php</a></li>
<li>trunk/tests/phpunit/data/themedir1/custom-internationalized-theme/languages/</li>
<li><a href="#trunktestsphpunitdatathemedir1custominternationalizedthemelanguagesde_DEmo">trunk/tests/phpunit/data/themedir1/custom-internationalized-theme/languages/de_DE.mo</a></li>
<li><a href="#trunktestsphpunitdatathemedir1custominternationalizedthemelanguagesde_DEpo">trunk/tests/phpunit/data/themedir1/custom-internationalized-theme/languages/de_DE.po</a></li>
<li><a href="#trunktestsphpunitdatathemedir1custominternationalizedthemelanguageses_ESmo">trunk/tests/phpunit/data/themedir1/custom-internationalized-theme/languages/es_ES.mo</a></li>
<li><a href="#trunktestsphpunitdatathemedir1custominternationalizedthemelanguageses_ESpo">trunk/tests/phpunit/data/themedir1/custom-internationalized-theme/languages/es_ES.po</a></li>
<li><a href="#trunktestsphpunitdatathemedir1custominternationalizedthemestylecss">trunk/tests/phpunit/data/themedir1/custom-internationalized-theme/style.css</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesclasswplocaleswitcherphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/class-wp-locale-switcher.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/class-wp-locale-switcher.php 2022-08-10 13:52:42 UTC (rev 53873)
+++ trunk/src/wp-includes/class-wp-locale-switcher.php 2022-08-11 12:37:05 UTC (rev 53874)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -196,11 +196,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> load_default_textdomain( $locale );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $domains as $domain ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // The default text domain is handled by `load_default_textdomain()`.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( 'default' === $domain ) {
</span><span class="cx" style="display: block; padding: 0 10px"> continue;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- unload_textdomain( $domain );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Unload current text domain but allow them to be reloaded
+ // after switching back or to another locale.
+ unload_textdomain( $domain, true );
</ins><span class="cx" style="display: block; padding: 0 10px"> get_translations_for_domain( $domain );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -218,12 +221,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $locale The locale to change to.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> private function change_locale( $locale ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Reset translation availability information.
- _get_path_to_translation( null, true );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ global $wp_locale;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $this->load_translations( $locale );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $GLOBALS['wp_locale'] = new WP_Locale();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $wp_locale = new WP_Locale();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Fires when the locale is switched to or restored.
</span></span></pre></div>
<a id="trunksrcwpincludesclasswptextdomainregistryphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/src/wp-includes/class-wp-textdomain-registry.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/class-wp-textdomain-registry.php (rev 0)
+++ trunk/src/wp-includes/class-wp-textdomain-registry.php 2022-08-11 12:37:05 UTC (rev 53874)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,184 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * Locale API: WP_Textdomain_Registry class
+ *
+ * @package WordPress
+ * @subpackage i18n
+ * @since 6.1.0
+ */
+
+/**
+ * Core class used for registering text domains.
+ *
+ * @since 6.1.0
+ */
+class WP_Textdomain_Registry {
+ /**
+ * List of domains and all their language directory paths for each locale.
+ *
+ * @since 6.1.0
+ *
+ * @var array
+ */
+ protected $all = array();
+
+ /**
+ * List of domains and their language directory path for the current (most recent) locale.
+ *
+ * @since 6.1.0
+ *
+ * @var array
+ */
+ protected $current = array();
+
+ /**
+ * Holds a cached list of available .mo files to improve performance.
+ *
+ * @since 6.1.0
+ *
+ * @var array
+ */
+ protected $cached_mo_files;
+
+ /**
+ * Returns the MO file path for a specific domain and locale.
+ *
+ * @since 6.1.0
+ *
+ * @param string $domain Text domain.
+ * @param string $locale Locale.
+ *
+ * @return string|false MO file path or false if there is none available.
+ */
+ public function get( $domain, $locale ) {
+ if ( isset( $this->all[ $domain ][ $locale ] ) ) {
+ return $this->all[ $domain ][ $locale ];
+ }
+
+ return $this->get_path_from_lang_dir( $domain, $locale );
+ }
+
+ /**
+ * Determines whether any MO file paths are available for the domain.
+ *
+ * @since 6.1.0
+ *
+ * @param string $domain Text domain.
+ * @return bool Whether any MO file paths are available for the domain.
+ */
+ public function has( $domain ) {
+ return ! empty( $this->all[ $domain ] );
+ }
+
+ /**
+ * Returns the current (most recent) MO file path for a specific domain.
+ *
+ * @since 6.1.0
+ *
+ * @param string $domain Text domain.
+ * @return string|false Current MO file path or false if there is none available.
+ */
+ public function get_current( $domain ) {
+ if ( isset( $this->current[ $domain ] ) ) {
+ return $this->current[ $domain ];
+ }
+
+ return false;
+ }
+
+ /**
+ * Sets the MO file path for a specific domain and locale.
+ *
+ * Also sets the 'current' property for direct access
+ * to the path for the current (most recent) locale.
+ *
+ * @since 6.1.0
+ *
+ * @param string $domain Text domain.
+ * @param string $locale Locale.
+ * @param string|false $path Language directory path or false if there is none available.
+ */
+ public function set( $domain, $locale, $path ) {
+ $this->all[ $domain ][ $locale ] = $path ? trailingslashit( $path ) : false;
+ $this->current[ $domain ] = $this->all[ $domain ][ $locale ];
+ }
+
+ /**
+ * Resets the registry state.
+ *
+ * @since 6.1.0
+ */
+ public function reset() {
+ $this->cached_mo_files = null;
+ $this->all = array();
+ $this->current = array();
+ }
+
+ /**
+ * Gets the path to a translation file in the languages directory for the current locale.
+ *
+ * @since 6.1.0
+ *
+ * @param string $domain Text domain.
+ * @param string $locale Locale.
+ * @return string|false MO file path or false if there is none available.
+ */
+ private function get_path_from_lang_dir( $domain, $locale ) {
+ if ( null === $this->cached_mo_files ) {
+ $this->set_cached_mo_files();
+ }
+
+ $mofile = "{$domain}-{$locale}.mo";
+
+ $path = WP_LANG_DIR . '/plugins/' . $mofile;
+
+ if ( in_array( $path, $this->cached_mo_files, true ) ) {
+ $path = WP_LANG_DIR . '/plugins/';
+ $this->set( $domain, $locale, $path );
+
+ return $path;
+ }
+
+ $path = WP_LANG_DIR . '/themes/' . $mofile;
+ if ( in_array( $path, $this->cached_mo_files, true ) ) {
+ $path = WP_LANG_DIR . '/themes/';
+ $this->set( $domain, $locale, $path );
+
+ return $path;
+ }
+
+ // If no path is found for the given locale, check if an entry for the default
+ // en_US locale exists. This is the case when e.g. using load_plugin_textdomain
+ // with a custom path.
+ if ( 'en_US' !== $locale && isset( $this->all[ $domain ]['en_US'] ) ) {
+ $this->set( $domain, $locale, $this->all[ $domain ]['en_US'] );
+ return $this->all[ $domain ]['en_US'];
+ }
+
+ $this->set( $domain, $locale, false );
+
+ return false;
+ }
+
+ /**
+ * Reads and caches all available MO files from the plugins and themes language directories.
+ *
+ * @since 6.1.0
+ */
+ protected function set_cached_mo_files() {
+ $this->cached_mo_files = array();
+
+ $locations = array(
+ WP_LANG_DIR . '/plugins',
+ WP_LANG_DIR . '/themes',
+ );
+
+ foreach ( $locations as $location ) {
+ $mo_files = glob( $location . '/*.mo' );
+
+ if ( $mo_files ) {
+ $this->cached_mo_files = array_merge( $this->cached_mo_files, $mo_files );
+ }
+ }
+ }
+}
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/src/wp-includes/class-wp-textdomain-registry.php
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunksrcwpincludesdeprecatedphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/deprecated.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/deprecated.php 2022-08-10 13:52:42 UTC (rev 53873)
+++ trunk/src/wp-includes/deprecated.php 2022-08-11 12:37:05 UTC (rev 53874)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4360,3 +4360,85 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+/**
+ * Gets the path to a translation file for loading a textdomain just in time.
+ *
+ * Caches the retrieved results internally.
+ *
+ * @since 4.7.0
+ * @deprecated 6.1.0
+ * @access private
+ *
+ * @see _load_textdomain_just_in_time()
+ *
+ * @param string $domain Text domain. Unique identifier for retrieving translated strings.
+ * @param bool $reset Whether to reset the internal cache. Used by the switch to locale functionality.
+ * @return string|false The path to the translation file or false if no translation file was found.
+ */
+function _get_path_to_translation( $domain, $reset = false ) {
+ _deprecated_function( __FUNCTION__, '6.1.0', 'WP_Textdomain_Registry' );
+
+ static $available_translations = array();
+
+ if ( true === $reset ) {
+ $available_translations = array();
+ }
+
+ if ( ! isset( $available_translations[ $domain ] ) ) {
+ $available_translations[ $domain ] = _get_path_to_translation_from_lang_dir( $domain );
+ }
+
+ return $available_translations[ $domain ];
+}
+
+/**
+ * Gets the path to a translation file in the languages directory for the current locale.
+ *
+ * Holds a cached list of available .mo files to improve performance.
+ *
+ * @since 4.7.0
+ * @deprecated 6.1.0
+ * @access private
+ *
+ * @see _get_path_to_translation()
+ *
+ * @param string $domain Text domain. Unique identifier for retrieving translated strings.
+ * @return string|false The path to the translation file or false if no translation file was found.
+ */
+function _get_path_to_translation_from_lang_dir( $domain ) {
+ _deprecated_function( __FUNCTION__, '6.1.0', 'WP_Textdomain_Registry' );
+
+ static $cached_mofiles = null;
+
+ if ( null === $cached_mofiles ) {
+ $cached_mofiles = array();
+
+ $locations = array(
+ WP_LANG_DIR . '/plugins',
+ WP_LANG_DIR . '/themes',
+ );
+
+ foreach ( $locations as $location ) {
+ $mofiles = glob( $location . '/*.mo' );
+ if ( $mofiles ) {
+ $cached_mofiles = array_merge( $cached_mofiles, $mofiles );
+ }
+ }
+ }
+
+ $locale = determine_locale();
+ $mofile = "{$domain}-{$locale}.mo";
+
+ $path = WP_LANG_DIR . '/plugins/' . $mofile;
+ if ( in_array( $path, $cached_mofiles, true ) ) {
+ return $path;
+ }
+
+ $path = WP_LANG_DIR . '/themes/' . $mofile;
+ if ( in_array( $path, $cached_mofiles, true ) ) {
+ return $path;
+ }
+
+ return false;
+}
</ins></span></pre></div>
<a id="trunksrcwpincludesl10nphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/l10n.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/l10n.php 2022-08-10 13:52:42 UTC (rev 53873)
+++ trunk/src/wp-includes/l10n.php 2022-08-11 12:37:05 UTC (rev 53874)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -704,16 +704,20 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * and will be a MO object.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 1.5.0
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @since 6.1.0 Added the `$locale` parameter.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @global MO[] $l10n An array of all currently loaded text domains.
- * @global MO[] $l10n_unloaded An array of all text domains that have been unloaded again.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @global MO[] $l10n An array of all currently loaded text domains.
+ * @global MO[] $l10n_unloaded An array of all text domains that have been unloaded again.
+ * @global WP_Textdomain_Registry $wp_textdomain_registry WordPress Textdomain Registry.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $domain Text domain. Unique identifier for retrieving translated strings.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $mofile Path to the .mo file.
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $locale Optional. Locale. Default is the current locale.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return bool True on success, false on failure.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function load_textdomain( $domain, $mofile ) {
- global $l10n, $l10n_unloaded;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function load_textdomain( $domain, $mofile, $locale = null ) {
+ /** @var WP_Textdomain_Registry $wp_textdomain_registry */
+ global $l10n, $l10n_unloaded, $wp_textdomain_registry;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $l10n_unloaded = (array) $l10n_unloaded;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -758,8 +762,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! $locale ) {
+ $locale = determine_locale();
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $mo = new MO();
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! $mo->import_from_file( $mofile ) ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $wp_textdomain_registry->set( $domain, $locale, false );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -771,6 +781,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $l10n[ $domain ] = &$mo;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $wp_textdomain_registry->set( $domain, $locale, dirname( $mofile ) );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> return true;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -778,14 +790,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Unloads translations for a text domain.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.0.0
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @since 6.1.0 Added the `$reloadable` parameter.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @global MO[] $l10n An array of all currently loaded text domains.
</span><span class="cx" style="display: block; padding: 0 10px"> * @global MO[] $l10n_unloaded An array of all text domains that have been unloaded again.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $domain Text domain. Unique identifier for retrieving translated strings.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $domain Text domain. Unique identifier for retrieving translated strings.
+ * @param bool $reloadable Whether the text domain can be loaded just-in-time again.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return bool Whether textdomain was unloaded.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-function unload_textdomain( $domain ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function unload_textdomain( $domain, $reloadable = false ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> global $l10n, $l10n_unloaded;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $l10n_unloaded = (array) $l10n_unloaded;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -794,14 +808,18 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Filters whether to override the text domain unloading.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.0.0
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @since 6.1.0 Added the `$reloadable` parameter.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param bool $override Whether to override the text domain unloading. Default false.
- * @param string $domain Text domain. Unique identifier for retrieving translated strings.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param bool $override Whether to override the text domain unloading. Default false.
+ * @param string $domain Text domain. Unique identifier for retrieving translated strings.
+ * @param bool $reloadable Whether the text domain can be loaded just-in-time again.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $plugin_override = apply_filters( 'override_unload_textdomain', false, $domain );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $plugin_override = apply_filters( 'override_unload_textdomain', false, $domain, $reloadable );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $plugin_override ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $l10n_unloaded[ $domain ] = true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! $reloadable ) {
+ $l10n_unloaded[ $domain ] = true;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return true;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -810,15 +828,19 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Fires before the text domain is unloaded.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.0.0
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @since 6.1.0 Added the `$reloadable` parameter.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $domain Text domain. Unique identifier for retrieving translated strings.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $domain Text domain. Unique identifier for retrieving translated strings.
+ * @param bool $reloadable Whether the text domain can be loaded just-in-time again.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- do_action( 'unload_textdomain', $domain );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ do_action( 'unload_textdomain', $domain, $reloadable );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $l10n[ $domain ] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> unset( $l10n[ $domain ] );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $l10n_unloaded[ $domain ] = true;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! $reloadable ) {
+ $l10n_unloaded[ $domain ] = true;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return true;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -847,19 +869,19 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Unload previously loaded strings so we can switch translations.
</span><span class="cx" style="display: block; padding: 0 10px"> unload_textdomain( 'default' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $return = load_textdomain( 'default', WP_LANG_DIR . "/$locale.mo" );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $return = load_textdomain( 'default', WP_LANG_DIR . "/$locale.mo", $locale );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ( is_multisite() || ( defined( 'WP_INSTALLING_NETWORK' ) && WP_INSTALLING_NETWORK ) ) && ! file_exists( WP_LANG_DIR . "/admin-$locale.mo" ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- load_textdomain( 'default', WP_LANG_DIR . "/ms-$locale.mo" );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ load_textdomain( 'default', WP_LANG_DIR . "/ms-$locale.mo", $locale );
</ins><span class="cx" style="display: block; padding: 0 10px"> return $return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( is_admin() || wp_installing() || ( defined( 'WP_REPAIRING' ) && WP_REPAIRING ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- load_textdomain( 'default', WP_LANG_DIR . "/admin-$locale.mo" );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ load_textdomain( 'default', WP_LANG_DIR . "/admin-$locale.mo", $locale );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( is_network_admin() || ( defined( 'WP_INSTALLING_NETWORK' ) && WP_INSTALLING_NETWORK ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- load_textdomain( 'default', WP_LANG_DIR . "/admin-network-$locale.mo" );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ load_textdomain( 'default', WP_LANG_DIR . "/admin-network-$locale.mo", $locale );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return $return;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -883,6 +905,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @return bool True when textdomain is successfully loaded, false otherwise.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function load_plugin_textdomain( $domain, $deprecated = false, $plugin_rel_path = false ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /** @var WP_Textdomain_Registry $wp_textdomain_registry */
+ global $wp_textdomain_registry;
+
</ins><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Filters a plugin's locale.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -896,7 +921,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $mofile = $domain . '-' . $locale . '.mo';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Try to load from the languages directory first.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( load_textdomain( $domain, WP_LANG_DIR . '/plugins/' . $mofile ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( load_textdomain( $domain, WP_LANG_DIR . '/plugins/' . $mofile, $locale ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return true;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -909,7 +934,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $path = WP_PLUGIN_DIR;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return load_textdomain( $domain, $path . '/' . $mofile );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $wp_textdomain_registry->set( $domain, $locale, $path );
+
+ return load_textdomain( $domain, $path . '/' . $mofile, $locale );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -918,6 +945,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.0.0
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.6.0 The function now tries to load the .mo file from the languages directory first.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @global WP_Textdomain_Registry $wp_textdomain_registry WordPress Textdomain Registry.
+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param string $domain Text domain. Unique identifier for retrieving translated strings.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $mu_plugin_rel_path Optional. Relative to `WPMU_PLUGIN_DIR` directory in which the .mo
</span><span class="cx" style="display: block; padding: 0 10px"> * file resides. Default empty string.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -924,6 +953,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @return bool True when textdomain is successfully loaded, false otherwise.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function load_muplugin_textdomain( $domain, $mu_plugin_rel_path = '' ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /** @var WP_Textdomain_Registry $wp_textdomain_registry */
+ global $wp_textdomain_registry;
+
</ins><span class="cx" style="display: block; padding: 0 10px"> /** This filter is documented in wp-includes/l10n.php */
</span><span class="cx" style="display: block; padding: 0 10px"> $locale = apply_filters( 'plugin_locale', determine_locale(), $domain );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -930,13 +962,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $mofile = $domain . '-' . $locale . '.mo';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Try to load from the languages directory first.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( load_textdomain( $domain, WP_LANG_DIR . '/plugins/' . $mofile ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( load_textdomain( $domain, WP_LANG_DIR . '/plugins/' . $mofile, $locale ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return true;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $path = WPMU_PLUGIN_DIR . '/' . ltrim( $mu_plugin_rel_path, '/' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return load_textdomain( $domain, $path . '/' . $mofile );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $wp_textdomain_registry->set( $domain, $locale, $path );
+
+ return load_textdomain( $domain, $path . '/' . $mofile, $locale );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -950,6 +984,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 1.5.0
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.6.0 The function now tries to load the .mo file from the languages directory first.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @global WP_Textdomain_Registry $wp_textdomain_registry WordPress Textdomain Registry.
+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param string $domain Text domain. Unique identifier for retrieving translated strings.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string|false $path Optional. Path to the directory containing the .mo file.
</span><span class="cx" style="display: block; padding: 0 10px"> * Default false.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -956,6 +992,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @return bool True when textdomain is successfully loaded, false otherwise.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function load_theme_textdomain( $domain, $path = false ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /** @var WP_Textdomain_Registry $wp_textdomain_registry */
+ global $wp_textdomain_registry;
+
</ins><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Filters a theme's locale.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -969,7 +1008,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $mofile = $domain . '-' . $locale . '.mo';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Try to load from the languages directory first.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( load_textdomain( $domain, WP_LANG_DIR . '/themes/' . $mofile ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( load_textdomain( $domain, WP_LANG_DIR . '/themes/' . $mofile, $locale ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return true;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -977,7 +1016,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $path = get_template_directory();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return load_textdomain( $domain, $path . '/' . $locale . '.mo' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $wp_textdomain_registry->set( $domain, $locale, $path );
+
+ return load_textdomain( $domain, $path . '/' . $locale . '.mo', $locale );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1198,7 +1239,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Loads plugin and theme textdomains just-in-time.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Loads plugin and theme text domains just-in-time.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * When a textdomain is encountered for the first time, we try to load
</span><span class="cx" style="display: block; padding: 0 10px"> * the translation file from `wp-content/languages`, removing the need
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1207,14 +1248,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 4.6.0
</span><span class="cx" style="display: block; padding: 0 10px"> * @access private
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @see get_translations_for_domain()
- * @global MO[] $l10n_unloaded An array of all text domains that have been unloaded again.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @global MO[] $l10n_unloaded An array of all text domains that have been unloaded again.
+ * @global WP_Textdomain_Registry $wp_textdomain_registry WordPress Textdomain Registry.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $domain Text domain. Unique identifier for retrieving translated strings.
</span><span class="cx" style="display: block; padding: 0 10px"> * @return bool True when the textdomain is successfully loaded, false otherwise.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function _load_textdomain_just_in_time( $domain ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- global $l10n_unloaded;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /** @var WP_Textdomain_Registry $wp_textdomain_registry */
+ global $l10n_unloaded, $wp_textdomain_registry;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $l10n_unloaded = (array) $l10n_unloaded;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1223,88 +1265,25 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $translation_path = _get_path_to_translation( $domain );
- if ( false === $translation_path ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $wp_textdomain_registry->has( $domain ) && ! $wp_textdomain_registry->get_current( $domain ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return load_textdomain( $domain, $translation_path );
-}
-
-/**
- * Gets the path to a translation file for loading a textdomain just in time.
- *
- * Caches the retrieved results internally.
- *
- * @since 4.7.0
- * @access private
- *
- * @see _load_textdomain_just_in_time()
- *
- * @param string $domain Text domain. Unique identifier for retrieving translated strings.
- * @param bool $reset Whether to reset the internal cache. Used by the switch to locale functionality.
- * @return string|false The path to the translation file or false if no translation file was found.
- */
-function _get_path_to_translation( $domain, $reset = false ) {
- static $available_translations = array();
-
- if ( true === $reset ) {
- $available_translations = array();
- }
-
- if ( ! isset( $available_translations[ $domain ] ) ) {
- $available_translations[ $domain ] = _get_path_to_translation_from_lang_dir( $domain );
- }
-
- return $available_translations[ $domain ];
-}
-
-/**
- * Gets the path to a translation file in the languages directory for the current locale.
- *
- * Holds a cached list of available .mo files to improve performance.
- *
- * @since 4.7.0
- * @access private
- *
- * @see _get_path_to_translation()
- *
- * @param string $domain Text domain. Unique identifier for retrieving translated strings.
- * @return string|false The path to the translation file or false if no translation file was found.
- */
-function _get_path_to_translation_from_lang_dir( $domain ) {
- static $cached_mofiles = null;
-
- if ( null === $cached_mofiles ) {
- $cached_mofiles = array();
-
- $locations = array(
- WP_LANG_DIR . '/plugins',
- WP_LANG_DIR . '/themes',
- );
-
- foreach ( $locations as $location ) {
- $mofiles = glob( $location . '/*.mo' );
- if ( $mofiles ) {
- $cached_mofiles = array_merge( $cached_mofiles, $mofiles );
- }
- }
- }
-
</del><span class="cx" style="display: block; padding: 0 10px"> $locale = determine_locale();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $mofile = "{$domain}-{$locale}.mo";
-
- $path = WP_LANG_DIR . '/plugins/' . $mofile;
- if ( in_array( $path, $cached_mofiles, true ) ) {
- return $path;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $path = $wp_textdomain_registry->get( $domain, $locale );
+ if ( ! $path ) {
+ return false;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- $path = WP_LANG_DIR . '/themes/' . $mofile;
- if ( in_array( $path, $cached_mofiles, true ) ) {
- return $path;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Themes with their language directory outside of WP_LANG_DIR have a different file name.
+ $template_directory = trailingslashit( get_template_directory() );
+ $stylesheet_directory = trailingslashit( get_stylesheet_directory() );
+ if ( str_starts_with( $path, $template_directory ) || str_starts_with( $path, $stylesheet_directory ) ) {
+ $mofile = "{$path}{$locale}.mo";
+ } else {
+ $mofile = "{$path}{$domain}-{$locale}.mo";
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return false;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return load_textdomain( $domain, $mofile, $locale );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1314,7 +1293,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.8.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @global MO[] $l10n
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @global MO[] $l10n An array of all currently loaded text domains.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $domain Text domain. Unique identifier for retrieving translated strings.
</span><span class="cx" style="display: block; padding: 0 10px"> * @return Translations|NOOP_Translations A Translations instance.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1338,7 +1317,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.0.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @global MO[] $l10n
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @global MO[] $l10n An array of all currently loaded text domains.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $domain Text domain. Unique identifier for retrieving translated strings.
</span><span class="cx" style="display: block; padding: 0 10px"> * @return bool Whether there are translations.
</span></span></pre></div>
<a id="trunksrcwpsettingsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-settings.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-settings.php 2022-08-10 13:52:42 UTC (rev 53873)
+++ trunk/src/wp-settings.php 2022-08-11 12:37:05 UTC (rev 53874)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -152,6 +152,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Load the L10n library.
</span><span class="cx" style="display: block; padding: 0 10px"> require_once ABSPATH . WPINC . '/l10n.php';
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+require_once ABSPATH . WPINC . '/class-wp-textdomain-registry.php';
</ins><span class="cx" style="display: block; padding: 0 10px"> require_once ABSPATH . WPINC . '/class-wp-locale.php';
</span><span class="cx" style="display: block; padding: 0 10px"> require_once ABSPATH . WPINC . '/class-wp-locale-switcher.php';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -334,6 +335,17 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $GLOBALS['wp_embed'] = new WP_Embed();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/**
+ * WordPress Textdomain Registry object.
+ *
+ * Used to support just-in-time translations for manually loaded text domains.
+ *
+ * @since 6.1.0
+ *
+ * @global WP_Textdomain_Registry $wp_textdomain_registry WordPress Textdomain Registry.
+ */
+$GLOBALS['wp_textdomain_registry'] = new WP_Textdomain_Registry();
+
</ins><span class="cx" style="display: block; padding: 0 10px"> // Load multisite-specific files.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( is_multisite() ) {
</span><span class="cx" style="display: block; padding: 0 10px"> require ABSPATH . WPINC . '/ms-functions.php';
</span></span></pre></div>
<a id="trunktestsphpunitdatalanguagespluginsinternationalizedpluginde_DEmo"></a>
<div class="binary"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/data/languages/plugins/internationalized-plugin-de_DE.mo</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<a id="trunktestsphpunitdatalanguagespluginsinternationalizedpluginde_DEpo"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/data/languages/plugins/internationalized-plugin-de_DE.po</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/languages/plugins/internationalized-plugin-de_DE.po 2022-08-10 13:52:42 UTC (rev 53873)
+++ trunk/tests/phpunit/data/languages/plugins/internationalized-plugin-de_DE.po 2022-08-11 12:37:05 UTC (rev 53874)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2,12 +2,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> msgstr ""
</span><span class="cx" style="display: block; padding: 0 10px"> "Project-Id-Version: \n"
</span><span class="cx" style="display: block; padding: 0 10px"> "POT-Creation-Date: 2015-12-31 16:31+0100\n"
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-"PO-Revision-Date: 2016-10-26 00:02+0200\n"
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+"PO-Revision-Date: 2020-10-20 17:11+0200\n"
</ins><span class="cx" style="display: block; padding: 0 10px"> "Language: de_DE\n"
</span><span class="cx" style="display: block; padding: 0 10px"> "MIME-Version: 1.0\n"
</span><span class="cx" style="display: block; padding: 0 10px"> "Content-Type: text/plain; charset=UTF-8\n"
</span><span class="cx" style="display: block; padding: 0 10px"> "Content-Transfer-Encoding: 8bit\n"
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-"X-Generator: Poedit 1.8.10\n"
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+"X-Generator: Poedit 2.4.1\n"
</ins><span class="cx" style="display: block; padding: 0 10px"> "X-Poedit-Basepath: .\n"
</span><span class="cx" style="display: block; padding: 0 10px"> "Plural-Forms: nplurals=2; plural=(n != 1);\n"
</span><span class="cx" style="display: block; padding: 0 10px"> "X-Poedit-KeywordsList: __;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;"
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -14,6 +14,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> "_nx_noop:1,2,3c;esc_attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;"
</span><span class="cx" style="display: block; padding: 0 10px"> "esc_html_x:1,2c\n"
</span><span class="cx" style="display: block; padding: 0 10px"> "X-Textdomain-Support: yes\n"
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+"Language-Team: \n"
+"Last-Translator: \n"
</ins><span class="cx" style="display: block; padding: 0 10px"> "X-Poedit-SearchPath-0: .\n"
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> #: internationalized-plugin.php:11
</span></span></pre></div>
<a id="trunktestsphpunitdatalanguagespluginsinternationalizedplugines_ESmo"></a>
<div class="binary"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/tests/phpunit/data/languages/plugins/internationalized-plugin-es_ES.mo</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx" style="display: block; padding: 0 10px">Index: trunk/tests/phpunit/data/languages/plugins/internationalized-plugin-es_ES.mo
</span><span class="cx" style="display: block; padding: 0 10px">===================================================================
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">--- trunk/tests/phpunit/data/languages/plugins/internationalized-plugin-es_ES.mo 2022-08-10 13:52:42 UTC (rev 53873)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+++ trunk/tests/phpunit/data/languages/plugins/internationalized-plugin-es_ES.mo 2022-08-11 12:37:05 UTC (rev 53874)
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/languages/plugins/internationalized-plugin-es_ES.mo
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:mime-type</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+application/octet-stream
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunktestsphpunitdatalanguagespluginsinternationalizedplugines_ESpo"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/tests/phpunit/data/languages/plugins/internationalized-plugin-es_ES.po</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/languages/plugins/internationalized-plugin-es_ES.po (rev 0)
+++ trunk/tests/phpunit/data/languages/plugins/internationalized-plugin-es_ES.po 2022-08-11 12:37:05 UTC (rev 53874)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,23 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+msgid ""
+msgstr ""
+"Project-Id-Version: \n"
+"POT-Creation-Date: 2015-12-31 16:31+0100\n"
+"PO-Revision-Date: 2020-10-20 17:12+0200\n"
+"Language: de_DE\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: Poedit 2.4.1\n"
+"X-Poedit-Basepath: .\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"X-Poedit-KeywordsList: __;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;"
+"_nx_noop:1,2,3c;esc_attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;"
+"esc_html_x:1,2c\n"
+"X-Textdomain-Support: yes\n"
+"Language-Team: \n"
+"Last-Translator: \n"
+"X-Poedit-SearchPath-0: .\n"
+
+#: internationalized-plugin.php:11
+msgid "This is a dummy plugin"
+msgstr "Este es un plugin dummy"
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/languages/plugins/internationalized-plugin-es_ES.po
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunktestsphpunitdatalanguagesthemesinternationalizedthemede_DEmo"></a>
<div class="binary"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/data/languages/themes/internationalized-theme-de_DE.mo</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<a id="trunktestsphpunitdatalanguagesthemesinternationalizedthemede_DEpo"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/data/languages/themes/internationalized-theme-de_DE.po</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/languages/themes/internationalized-theme-de_DE.po 2022-08-10 13:52:42 UTC (rev 53873)
+++ trunk/tests/phpunit/data/languages/themes/internationalized-theme-de_DE.po 2022-08-11 12:37:05 UTC (rev 53874)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2,12 +2,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> msgstr ""
</span><span class="cx" style="display: block; padding: 0 10px"> "Project-Id-Version: \n"
</span><span class="cx" style="display: block; padding: 0 10px"> "POT-Creation-Date: 2015-12-31 16:38+0100\n"
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-"PO-Revision-Date: 2016-10-26 00:02+0200\n"
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+"PO-Revision-Date: 2020-10-20 17:09+0200\n"
</ins><span class="cx" style="display: block; padding: 0 10px"> "Language: de_DE\n"
</span><span class="cx" style="display: block; padding: 0 10px"> "MIME-Version: 1.0\n"
</span><span class="cx" style="display: block; padding: 0 10px"> "Content-Type: text/plain; charset=UTF-8\n"
</span><span class="cx" style="display: block; padding: 0 10px"> "Content-Transfer-Encoding: 8bit\n"
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-"X-Generator: Poedit 1.8.10\n"
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+"X-Generator: Poedit 2.4.1\n"
</ins><span class="cx" style="display: block; padding: 0 10px"> "X-Poedit-Basepath: .\n"
</span><span class="cx" style="display: block; padding: 0 10px"> "Plural-Forms: nplurals=2; plural=(n != 1);\n"
</span><span class="cx" style="display: block; padding: 0 10px"> "X-Poedit-KeywordsList: __;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;"
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -14,6 +14,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> "_nx_noop:1,2,3c;esc_attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;"
</span><span class="cx" style="display: block; padding: 0 10px"> "esc_html_x:1,2c\n"
</span><span class="cx" style="display: block; padding: 0 10px"> "X-Textdomain-Support: yes\n"
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+"Last-Translator: \n"
+"Language-Team: \n"
</ins><span class="cx" style="display: block; padding: 0 10px"> "X-Poedit-SearchPath-0: .\n"
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> #: functions.php:7
</span></span></pre></div>
<a id="trunktestsphpunitdatapluginscustominternationalizedplugincustominternationalizedpluginphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/tests/phpunit/data/plugins/custom-internationalized-plugin/custom-internationalized-plugin.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/plugins/custom-internationalized-plugin/custom-internationalized-plugin.php (rev 0)
+++ trunk/tests/phpunit/data/plugins/custom-internationalized-plugin/custom-internationalized-plugin.php 2022-08-11 12:37:05 UTC (rev 53874)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,14 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/*
+Plugin Name: Custom Dummy Plugin
+Plugin URI: https://wordpress.org/
+Description: For testing purposes only.
+Version: 1.0.0
+Text Domain: custom-internationalized-plugin
+*/
+
+load_plugin_textdomain( 'custom-internationalized-plugin', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
+
+function custom_i18n_plugin_test() {
+ return __( 'This is a dummy plugin', 'custom-internationalized-plugin' );
+}
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/plugins/custom-internationalized-plugin/custom-internationalized-plugin.php
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunktestsphpunitdatapluginscustominternationalizedpluginlanguagescustominternationalizedpluginde_DEmo"></a>
<div class="binary"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/tests/phpunit/data/plugins/custom-internationalized-plugin/languages/custom-internationalized-plugin-de_DE.mo</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx" style="display: block; padding: 0 10px">Index: trunk/tests/phpunit/data/plugins/custom-internationalized-plugin/languages/custom-internationalized-plugin-de_DE.mo
</span><span class="cx" style="display: block; padding: 0 10px">===================================================================
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">--- trunk/tests/phpunit/data/plugins/custom-internationalized-plugin/languages/custom-internationalized-plugin-de_DE.mo 2022-08-10 13:52:42 UTC (rev 53873)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+++ trunk/tests/phpunit/data/plugins/custom-internationalized-plugin/languages/custom-internationalized-plugin-de_DE.mo 2022-08-11 12:37:05 UTC (rev 53874)
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/plugins/custom-internationalized-plugin/languages/custom-internationalized-plugin-de_DE.mo
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:mime-type</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+application/octet-stream
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunktestsphpunitdatapluginscustominternationalizedpluginlanguagescustominternationalizedpluginde_DEpo"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/tests/phpunit/data/plugins/custom-internationalized-plugin/languages/custom-internationalized-plugin-de_DE.po</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/plugins/custom-internationalized-plugin/languages/custom-internationalized-plugin-de_DE.po (rev 0)
+++ trunk/tests/phpunit/data/plugins/custom-internationalized-plugin/languages/custom-internationalized-plugin-de_DE.po 2022-08-11 12:37:05 UTC (rev 53874)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,23 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+msgid ""
+msgstr ""
+"Project-Id-Version: \n"
+"POT-Creation-Date: 2015-12-31 16:31+0100\n"
+"PO-Revision-Date: 2022-07-04 18:48+0200\n"
+"Last-Translator: Dominik Schilling\n"
+"Language-Team: \n"
+"Language: de_DE\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"X-Generator: Poedit 3.1\n"
+"X-Poedit-Basepath: .\n"
+"X-Poedit-KeywordsList: __;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;"
+"_nx_noop:1,2,3c;esc_attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;"
+"esc_html_x:1,2c\n"
+"X-Textdomain-Support: yes\n"
+"X-Poedit-SearchPath-0: .\n"
+
+#: internationalized-plugin.php:11
+msgid "This is a dummy plugin"
+msgstr "Das ist ein Dummy Plugin"
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/plugins/custom-internationalized-plugin/languages/custom-internationalized-plugin-de_DE.po
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunktestsphpunitdatapluginscustominternationalizedpluginlanguagescustominternationalizedplugines_ESmo"></a>
<div class="binary"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/tests/phpunit/data/plugins/custom-internationalized-plugin/languages/custom-internationalized-plugin-es_ES.mo</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx" style="display: block; padding: 0 10px">Index: trunk/tests/phpunit/data/plugins/custom-internationalized-plugin/languages/custom-internationalized-plugin-es_ES.mo
</span><span class="cx" style="display: block; padding: 0 10px">===================================================================
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">--- trunk/tests/phpunit/data/plugins/custom-internationalized-plugin/languages/custom-internationalized-plugin-es_ES.mo 2022-08-10 13:52:42 UTC (rev 53873)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+++ trunk/tests/phpunit/data/plugins/custom-internationalized-plugin/languages/custom-internationalized-plugin-es_ES.mo 2022-08-11 12:37:05 UTC (rev 53874)
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/plugins/custom-internationalized-plugin/languages/custom-internationalized-plugin-es_ES.mo
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:mime-type</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+application/octet-stream
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunktestsphpunitdatapluginscustominternationalizedpluginlanguagescustominternationalizedplugines_ESpo"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/tests/phpunit/data/plugins/custom-internationalized-plugin/languages/custom-internationalized-plugin-es_ES.po</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/plugins/custom-internationalized-plugin/languages/custom-internationalized-plugin-es_ES.po (rev 0)
+++ trunk/tests/phpunit/data/plugins/custom-internationalized-plugin/languages/custom-internationalized-plugin-es_ES.po 2022-08-11 12:37:05 UTC (rev 53874)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,23 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+msgid ""
+msgstr ""
+"Project-Id-Version: \n"
+"POT-Creation-Date: 2015-12-31 16:31+0100\n"
+"PO-Revision-Date: 2022-07-04 18:48+0200\n"
+"Last-Translator: Dominik Schilling\n"
+"Language-Team: \n"
+"Language: es_ES\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"X-Generator: Poedit 3.1\n"
+"X-Poedit-Basepath: .\n"
+"X-Poedit-KeywordsList: __;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;"
+"_nx_noop:1,2,3c;esc_attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;"
+"esc_html_x:1,2c\n"
+"X-Textdomain-Support: yes\n"
+"X-Poedit-SearchPath-0: .\n"
+
+#: internationalized-plugin.php:11
+msgid "This is a dummy plugin"
+msgstr "Este es un plugin dummy"
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/plugins/custom-internationalized-plugin/languages/custom-internationalized-plugin-es_ES.po
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunktestsphpunitdatapluginshellophp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/data/plugins/hello.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/plugins/hello.php 2022-08-10 13:52:42 UTC (rev 53873)
+++ trunk/tests/phpunit/data/plugins/hello.php 2022-08-11 12:37:05 UTC (rev 53874)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4,11 +4,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> Plugin URI: http://wordpress.org/#
</span><span class="cx" style="display: block; padding: 0 10px"> Description: This is not just a plugin, it symbolizes the hope and enthusiasm of an entire generation summed up in two words sung most famously by Louis Armstrong: Hello, Dolly. When activated you will randomly see a lyric from <cite>Hello, Dolly</cite> in the upper right of your admin screen on every page.
</span><span class="cx" style="display: block; padding: 0 10px"> Author: Matt Mullenweg
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-Version: 1.5.1
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+Version: 1.7.2
</ins><span class="cx" style="display: block; padding: 0 10px"> Author URI: http://ma.tt/
</span><span class="cx" style="display: block; padding: 0 10px"> Text Domain: hello-dolly
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-// Test for
-?>
</del></span></pre></div>
<a id="trunktestsphpunitdatathemedir1custominternationalizedthemefunctionsphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/tests/phpunit/data/themedir1/custom-internationalized-theme/functions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/themedir1/custom-internationalized-theme/functions.php (rev 0)
+++ trunk/tests/phpunit/data/themedir1/custom-internationalized-theme/functions.php 2022-08-11 12:37:05 UTC (rev 53874)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,10 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * Dummy theme.
+ */
+
+load_theme_textdomain( 'custom-internationalized-theme', get_template_directory() . '/languages' );
+
+function custom_i18n_theme_test() {
+ return __( 'This is a dummy theme', 'custom-internationalized-theme' );
+}
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/themedir1/custom-internationalized-theme/functions.php
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunktestsphpunitdatathemedir1custominternationalizedthemeindexphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/tests/phpunit/data/themedir1/custom-internationalized-theme/index.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/themedir1/custom-internationalized-theme/index.php (rev 0)
+++ trunk/tests/phpunit/data/themedir1/custom-internationalized-theme/index.php 2022-08-11 12:37:05 UTC (rev 53874)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,4 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * Dummy theme.
+ */
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/themedir1/custom-internationalized-theme/index.php
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunktestsphpunitdatathemedir1custominternationalizedthemelanguagesde_DEmo"></a>
<div class="binary"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/tests/phpunit/data/themedir1/custom-internationalized-theme/languages/de_DE.mo</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx" style="display: block; padding: 0 10px">Index: trunk/tests/phpunit/data/themedir1/custom-internationalized-theme/languages/de_DE.mo
</span><span class="cx" style="display: block; padding: 0 10px">===================================================================
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">--- trunk/tests/phpunit/data/themedir1/custom-internationalized-theme/languages/de_DE.mo 2022-08-10 13:52:42 UTC (rev 53873)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+++ trunk/tests/phpunit/data/themedir1/custom-internationalized-theme/languages/de_DE.mo 2022-08-11 12:37:05 UTC (rev 53874)
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/themedir1/custom-internationalized-theme/languages/de_DE.mo
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:mime-type</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+application/octet-stream
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunktestsphpunitdatathemedir1custominternationalizedthemelanguagesde_DEpo"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/tests/phpunit/data/themedir1/custom-internationalized-theme/languages/de_DE.po</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/themedir1/custom-internationalized-theme/languages/de_DE.po (rev 0)
+++ trunk/tests/phpunit/data/themedir1/custom-internationalized-theme/languages/de_DE.po 2022-08-11 12:37:05 UTC (rev 53874)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,23 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+msgid ""
+msgstr ""
+"Project-Id-Version: \n"
+"POT-Creation-Date: 2015-12-31 16:38+0100\n"
+"PO-Revision-Date: 2022-07-04 18:47+0200\n"
+"Last-Translator: \n"
+"Language-Team: \n"
+"Language: de_DE\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"X-Generator: Poedit 3.1\n"
+"X-Poedit-Basepath: .\n"
+"X-Poedit-KeywordsList: __;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;"
+"_nx_noop:1,2,3c;esc_attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;"
+"esc_html_x:1,2c\n"
+"X-Textdomain-Support: yes\n"
+"X-Poedit-SearchPath-0: .\n"
+
+#: functions.php:7
+msgid "This is a dummy theme"
+msgstr "Das ist ein Dummy Theme"
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/themedir1/custom-internationalized-theme/languages/de_DE.po
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunktestsphpunitdatathemedir1custominternationalizedthemelanguageses_ESmo"></a>
<div class="binary"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/tests/phpunit/data/themedir1/custom-internationalized-theme/languages/es_ES.mo</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx" style="display: block; padding: 0 10px">Index: trunk/tests/phpunit/data/themedir1/custom-internationalized-theme/languages/es_ES.mo
</span><span class="cx" style="display: block; padding: 0 10px">===================================================================
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">--- trunk/tests/phpunit/data/themedir1/custom-internationalized-theme/languages/es_ES.mo 2022-08-10 13:52:42 UTC (rev 53873)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+++ trunk/tests/phpunit/data/themedir1/custom-internationalized-theme/languages/es_ES.mo 2022-08-11 12:37:05 UTC (rev 53874)
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/themedir1/custom-internationalized-theme/languages/es_ES.mo
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:mime-type</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+application/octet-stream
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunktestsphpunitdatathemedir1custominternationalizedthemelanguageses_ESpo"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/tests/phpunit/data/themedir1/custom-internationalized-theme/languages/es_ES.po</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/themedir1/custom-internationalized-theme/languages/es_ES.po (rev 0)
+++ trunk/tests/phpunit/data/themedir1/custom-internationalized-theme/languages/es_ES.po 2022-08-11 12:37:05 UTC (rev 53874)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,23 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+msgid ""
+msgstr ""
+"Project-Id-Version: \n"
+"POT-Creation-Date: 2015-12-31 16:38+0100\n"
+"PO-Revision-Date: 2022-07-04 18:47+0200\n"
+"Last-Translator: \n"
+"Language-Team: \n"
+"Language: es_ES\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+"X-Generator: Poedit 3.1\n"
+"X-Poedit-Basepath: .\n"
+"X-Poedit-KeywordsList: __;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;"
+"_nx_noop:1,2,3c;esc_attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;"
+"esc_html_x:1,2c\n"
+"X-Textdomain-Support: yes\n"
+"X-Poedit-SearchPath-0: .\n"
+
+#: functions.php:7
+msgid "This is a dummy theme"
+msgstr "Este es un tema dummy"
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/themedir1/custom-internationalized-theme/languages/es_ES.po
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunktestsphpunitdatathemedir1custominternationalizedthemestylecss"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/tests/phpunit/data/themedir1/custom-internationalized-theme/style.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/data/themedir1/custom-internationalized-theme/style.css (rev 0)
+++ trunk/tests/phpunit/data/themedir1/custom-internationalized-theme/style.css 2022-08-11 12:37:05 UTC (rev 53874)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,7 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/*
+Theme Name: Custom Internationalized Theme
+Theme URI: https://wordpress.org/
+Description: For testing purposes only.
+Version: 1.0.0
+Text Domain: custom-internationalized-theme
+*/
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/phpunit/data/themedir1/custom-internationalized-theme/style.css
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunktestsphpunitincludesbootstrapphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/includes/bootstrap.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/includes/bootstrap.php 2022-08-10 13:52:42 UTC (rev 53873)
+++ trunk/tests/phpunit/includes/bootstrap.php 2022-08-11 12:37:05 UTC (rev 53874)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -215,7 +215,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> define( 'DIR_TESTDATA', __DIR__ . '/../data' );
</span><span class="cx" style="display: block; padding: 0 10px"> define( 'DIR_TESTROOT', realpath( dirname( __DIR__ ) ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-define( 'WP_LANG_DIR', DIR_TESTDATA . '/languages' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+define( 'WP_LANG_DIR', realpath( DIR_TESTDATA . '/languages' ) );
+define( 'WP_PLUGIN_DIR', realpath( DIR_TESTDATA . '/plugins' ) );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! defined( 'WP_TESTS_FORCE_KNOWN_BUGS' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> define( 'WP_TESTS_FORCE_KNOWN_BUGS', false );
</span></span></pre></div>
<a id="trunktestsphpunittestsadminincludesPluginphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/admin/includesPlugin.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/admin/includesPlugin.php 2022-08-10 13:52:42 UTC (rev 53873)
+++ trunk/tests/phpunit/tests/admin/includesPlugin.php 2022-08-11 12:37:05 UTC (rev 53874)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -22,7 +22,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'Description' => 'This is not just a plugin, it symbolizes the hope and enthusiasm of an entire generation summed up in two words sung most famously by Louis Armstrong: Hello, Dolly. When activated you will randomly see a lyric from Hello, Dolly in the upper right of your admin screen on every page. <cite>By <a href="http://ma.tt/">Matt Mullenweg</a>.</cite>',
</span><span class="cx" style="display: block; padding: 0 10px"> 'Author' => '<a href="http://ma.tt/">Matt Mullenweg</a>',
</span><span class="cx" style="display: block; padding: 0 10px"> 'AuthorURI' => 'http://ma.tt/',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'Version' => '1.5.1',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'Version' => '1.7.2',
</ins><span class="cx" style="display: block; padding: 0 10px"> 'TextDomain' => 'hello-dolly',
</span><span class="cx" style="display: block; padding: 0 10px"> 'DomainPath' => '',
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span></span></pre></div>
<a id="trunktestsphpunittestsl10nloadTextdomainphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/l10n/loadTextdomain.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/l10n/loadTextdomain.php 2022-08-10 13:52:42 UTC (rev 53873)
+++ trunk/tests/phpunit/tests/l10n/loadTextdomain.php 2022-08-11 12:37:05 UTC (rev 53874)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -24,8 +24,23 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'plugin_locale', array( $this, 'store_locale' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'theme_locale', array( $this, 'store_locale' ) );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ /** @var WP_Textdomain_Registry $wp_textdomain_registry */
+ global $wp_textdomain_registry;
+
+ $wp_textdomain_registry->reset();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function tear_down() {
+
+ /** @var WP_Textdomain_Registry $wp_textdomain_registry */
+ global $wp_textdomain_registry;
+
+ $wp_textdomain_registry->reset();
+
+ parent::tear_down();
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> public function store_locale( $locale ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $this->locale = $locale;
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunktestsphpunittestsl10nloadTextdomainJustInTimephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/l10n/loadTextdomainJustInTime.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/l10n/loadTextdomainJustInTime.php 2022-08-10 13:52:42 UTC (rev 53873)
+++ trunk/tests/phpunit/tests/l10n/loadTextdomainJustInTime.php 2022-08-11 12:37:05 UTC (rev 53874)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -32,20 +32,24 @@
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'stylesheet_root', array( $this, 'filter_theme_root' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'template_root', array( $this, 'filter_theme_root' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> wp_clean_themes_cache();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- unset( $GLOBALS['wp_themes'] );
- unset( $GLOBALS['l10n'] );
- unset( $GLOBALS['l10n_unloaded'] );
- _get_path_to_translation( null, true );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ unset( $GLOBALS['wp_themes'], $GLOBALS['l10n'], $GLOBALS['l10n_unloaded'] );
+
+ /** @var WP_Textdomain_Registry $wp_textdomain_registry */
+ global $wp_textdomain_registry;
+
+ $wp_textdomain_registry->reset();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public function tear_down() {
</span><span class="cx" style="display: block; padding: 0 10px"> $GLOBALS['wp_theme_directories'] = $this->orig_theme_dir;
</span><span class="cx" style="display: block; padding: 0 10px"> wp_clean_themes_cache();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- unset( $GLOBALS['wp_themes'] );
- unset( $GLOBALS['l10n'] );
- unset( $GLOBALS['l10n_unloaded'] );
- _get_path_to_translation( null, true );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ unset( $GLOBALS['wp_themes'], $GLOBALS['l10n'], $GLOBALS['l10n_unloaded'] );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /** @var WP_Textdomain_Registry $wp_textdomain_registry */
+ global $wp_textdomain_registry;
+
+ $wp_textdomain_registry->reset();
+
</ins><span class="cx" style="display: block; padding: 0 10px"> parent::tear_down();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -177,6 +181,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * @ticket 37997
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @ticket 39210
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @covers ::switch_to_locale
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -192,7 +197,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> restore_current_locale();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertSame( 'Das ist ein Dummy Plugin', $actual_de_de );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->assertSame( 'This is a dummy plugin', $actual_es_es );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->assertSame( 'Este es un plugin dummy', $actual_es_es );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span></span></pre></div>
<a id="trunktestsphpunittestsl10nwpLocaleSwitcherphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/l10n/wpLocaleSwitcher.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/l10n/wpLocaleSwitcher.php 2022-08-10 13:52:42 UTC (rev 53873)
+++ trunk/tests/phpunit/tests/l10n/wpLocaleSwitcher.php 2022-08-11 12:37:05 UTC (rev 53874)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -22,16 +22,22 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->locale = '';
</span><span class="cx" style="display: block; padding: 0 10px"> $this->previous_locale = '';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- unset( $GLOBALS['l10n'] );
- unset( $GLOBALS['l10n_unloaded'] );
- _get_path_to_translation( null, true );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ unset( $GLOBALS['l10n'], $GLOBALS['l10n_unloaded'] );
+
+ /** @var WP_Textdomain_Registry $wp_textdomain_registry */
+ global $wp_textdomain_registry;
+
+ $wp_textdomain_registry->reset();
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public function tear_down() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- unset( $GLOBALS['l10n'] );
- unset( $GLOBALS['l10n_unloaded'] );
- _get_path_to_translation( null, true );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ unset( $GLOBALS['l10n'], $GLOBALS['l10n_unloaded'] );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /** @var WP_Textdomain_Registry $wp_textdomain_registry */
+ global $wp_textdomain_registry;
+
+ $wp_textdomain_registry->reset();
+
</ins><span class="cx" style="display: block; padding: 0 10px"> parent::tear_down();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -458,6 +464,82 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertSame( 'This is a dummy plugin', $actual );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @ticket 39210
+ */
+ public function test_switch_reloads_plugin_translations_outside_wp_lang_dir() {
+ /** @var WP_Textdomain_Registry $wp_textdomain_registry */
+ global $wp_locale_switcher, $wp_textdomain_registry;
+
+ $locale_switcher = clone $wp_locale_switcher;
+
+ $wp_locale_switcher = new WP_Locale_Switcher();
+ $wp_locale_switcher->init();
+
+ require_once DIR_TESTDATA . '/plugins/custom-internationalized-plugin/custom-internationalized-plugin.php';
+
+ $registry_value = $wp_textdomain_registry->get( 'custom-internationalized-plugin', determine_locale() );
+
+ $actual = custom_i18n_plugin_test();
+
+ switch_to_locale( 'es_ES' );
+ switch_to_locale( 'de_DE' );
+
+ $actual_de_de = custom_i18n_plugin_test();
+
+ restore_previous_locale();
+
+ $actual_es_es = custom_i18n_plugin_test();
+
+ restore_current_locale();
+
+ $wp_locale_switcher = $locale_switcher;
+
+ $this->assertSame( 'This is a dummy plugin', $actual );
+ $this->assertSame( WP_PLUGIN_DIR . '/custom-internationalized-plugin/languages/', $registry_value );
+ $this->assertSame( 'Das ist ein Dummy Plugin', $actual_de_de );
+ $this->assertSame( 'Este es un plugin dummy', $actual_es_es );
+ }
+
+ /**
+ * @ticket 39210
+ */
+ public function test_switch_reloads_theme_translations_outside_wp_lang_dir() {
+ /** @var WP_Textdomain_Registry $wp_textdomain_registry */
+ global $wp_locale_switcher, $wp_textdomain_registry;
+
+ $locale_switcher = clone $wp_locale_switcher;
+
+ $wp_locale_switcher = new WP_Locale_Switcher();
+ $wp_locale_switcher->init();
+
+ switch_theme( 'custom-internationalized-theme' );
+
+ require_once get_stylesheet_directory() . '/functions.php';
+
+ $registry_value = $wp_textdomain_registry->get( 'custom-internationalized-theme', determine_locale() );
+
+ $actual = custom_i18n_theme_test();
+
+ switch_to_locale( 'es_ES' );
+ switch_to_locale( 'de_DE' );
+
+ $actual_de_de = custom_i18n_theme_test();
+
+ restore_previous_locale();
+
+ $actual_es_es = custom_i18n_theme_test();
+
+ restore_current_locale();
+
+ $wp_locale_switcher = $locale_switcher;
+
+ $this->assertSame( get_template_directory() . '/languages/', $registry_value );
+ $this->assertSame( 'This is a dummy theme', $actual );
+ $this->assertSame( 'Das ist ein Dummy Theme', $actual_de_de );
+ $this->assertSame( 'Este es un tema dummy', $actual_es_es );
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> public function filter_locale() {
</span><span class="cx" style="display: block; padding: 0 10px"> return 'es_ES';
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunktestsphpunitteststhemethemeDirphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/theme/themeDir.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/theme/themeDir.php 2022-08-10 13:52:42 UTC (rev 53873)
+++ trunk/tests/phpunit/tests/theme/themeDir.php 2022-08-11 12:37:05 UTC (rev 53874)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -159,6 +159,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'Page Template Theme', // Theme with page templates for other test code.
</span><span class="cx" style="display: block; padding: 0 10px"> 'Theme with Spaces in the Directory',
</span><span class="cx" style="display: block; padding: 0 10px"> 'Internationalized Theme',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'Custom Internationalized Theme',
</ins><span class="cx" style="display: block; padding: 0 10px"> 'camelCase',
</span><span class="cx" style="display: block; padding: 0 10px"> 'REST Theme',
</span><span class="cx" style="display: block; padding: 0 10px"> 'Block Theme',
</span></span></pre>
</div>
</div>
</body>
</html>