From: Tim Starling Date: Wed, 6 Jul 2005 07:53:51 +0000 (+0000) Subject: Fixed bug with incorrect variants being returned for language codes with hyphens X-Git-Tag: 1.5.0beta3~31 X-Git-Url: http://git.cyclocoop.org/fichier?a=commitdiff_plain;h=d4df70d10190e12d0086bf18327ffbd4846c2277;p=lhc%2Fweb%2Fwiklou.git Fixed bug with incorrect variants being returned for language codes with hyphens --- diff --git a/languages/Language.php b/languages/Language.php index fa9a37b259..6458fb063b 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -2133,8 +2133,8 @@ class fakeConverter { var $mLang; function fakeConverter($langobj) {$this->mLang = $langobj;} function convert($t, $i) {return $t;} - function getVariants() { return array( strtolower( substr( get_class( $this->mLang ), 8 ) ) ); } - function getPreferredVariant() {return strtolower( substr( get_class( $this->mLang ), 8 ) );} + function getVariants() { return array( $this->mLang->getCode() ); } + function getPreferredVariant() {return $this->mLang->getCode(); } function findVariantLink(&$l, &$n) {} function getExtraHashOptions() {return '';} function getParsedTitle() {return '';} @@ -2895,6 +2895,13 @@ class Language { return $this; } + /** + * Get the RFC 3066 code for this language object + */ + function getCode() { + return str_replace( '_', '-', strtolower( substr( get_class( $this ), 8 ) ) ); + } + }