Allow merging of similarly named text domains. Props sambauers. fixes #7376 for trunk
git-svn-id: http://svn.automattic.com/wordpress/trunk@8556 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5eae274300
commit
cd722a7472
|
@ -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