Make Language::fetchLanguageName lowercase its first argument.
authorBrian Wolff <bawolff+wn@gmail.com>
Sat, 21 Dec 2013 23:28:25 +0000 (16:28 -0700)
committerBrian Wolff <bawolff+wn@gmail.com>
Sat, 21 Dec 2013 23:28:25 +0000 (16:28 -0700)
Currently Language::fetchLanguageName( 'en-GB' ) returns false as
it expects 'en-gb'. Given that technically speaking, 'en-GB'
is the canonical form, I don't think this is a good thing.

Changed function to lowercase its argument. There's no
Language object handy, so I just used strtolower (since language
codes are always ascii, that shouldn't matter)

Change-Id: Iba1f581bf2d6d2b26a14f9f80699d8eeb5d724d6

languages/Language.php

index 0026fdf..23506e9 100644 (file)
@@ -929,6 +929,7 @@ class Language {
         * @since 1.20
         */
        public static function fetchLanguageName( $code, $inLanguage = null, $include = 'all' ) {
+               $code = strtolower( $code );
                $array = self::fetchLanguageNames( $inLanguage, $include );
                return !array_key_exists( $code, $array ) ? '' : $array[$code];
        }