i18n: Prevent is_textdomain_loaded() from returning true even if there are no translations for the domain.

In `get_translations_for_domain()` don't fill the global `$l10n` with `NOOP_Translations` instances, return a `NOOP_Translations` instance instead.

Props nacin, jrf.
Fixes #21319.

git-svn-id: https://develop.svn.wordpress.org/trunk@36538 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dominik Schilling (ocean90)
2016-02-16 21:14:45 +00:00
parent 3e7f4fba19
commit 35579fa786
2 changed files with 30 additions and 4 deletions
+10 -4
View File
@@ -793,10 +793,16 @@ function load_child_theme_textdomain( $domain, $path = false ) {
*/
function get_translations_for_domain( $domain ) {
global $l10n;
if ( !isset( $l10n[$domain] ) ) {
$l10n[$domain] = new NOOP_Translations;
if ( isset( $l10n[ $domain ] ) ) {
return $l10n[ $domain ];
}
return $l10n[$domain];
static $noop_translations = null;
if ( null === $noop_translations ) {
$noop_translations = new NOOP_Translations;
}
return $noop_translations;
}
/**
@@ -811,7 +817,7 @@ function get_translations_for_domain( $domain ) {
*/
function is_textdomain_loaded( $domain ) {
global $l10n;
return isset( $l10n[$domain] );
return isset( $l10n[ $domain ] );
}
/**