FIX: Fix i18n config access to work with 3.1

This commit is contained in:
Sam Minnee 2013-05-06 17:50:25 +12:00
parent a08fbd944e
commit 1371622b15

View File

@ -1457,11 +1457,11 @@ class Translatable extends DataExtension implements PermissionProvider {
$dbLangs = $query->execute()->column(); $dbLangs = $query->execute()->column();
$langlist = array_merge((array)Translatable::default_locale(), (array)$dbLangs); $langlist = array_merge((array)Translatable::default_locale(), (array)$dbLangs);
$returnMap = array(); $returnMap = array();
$allCodes = array_merge(i18n::$all_locales, i18n::$common_locales); $allCodes = array_merge(Config::inst()->get('i18n','all_locales'), Config::inst()->get('i18n','common_locales'));
foreach ($langlist as $langCode) { foreach ($langlist as $langCode) {
if($langCode && isset($allCodes[$langCode])) { if($langCode && isset($allCodes[$langCode])) {
if(is_array($allCodes[$langCode])) { if(is_array($allCodes[$langCode])) {
$returnMap[$langCode] = $allCodes[$langCode][0]; $returnMap[$langCode] = $allCodes[$langCode]['name'];
} else { } else {
$returnMap[$langCode] = $allCodes[$langCode]; $returnMap[$langCode] = $allCodes[$langCode];
} }