<!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>[54682] branches/6.1: I18N: Change how `WP_Textdomain_Registry` stores the default languages path.</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/54682">54682</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/54682","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>ocean90</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2022-10-24 18:35:30 +0000 (Mon, 24 Oct 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: Change how `WP_Textdomain_Registry` stores the default languages path.
`WP_Textdomain_Registry` was introduced in <a href="https://core.trac.wordpress.org/changeset/53874">[53874]</a> to store text domains and their language directory paths, addressing issues with just-in-time loading of textdomains when using locale switching and when using`load_*_textdomain()` functions.
Said change has inadvertently caused a performance regression exactly when using`load_*_textdomain()`, which still often is the case, where the cached information was not further used or even overridden.
This change addresses that issue by storing the default languages paths in a separate way, while at the same time making `WP_Textdomain_Registry` easier to maintain and adding new tests to catch future regressions.
Props flixos90, spacedmonkey, ocean90, SergeyBiryukov, costdev.
Merges <a href="https://core.trac.wordpress.org/changeset/54669">[54669]</a> to the 6.1 branch.
See <a href="https://core.trac.wordpress.org/ticket/39210">#39210</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branches61srcwpincludesclasswptextdomainregistryphp">branches/6.1/src/wp-includes/class-wp-textdomain-registry.php</a></li>
<li><a href="#branches61srcwpincludesl10nphp">branches/6.1/src/wp-includes/l10n.php</a></li>
<li><a href="#branches61testsphpunittestsl10nloadTextdomainphp">branches/6.1/tests/phpunit/tests/l10n/loadTextdomain.php</a></li>
<li><a href="#branches61testsphpunittestsl10nloadTextdomainJustInTimephp">branches/6.1/tests/phpunit/tests/l10n/loadTextdomainJustInTime.php</a></li>
<li><a href="#branches61testsphpunittestsl10nwpLocaleSwitcherphp">branches/6.1/tests/phpunit/tests/l10n/wpLocaleSwitcher.php</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#branches61testsphpunittestsl10nwpTextdomainRegistryphp">branches/6.1/tests/phpunit/tests/l10n/wpTextdomainRegistry.php</a></li>
</ul>
<h3>Property Changed</h3>
<ul>
<li><a href="#branches61">branches/6.1/</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<span class="cx" style="display: block; padding: 0 10px">Index: branches/6.1
</span><span class="cx" style="display: block; padding: 0 10px">===================================================================
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">--- branches/6.1 2022-10-24 17:14:39 UTC (rev 54681)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+++ branches/6.1 2022-10-24 18:35:30 UTC (rev 54682)
</ins><a id="branches61"></a>
<div class="propset"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Property changes: branches/6.1</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svnmergeinfo"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: svn:mergeinfo</h4></div>
<span class="cx" style="display: block; padding: 0 10px"> /branches/5.0:43681-43682,43684-43688,43719-43720,43723,43726-43727,43729-43731,43734-43744,43747,43751-43754,43758,43760-43765,43767-43770,43772,43774-43781,43783,43785,43790-43806,43808-43821,43825,43828,43830-43834,43836-43843,43846-43863,43867-43889,43891-43894,43897-43905,43908-43909,43911-43929,43931-43942,43946-43947,43949-43956,43959-43964,43967-43969,43988,43994,44014,44017,44047,44183,44185,44187-44206,44208-44213,44231-44232,44235,44248,44284,44287-44288
</span><span class="cx" style="display: block; padding: 0 10px"> /branches/5.5:49373-49379,49381
</span><span class="cx" style="display: block; padding: 0 10px"> /branches/5.8:51889
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/trunk:54645-54646,54649,54652,54662,54674,54678
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/trunk:54645-54646,54649,54652,54662,54669,54674,54678
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="branches61srcwpincludesclasswptextdomainregistryphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/6.1/src/wp-includes/class-wp-textdomain-registry.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/6.1/src/wp-includes/class-wp-textdomain-registry.php 2022-10-24 17:14:39 UTC (rev 54681)
+++ branches/6.1/src/wp-includes/class-wp-textdomain-registry.php 2022-10-24 18:35:30 UTC (rev 54682)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -33,6 +33,18 @@
</span><span class="cx" style="display: block; padding: 0 10px"> protected $current = array();
</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">+ * List of domains and their custom language directory paths.
+ *
+ * @see load_plugin_textdomain()
+ * @see load_theme_textdomain()
+ *
+ * @since 6.1.0
+ *
+ * @var array
+ */
+ protected $custom_paths = array();
+
+ /**
</ins><span class="cx" style="display: block; padding: 0 10px"> * Holds a cached list of available .mo files to improve performance.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 6.1.0
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -42,7 +54,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> protected $cached_mo_files;
</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">- * Returns the MO file path for a specific domain and locale.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Returns the languages directory path for a specific domain and locale.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 6.1.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -62,6 +74,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Determines whether any MO file paths are available for the domain.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * This is the case if a path has been set for the current locale,
+ * or if there is no information stored yet, in which case
+ * {@see _load_textdomain_just_in_time()} will fetch the information first.
+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @since 6.1.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $domain Text domain.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -68,28 +84,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @return bool Whether any MO file paths are available for the domain.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function has( $domain ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return ! empty( $this->all[ $domain ] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return ! empty( $this->current[ $domain ] ) || empty( $this->all[ $domain ] );
</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><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Returns the current (most recent) MO file path for a specific domain.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Sets the language directory path for a specific domain and locale.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @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.
- *
</del><span class="cx" style="display: block; padding: 0 10px"> * Also sets the 'current' property for direct access
</span><span class="cx" style="display: block; padding: 0 10px"> * to the path for the current (most recent) locale.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -105,57 +105,65 @@
</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">- * Resets the registry state.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Sets the custom path to the plugin's/theme's languages directory.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @since 6.1.0
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Used by {@see load_plugin_textdomain()} and {@see load_theme_textdomain()}.
+ *
+ * @param string $domain Text domain.
+ * @param string $path Language directory path.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public function reset() {
- $this->cached_mo_files = null;
- $this->all = array();
- $this->current = array();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function set_custom_path( $domain, $path ) {
+ $this->custom_paths[ $domain ] = untrailingslashit( $path );
</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><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Gets the path to a translation file in the languages directory for the current locale.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Gets the path to the language directory for the current locale.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Checks the plugins and themes language directories as well as any
+ * custom directory set via {@see load_plugin_textdomain()} or {@see load_theme_textdomain()}.
+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @since 6.1.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @see _get_path_to_translation_from_lang_dir()
+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @param string $domain Text domain.
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $locale Locale.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return string|false MO file path or false if there is none available.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return string|false Language directory path or false if there is none available.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> private function get_path_from_lang_dir( $domain, $locale ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( null === $this->cached_mo_files ) {
- $this->set_cached_mo_files();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $locations = array(
+ WP_LANG_DIR . '/plugins',
+ WP_LANG_DIR . '/themes',
+ );
+
+ if ( isset( $this->custom_paths[ $domain ] ) ) {
+ $locations[] = $this->custom_paths[ $domain ];
</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">- $mofile = "{$domain}-{$locale}.mo";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $mofile = "$domain-$locale.mo";
</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 . '/plugins/' . $mofile;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ foreach ( $locations as $location ) {
+ if ( ! isset( $this->cached_mo_files[ $location ] ) ) {
+ $this->set_cached_mo_files( $location );
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( in_array( $path, $this->cached_mo_files, true ) ) {
- $path = WP_LANG_DIR . '/plugins/';
- $this->set( $domain, $locale, $path );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $path = $location . '/' . $mofile;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return $path;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( in_array( $path, $this->cached_mo_files[ $location ], true ) ) {
+ $this->set( $domain, $locale, $location );
+
+ return trailingslashit( $location );
+ }
</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">- $path = WP_LANG_DIR . '/themes/' . $mofile;
- if ( in_array( $path, $this->cached_mo_files, true ) ) {
- $path = WP_LANG_DIR . '/themes/';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // If no path is found for the given locale and a custom path has been set
+ // using load_plugin_textdomain/load_theme_textdomain, use that one.
+ if ( 'en_US' !== $locale && isset( $this->custom_paths[ $domain ] ) ) {
+ $path = trailingslashit( $this->custom_paths[ $domain ] );
</ins><span class="cx" style="display: block; padding: 0 10px"> $this->set( $domain, $locale, $path );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> return $path;
</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">- // 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'];
- }
-
</del><span class="cx" style="display: block; padding: 0 10px"> $this->set( $domain, $locale, false );
</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="lines" style="display: block; padding: 0 10px; color: #888">@@ -162,24 +170,19 @@
</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">- * Reads and caches all available MO files from the plugins and themes language directories.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Reads and caches all available MO files from a given directory.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 6.1.0
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *
+ * @param string $path Language directory path.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- protected function set_cached_mo_files() {
- $this->cached_mo_files = array();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ private function set_cached_mo_files( $path ) {
+ $this->cached_mo_files[ $path ] = array();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $locations = array(
- WP_LANG_DIR . '/plugins',
- WP_LANG_DIR . '/themes',
- );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $mo_files = glob( $path . '/*.mo' );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- foreach ( $locations as $location ) {
- $mo_files = glob( $location . '/*.mo' );
-
- if ( $mo_files ) {
- $this->cached_mo_files = array_merge( $this->cached_mo_files, $mo_files );
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $mo_files ) {
+ $this->cached_mo_files[ $path ] = $mo_files;
</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="branches61srcwpincludesl10nphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/6.1/src/wp-includes/l10n.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/6.1/src/wp-includes/l10n.php 2022-10-24 17:14:39 UTC (rev 54681)
+++ branches/6.1/src/wp-includes/l10n.php 2022-10-24 18:35:30 UTC (rev 54682)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -934,7 +934,7 @@
</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">- $wp_textdomain_registry->set( $domain, $locale, $path );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $wp_textdomain_registry->set_custom_path( $domain, $path );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return load_textdomain( $domain, $path . '/' . $mofile, $locale );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -968,7 +968,7 @@
</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">- $wp_textdomain_registry->set( $domain, $locale, $path );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $wp_textdomain_registry->set_custom_path( $domain, $path );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return load_textdomain( $domain, $path . '/' . $mofile, $locale );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1016,7 +1016,7 @@
</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">- $wp_textdomain_registry->set( $domain, $locale, $path );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $wp_textdomain_registry->set_custom_path( $domain, $path );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return load_textdomain( $domain, $path . '/' . $locale . '.mo', $locale );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1265,7 +1265,7 @@
</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">- if ( $wp_textdomain_registry->has( $domain ) && ! $wp_textdomain_registry->get_current( $domain ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! $wp_textdomain_registry->has( $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></span></pre></div>
<a id="branches61testsphpunittestsl10nloadTextdomainphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/6.1/tests/phpunit/tests/l10n/loadTextdomain.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/6.1/tests/phpunit/tests/l10n/loadTextdomain.php 2022-10-24 17:14:39 UTC (rev 54681)
+++ branches/6.1/tests/phpunit/tests/l10n/loadTextdomain.php 2022-10-24 18:35:30 UTC (rev 54682)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -28,7 +28,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var WP_Textdomain_Registry $wp_textdomain_registry */
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_textdomain_registry;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $wp_textdomain_registry->reset();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $wp_textdomain_registry = new WP_Textdomain_Registry();
</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="lines" style="display: block; padding: 0 10px; color: #888">@@ -36,7 +36,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var WP_Textdomain_Registry $wp_textdomain_registry */
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_textdomain_registry;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $wp_textdomain_registry->reset();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $wp_textdomain_registry = new WP_Textdomain_Registry();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> parent::tear_down();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="branches61testsphpunittestsl10nloadTextdomainJustInTimephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/6.1/tests/phpunit/tests/l10n/loadTextdomainJustInTime.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/6.1/tests/phpunit/tests/l10n/loadTextdomainJustInTime.php 2022-10-24 17:14:39 UTC (rev 54681)
+++ branches/6.1/tests/phpunit/tests/l10n/loadTextdomainJustInTime.php 2022-10-24 18:35:30 UTC (rev 54682)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -8,7 +8,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> protected $orig_theme_dir;
</span><span class="cx" style="display: block; padding: 0 10px"> protected $theme_root;
</span><span class="cx" style="display: block; padding: 0 10px"> protected static $user_id;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- private $locale_count;
</del><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
</span><span class="cx" style="display: block; padding: 0 10px"> self::$user_id = $factory->user->create(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -24,7 +23,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $this->theme_root = DIR_TESTDATA . '/themedir1';
</span><span class="cx" style="display: block; padding: 0 10px"> $this->orig_theme_dir = $GLOBALS['wp_theme_directories'];
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->locale_count = 0;
</del><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // /themes is necessary as theme.php functions assume /themes is the root if there is only one root.
</span><span class="cx" style="display: block; padding: 0 10px"> $GLOBALS['wp_theme_directories'] = array( WP_CONTENT_DIR . '/themes', $this->theme_root );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -37,7 +35,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var WP_Textdomain_Registry $wp_textdomain_registry */
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_textdomain_registry;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $wp_textdomain_registry->reset();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $wp_textdomain_registry = new WP_Textdomain_Registry();
</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="lines" style="display: block; padding: 0 10px; color: #888">@@ -48,7 +46,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var WP_Textdomain_Registry $wp_textdomain_registry */
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_textdomain_registry;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $wp_textdomain_registry->reset();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $wp_textdomain_registry = new WP_Textdomain_Registry();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><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="lines" style="display: block; padding: 0 10px; color: #888">@@ -262,7 +260,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> public function test_get_locale_is_called_only_once_per_textdomain() {
</span><span class="cx" style="display: block; padding: 0 10px"> $textdomain = 'foo-bar-baz';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- add_filter( 'locale', array( $this, '_filter_locale_count' ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $filter = new MockAction();
+ add_filter( 'locale', array( $filter, 'filter' ) );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> __( 'Foo', $textdomain );
</span><span class="cx" style="display: block; padding: 0 10px"> __( 'Bar', $textdomain );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -270,15 +269,31 @@
</span><span class="cx" style="display: block; padding: 0 10px"> __( 'Foo Bar', $textdomain );
</span><span class="cx" style="display: block; padding: 0 10px"> __( 'Foo Bar Baz', $textdomain );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- remove_filter( 'locale', array( $this, '_filter_locale_count' ) );
-
</del><span class="cx" style="display: block; padding: 0 10px"> $this->assertFalse( is_textdomain_loaded( $textdomain ) );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->assertSame( 1, $this->locale_count );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->assertSame( 1, $filter->get_call_count() );
</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">- public function _filter_locale_count( $locale ) {
- ++$this->locale_count;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * @ticket 37997
+ * @ticket 39210
+ *
+ * @covers ::_load_textdomain_just_in_time
+ */
+ public function test_get_locale_is_called_only_once_per_textdomain_with_custom_lang_dir() {
+ load_plugin_textdomain( 'custom-internationalized-plugin', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return $locale;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $textdomain = 'custom-internationalized-plugin';
+
+ $filter = new MockAction();
+ add_filter( 'locale', array( $filter, 'filter' ) );
+
+ __( 'Foo', $textdomain );
+ __( 'Bar', $textdomain );
+ __( 'Baz', $textdomain );
+ __( 'Foo Bar', $textdomain );
+ __( 'Foo Bar Baz', $textdomain );
+
+ $this->assertFalse( is_textdomain_loaded( $textdomain ) );
+ $this->assertSame( 1, $filter->get_call_count() );
</ins><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="branches61testsphpunittestsl10nwpLocaleSwitcherphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/6.1/tests/phpunit/tests/l10n/wpLocaleSwitcher.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/6.1/tests/phpunit/tests/l10n/wpLocaleSwitcher.php 2022-10-24 17:14:39 UTC (rev 54681)
+++ branches/6.1/tests/phpunit/tests/l10n/wpLocaleSwitcher.php 2022-10-24 18:35:30 UTC (rev 54682)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -27,7 +27,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var WP_Textdomain_Registry $wp_textdomain_registry */
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_textdomain_registry;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $wp_textdomain_registry->reset();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $wp_textdomain_registry = new WP_Textdomain_Registry();
</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="lines" style="display: block; padding: 0 10px; color: #888">@@ -36,7 +36,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /** @var WP_Textdomain_Registry $wp_textdomain_registry */
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_textdomain_registry;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $wp_textdomain_registry->reset();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $wp_textdomain_registry = new WP_Textdomain_Registry();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><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="lines" style="display: block; padding: 0 10px; color: #888">@@ -478,11 +478,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> require_once DIR_TESTDATA . '/plugins/custom-internationalized-plugin/custom-internationalized-plugin.php';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $registry_value = $wp_textdomain_registry->get( 'custom-internationalized-plugin', determine_locale() );
-
</del><span class="cx" style="display: block; padding: 0 10px"> $actual = custom_i18n_plugin_test();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> switch_to_locale( 'es_ES' );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ $registry_value = $wp_textdomain_registry->get( 'custom-internationalized-plugin', determine_locale() );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> switch_to_locale( 'de_DE' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $actual_de_de = custom_i18n_plugin_test();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -517,11 +518,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> require_once get_stylesheet_directory() . '/functions.php';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $registry_value = $wp_textdomain_registry->get( 'custom-internationalized-theme', determine_locale() );
-
</del><span class="cx" style="display: block; padding: 0 10px"> $actual = custom_i18n_theme_test();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> switch_to_locale( 'es_ES' );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ $registry_value = $wp_textdomain_registry->get( 'custom-internationalized-theme', determine_locale() );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> switch_to_locale( 'de_DE' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $actual_de_de = custom_i18n_theme_test();
</span></span></pre></div>
<a id="branches61testsphpunittestsl10nwpTextdomainRegistryphpfromrev54669trunktestsphpunittestsl10nwpTextdomainRegistryphp"></a>
<div class="copfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Copied: branches/6.1/tests/phpunit/tests/l10n/wpTextdomainRegistry.php (from rev 54669, trunk/tests/phpunit/tests/l10n/wpTextdomainRegistry.php)</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/6.1/tests/phpunit/tests/l10n/wpTextdomainRegistry.php (rev 0)
+++ branches/6.1/tests/phpunit/tests/l10n/wpTextdomainRegistry.php 2022-10-24 18:35:30 UTC (rev 54682)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,150 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+
+/**
+ * @group l10n
+ * @group i18n
+ *
+ * @coversDefaultClass WP_Textdomain_Registry
+ */
+class Tests_L10n_wpTextdomainRegistry extends WP_UnitTestCase {
+ /**
+ * @var WP_Textdomain_Registry
+ */
+ protected $instance;
+
+ public function set_up() {
+ parent::set_up();
+
+ $this->instance = new WP_Textdomain_Registry();
+ }
+
+ /**
+ * @covers ::has
+ * @covers ::get
+ * @covers ::set_custom_path
+ */
+ public function test_set_custom_path() {
+ $reflection = new ReflectionClass( $this->instance );
+ $reflection_property = $reflection->getProperty( 'cached_mo_files' );
+ $reflection_property->setAccessible( true );
+
+ $this->assertNull(
+ $reflection_property->getValue( $this->instance ),
+ 'Cache not empty by default'
+ );
+
+ $this->instance->set_custom_path( 'foo', WP_LANG_DIR . '/bar' );
+
+ $this->assertTrue(
+ $this->instance->has( 'foo' ),
+ 'Incorrect availability status for textdomain with custom path'
+ );
+ $this->assertFalse(
+ $this->instance->get( 'foo', 'en_US' ),
+ 'Should not return custom path for textdomain and en_US locale'
+ );
+ $this->assertSame(
+ WP_LANG_DIR . '/bar/',
+ $this->instance->get( 'foo', 'de_DE' ),
+ 'Custom path for textdomain not returned'
+ );
+ $this->assertArrayHasKey(
+ WP_LANG_DIR . '/bar',
+ $reflection_property->getValue( $this->instance ),
+ 'Custom path missing from cache'
+ );
+ }
+
+ /**
+ * @covers ::get
+ * @dataProvider data_domains_locales
+ */
+ public function test_get( $domain, $locale, $expected ) {
+ $reflection = new ReflectionClass( $this->instance );
+ $reflection_property = $reflection->getProperty( 'cached_mo_files' );
+ $reflection_property->setAccessible( true );
+
+ $actual = $this->instance->get( $domain, $locale );
+ $this->assertSame(
+ $expected,
+ $actual,
+ 'Expected languages directory path not matching actual one'
+ );
+
+ $this->assertArrayHasKey(
+ WP_LANG_DIR . '/plugins',
+ $reflection_property->getValue( $this->instance ),
+ 'Default plugins path missing from cache'
+ );
+ }
+
+ /**
+ * @covers ::get_path_from_lang_dir
+ */
+ public function test_get_does_not_check_themes_directory_for_plugin() {
+ $reflection = new ReflectionClass( $this->instance );
+ $reflection_property = $reflection->getProperty( 'cached_mo_files' );
+ $reflection_property->setAccessible( true );
+
+ $this->instance->get( 'internationalized-plugin', 'de_DE' );
+
+ $this->assertArrayHasKey(
+ WP_LANG_DIR . '/plugins',
+ $reflection_property->getValue( $this->instance ),
+ 'Default plugins path missing from cache'
+ );
+ $this->assertArrayNotHasKey(
+ WP_LANG_DIR . '/themes',
+ $reflection_property->getValue( $this->instance ),
+ 'Default themes path should not be in cache'
+ );
+ }
+
+ /**
+ * @covers ::set
+ * @covers ::get
+ */
+ public function test_set_populates_cache() {
+ $this->instance->set( 'foo-plugin', 'de_DE', '/foo/bar' );
+
+ $this->assertSame(
+ '/foo/bar/',
+ $this->instance->get( 'foo-plugin', 'de_DE' )
+ );
+ }
+
+ public function data_domains_locales() {
+ return array(
+ 'Non-existent plugin' => array(
+ 'unknown-plugin',
+ 'en_US',
+ false,
+ ),
+ 'Non-existent plugin with de_DE' => array(
+ 'unknown-plugin',
+ 'de_DE',
+ false,
+ ),
+ 'Available de_DE translations' => array(
+ 'internationalized-plugin',
+ 'de_DE',
+ WP_LANG_DIR . '/plugins/',
+ ),
+ 'Available es_ES translations' => array(
+ 'internationalized-plugin',
+ 'es_ES',
+ WP_LANG_DIR . '/plugins/',
+ ),
+ 'Unavailable fr_FR translations' => array(
+ 'internationalized-plugin',
+ 'fr_FR',
+ false,
+ ),
+ 'Unavailable en_US translations' => array(
+ 'internationalized-plugin',
+ 'en_US',
+ false,
+ ),
+ );
+ }
+}
</ins></span></pre>
</div>
</div>
</body>
</html>