From: Zheng Zhu Date: Fri, 24 Sep 2004 18:37:33 +0000 (+0000) Subject: fixed formating (tab instead of space) X-Git-Tag: 1.5.0alpha1~1815 X-Git-Url: http://git.cyclocoop.org/?a=commitdiff_plain;h=4f7aeeb348f75631013a39e1933047d027c844b9;hp=1452f989207802514903126cd573834dd5cb276f;p=lhc%2Fweb%2Fwiklou.git fixed formating (tab instead of space) --- diff --git a/languages/Language.php b/languages/Language.php index cb129ed0b0..f736314590 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -1966,19 +1966,19 @@ class Language { return $word; } - - # convert text to different variants of a language. the automatic - # conversion is done in autoConvert(). here we parse the text - # marked with -{}-, which specifies special conversions of the - # text that can not be accomplished in autoConvert() - # - # syntax of the markup: - # -{code1:text1;code2:text2;...}- or - # -{text}- in which case no conversion should take place for text + + # convert text to different variants of a language. the automatic + # conversion is done in autoConvert(). here we parse the text + # marked with -{}-, which specifies special conversions of the + # text that can not be accomplished in autoConvert() + # + # syntax of the markup: + # -{code1:text1;code2:text2;...}- or + # -{text}- in which case no conversion should take place for text function convert( $text ) { - if(sizeof($this->getVariants())<2) - return $text; + if(sizeof($this->getVariants())<2) + return $text; // no conversion if redirecting if(substr($text,0,9) == "#REDIRECT") { @@ -1986,68 +1986,68 @@ class Language { } - $plang = $this->getPreferredVariant(); - - $tarray = explode("-{", $text); - $tfirst = array_shift($tarray); - $text = $this->autoConvert($tfirst); - - foreach($tarray as $txt) { - $marked = explode("}-", $txt); - - $choice = explode(";", $marked{0}); - if($choice{1}==NULL) { - $text .= $choice{0}; - } - else { - foreach($choice as $c) { - list($code, $content) = split(":", $c); - $code = trim($code); - $content = trim($content); - if($code == $plang) { - $text .= $content; - break; - } - } - } - $text .= $this->autoConvert($marked{1}); - } - - return $text; + $plang = $this->getPreferredVariant(); + + $tarray = explode("-{", $text); + $tfirst = array_shift($tarray); + $text = $this->autoConvert($tfirst); + + foreach($tarray as $txt) { + $marked = explode("}-", $txt); + + $choice = explode(";", $marked{0}); + if($choice{1}==NULL) { + $text .= $choice{0}; + } + else { + foreach($choice as $c) { + list($code, $content) = split(":", $c); + $code = trim($code); + $content = trim($content); + if($code == $plang) { + $text .= $content; + break; + } + } + } + $text .= $this->autoConvert($marked{1}); + } + + return $text; } /* this does the real conversion to the preferred variant. see LanguageZh.php for example - */ - function autoConvert($text) { - return $text; - } - - # see if we have a list of language variants for conversion. - # right now mainly used in the Chinese conversion - function getVariants() { - return array(); - } - - - function getPreferredVariant() { - global $wgUser; - - // if user logged in, get in from user's preference - if($wgUser->getID()!=0) - return $wgUser->getOption('variant'); - - // if we have multiple variants for this langauge, - // pick the first one as default - $v=$this->getVariants() ; - if(!empty($v)) - return $v{0}; - - // otherwise there should really be just one variant, - // get it from the class name - $lang = strtolower(substr(get_class($this), 8)); - return $lang; - } + */ + function autoConvert($text) { + return $text; + } + + # see if we have a list of language variants for conversion. + # right now mainly used in the Chinese conversion + function getVariants() { + return array(); + } + + + function getPreferredVariant() { + global $wgUser; + + // if user logged in, get in from user's preference + if($wgUser->getID()!=0) + return $wgUser->getOption('variant'); + + // if we have multiple variants for this langauge, + // pick the first one as default + $v=$this->getVariants() ; + if(!empty($v)) + return $v{0}; + + // otherwise there should really be just one variant, + // get it from the class name + $lang = strtolower(substr(get_class($this), 8)); + return $lang; + } } # This should fail gracefully if there's not a localization available