From a44916dc19f9d15be76420e5842ab50ab8dbb227 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Wed, 18 Apr 2012 13:20:23 +0200 Subject: [PATCH] API CHANGE Don't use $tinymce_lang lookup in i18n::get_lang_from_locale(), as it mixes locales with langs and hence breaks language fallbacks in _t() (e.g. "pt_BR" returns "pt_br", rather than "pt") --- i18n/i18n.php | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/i18n/i18n.php b/i18n/i18n.php index 12351fd81..82bdb1725 100644 --- a/i18n/i18n.php +++ b/i18n/i18n.php @@ -1742,22 +1742,13 @@ class i18n extends Object implements TemplateGlobalProvider { /** * Returns the "short" language name from a locale, - * e.g. "en_US" would return "en". This conversion - * is determined internally by the {@link $tinymce_lang} - * lookup table. If no match can be found in this lookup, - * the characters before the underscore ("_") are returned. - * - * @todo More generic lookup table, don't rely on tinymce specific conversion + * e.g. "en_US" would return "en". * * @param string $locale E.g. "en_US" * @return string Short language code, e.g. "en" */ static function get_lang_from_locale($locale) { - if(isset(self::$tinymce_lang[$locale])) { - return self::$tinymce_lang[$locale]; - } else { - return preg_replace('/(_|-).*/', '', $locale); - } + return preg_replace('/(_|-).*/', '', $locale); } /**