MINOR Better error handling in i18n::get_language_name() (from r107437)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112596 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-10-15 03:47:44 +00:00
parent f097b678d8
commit ab918e8546

View File

@ -1555,7 +1555,11 @@ class i18n extends Object {
*/
static function get_language_name($code, $native = false) {
$langs = self::$common_languages;
return ($native ? $langs[$code][1] : $langs[$code][0]);
if($native) {
return (isset($langs[$code][1])) ? $langs[$code][1] : false;
} else {
return (isset($langs[$code][0])) ? $langs[$code][0] : false;
}
}
/**