If the language name is region-specific (longer then 2 chars), then return it in a readable way, e.g. English (US) / English (GB)

This commit is contained in:
Flavio Copes
2015-10-03 14:07:27 +02:00
parent e0d51beb84
commit 9669fe90d7

View File

@@ -744,7 +744,11 @@ class LanguageCodes
public static function getNativeName($code)
{
return static::get($code, 'nativeName');
if (strlen($code) == 2) {
return static::get($code, 'nativeName');
} else {
return static::get(substr($code, 0, 2), 'nativeName') . ' (' . substr($code, -2) . ')';
}
}
public static function getNames(array $keys)