Add zh-cn and zh-tw language prefixes in order to label simplified and traditional...
authorBrion Vibber <brion@users.mediawiki.org>
Wed, 2 Jul 2003 07:29:54 +0000 (07:29 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Wed, 2 Jul 2003 07:29:54 +0000 (07:29 +0000)
includes/Interwiki.php
includes/OutputPage.php
includes/Title.php
languages/Language.php

index e5e97aa..8f2dd7c 100644 (file)
@@ -258,6 +258,8 @@ $WikiPediaLanguages = array(
        "yo"    => "http://yo.wikipedia.com/wiki.cgi?$1",
        "za"    => "http://za.wikipedia.com/wiki.cgi?$1",
        "zh"    => "http://zh.wikipedia.org/wiki/$1",
+       "zh-cn" => "http://zh.wikipedia.org/wiki/$1",
+       "zh-tw" => "http://zh.wikipedia.org/wiki/$1",
        "zu"    => "http://zu.wikipedia.com/wiki.cgi?$1",
        "nds"   => "http://nds.wikipedia.org/wiki.cgi?$1"
 );
index 50748e4..a753d71 100644 (file)
@@ -834,7 +834,7 @@ class OutputPage {
                                $link = $m[1]; 
                        }
 
-                       if ( preg_match( "/^([A-Za-z\\x80-\\xff]+):(.*)\$/", $link,  $m ) ) {
+                       if ( preg_match( "/^((?:i|x|[a-z]{2,3})(?:-[a-z0-9]+)?|[A-Za-z\\x80-\\xff]+):(.*)\$/", $link,  $m ) ) {
                                $pre = strtolower( $m[1] );
                                $suf = $m[2];
                                if ( $wgLang->getNsIndex( $pre ) ==
index f870526..0df3f6c 100644 (file)
@@ -73,7 +73,9 @@ class Title {
                        return "-,.()' &;%!?_0-9A-Za-z\\/:\\x80-\\xFF";
                } else {
                        # ISO 8859-* don't allow 0x80-0x9F
-                       return "-,.()' &;%!?_0-9A-Za-z\\/:\\xA0-\\xFF";
+                       #return "-,.()' &;%!?_0-9A-Za-z\\/:\\xA0-\\xFF";
+                       # But that breaks interlanguage links at the moment. Temporary:
+                       return "-,.()' &;%!?_0-9A-Za-z\\/:\\x80-\\xFF";
                }
        }
 
@@ -324,7 +326,7 @@ class Title {
                if ( ":" == $t{0} ) {
                        $r = substr( $t, 1 );
                } else {
-                       if ( preg_match( "/^([A-Za-z0-9_\\x80-\\xff]+):(.*)$/", $t, $m ) ) {
+                       if ( preg_match( "/^((?:i|x|[a-z]{2,3})(?:-[a-z0-9]+)?|[A-Za-z0-9_\\x80-\\xff]+):(.*)$/", $t, $m ) ) {
                                #$p = strtolower( $m[1] );
                                $p = $m[1];
                                if ( array_key_exists( $p, $wgValidInterwikis ) ) {
index dfe4ebd..acb5156 100644 (file)
@@ -217,6 +217,8 @@ this</a> (alternative: like this<a href=\"\" class=\"internal\">?</a>).",
        "yo"    => "Yoruba",
        "za"    => "Zhuang",
        "zh" => "&#20013;&#25991; (Zhongwen)",
+       "zh-cn" => "&#20013;&#25991;(&#31616;&#20307;) (Simplified Chinese)",
+       "zh-tw" => "&#20013;&#25991;(&#32321;&#20307;) (Traditional Chinese)",
        "zu"    => "Zulu"
 );