BUGFIX Hard fallback to en_US.js in Requirements

Ideally we'll have region-less locales like en.js as fallbacks,
but for now this prevents the UI becoming non-operational
e.g. when both i18n::set_locale() and i18n::default_locale()
are set to 'en_NZ'.
This commit is contained in:
Ingo Schommer 2013-01-09 22:31:19 +01:00
parent 76e233de70
commit 5f8115f4c7

View File

@ -768,6 +768,11 @@ class Requirements_Backend {
$files[] = $langDir . i18n::default_locale() . '.js';
$files[] = $langDir . i18n::get_locale() . '.js';
// If both files don't exist, hard fallback to en_US
if(!Director::fileExists($files[0]) && !Director::fileExists($files[1])) {
$files[] = $langDir . 'en_US.js';
}
// Stub i18n implementation for when i18n is disabled.
} else {
if(!$langOnly) $files[] = FRAMEWORK_DIR . '/javascript/i18nx.js';