Allow merging of similarly named text domains. Props sambauers. fixes #7376 for trunk
git-svn-id: https://develop.svn.wordpress.org/trunk@8556 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
ace1dbc33e
commit
9ac24840ea
@ -242,15 +242,21 @@ function __ngettext_noop($single, $plural, $number=1, $domain = 'default') {
|
|||||||
function load_textdomain($domain, $mofile) {
|
function load_textdomain($domain, $mofile) {
|
||||||
global $l10n;
|
global $l10n;
|
||||||
|
|
||||||
if (isset($l10n[$domain]))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if ( is_readable($mofile))
|
if ( is_readable($mofile))
|
||||||
$input = new CachedFileReader($mofile);
|
$input = new CachedFileReader($mofile);
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$l10n[$domain] = new gettext_reader($input);
|
$gettext = new gettext_reader($input);
|
||||||
|
|
||||||
|
if (isset($l10n[$domain])) {
|
||||||
|
$l10n[$domain]->load_tables();
|
||||||
|
$gettext->load_tables();
|
||||||
|
$l10n[$domain]->cache_translations = array_merge($gettext->cache_translations, $l10n[$domain]->cache_translations);
|
||||||
|
} else
|
||||||
|
$l10n[$domain] = $gettext;
|
||||||
|
|
||||||
|
unset($input, $gettext);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user