added the getVariant() interface to get a list of supported language variants
authorZheng Zhu <zhengzhu@users.mediawiki.org>
Fri, 17 Sep 2004 18:27:06 +0000 (18:27 +0000)
committerZheng Zhu <zhengzhu@users.mediawiki.org>
Fri, 17 Sep 2004 18:27:06 +0000 (18:27 +0000)
languages/Language.php
languages/LanguageZh.php

index 297ad05..dd808d7 100644 (file)
@@ -527,6 +527,7 @@ Your account has been created. Don't forget to change your {{SITENAME}} preferen
 'youremail'            => 'Your email*',
 'yourrealname'         => 'Your real name*',
 'yourlanguage' => 'Interface language',
+'yourvariant'  => 'Language variant',
 'yournick'             => 'Your nickname (for signatures)',
 'emailforlost' => "Fields marked with a star (*) are optional.  Storing an email address enables people to contact you through the website without you having to reveal your
 email address to them, and it can be used to send you a new password if you forget it.<br /><br />Your real name, if you choose to provide it, will be used for giving you attribution for your work.",
@@ -1961,6 +1962,12 @@ class Language {
        function convert( $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();
+    }
 }
 
 # This should fail gracefully if there's not a localization available
index 6ed75a9..aad79fb 100644 (file)
@@ -57,11 +57,12 @@ class LanguageZh extends LanguageUtf8 {
        }
        
        function convert($text) {
-               
+
                // no conversion if redirecting
                if(substr($text,0,9) == "#REDIRECT") {
                        return $text;
                }
+        
                // determine the preferred language from the request header
                $tolang = $this->getPreferredLanguage();
        
@@ -96,10 +97,13 @@ class LanguageZh extends LanguageUtf8 {
                                $text = $text.$this->simp2trad($a{1});
                        }
                }
+
                return $text;
        }
        
-
+    function getVariants() {
+        return array("zh_cn", "zh_tw");
+    }
 
 
     /* these just calls the method of the corresponding class */