From d4df70d10190e12d0086bf18327ffbd4846c2277 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Wed, 6 Jul 2005 07:53:51 +0000 Subject: [PATCH] Fixed bug with incorrect variants being returned for language codes with hyphens --- languages/Language.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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 ) ) ); + } + } -- 2.20.1