mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Fixed merge error
See 00ffe72944e004e1dbbbad43fe644b733053d4a9
This commit is contained in:
parent
afe06661ef
commit
c78c0aa828
@ -2224,15 +2224,22 @@ class i18n extends Object implements TemplateGlobalProvider {
|
|||||||
$allLocales = Config::inst()->get('i18n', 'all_locales');
|
$allLocales = Config::inst()->get('i18n', 'all_locales');
|
||||||
$moduleLocales = scandir("{$module}/lang/");
|
$moduleLocales = scandir("{$module}/lang/");
|
||||||
foreach($moduleLocales as $moduleLocale) {
|
foreach($moduleLocales as $moduleLocale) {
|
||||||
preg_match('/(.*)\.[\w\d]+$/',$moduleLocale, $matches);
|
$locale = pathinfo($moduleLocale, PATHINFO_FILENAME);
|
||||||
if($locale = @$matches[1]) {
|
$ext = pathinfo($moduleLocale, PATHINFO_EXTENSION);
|
||||||
// Normalize locale to include likely region tag.
|
if($locale && in_array($ext, array('php','yml'))) {
|
||||||
|
// Normalize locale to include likely region tag, avoid repetition in locale labels
|
||||||
// TODO Replace with CLDR list of actually available languages/regions
|
// TODO Replace with CLDR list of actually available languages/regions
|
||||||
$locale = str_replace('-', '_', self::get_locale_from_lang($locale));
|
// Only allow explicitly registered locales, otherwise we'll get into trouble
|
||||||
$locales[$locale] = (isset($allLocales[$locale])) ? $allLocales[$locale] : $locale;
|
// if the locale doesn't exist in Zend's CLDR data
|
||||||
|
$labelLocale = str_replace('-', '_', self::get_locale_from_lang($locale));
|
||||||
|
if(isset(self::$all_locales[$locale])) {
|
||||||
|
$locales[$locale] = self::$all_locales[$locale];
|
||||||
|
} else if(isset(self::$all_locales[$labelLocale])) {
|
||||||
|
$locales[$locale] = self::$all_locales[$labelLocale];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// sort by title (not locale)
|
// sort by title (not locale)
|
||||||
asort($locales);
|
asort($locales);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user