]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blobdiff - languages/classes/LanguageGan.php
MediaWiki 1.16.1
[autoinstallsdev/mediawiki.git] / languages / classes / LanguageGan.php
index f4541059d99635c0c879264e6f7db9e1f553224f..54202e48fa44ca2e69e88e72456ef86f853d8b8a 100644 (file)
@@ -11,7 +11,6 @@ class GanConverter extends LanguageConverter {
        function __construct($langobj, $maincode,
                                                                $variants=array(),
                                                                $variantfallbacks=array(),
-                                                               $markup=array(),
                                                                $flags = array(),
                                                                $manualLevel = array() ) {
                $this->mDescCodeSep = ':';
@@ -19,7 +18,6 @@ class GanConverter extends LanguageConverter {
                parent::__construct($langobj, $maincode,
                                                                        $variants,
                                                                        $variantfallbacks,
-                                                                       $markup,
                                                                        $flags,
                                                                        $manualLevel);
                $names = array(
@@ -28,47 +26,6 @@ class GanConverter extends LanguageConverter {
                        'gan-hant' => '繁體',
                );
                $this->mVariantNames = array_merge($this->mVariantNames,$names);
-               $this->loadNamespaceTables();
-       }
-       
-       function loadNamespaceTables() {
-               global $wgMetaNamespace;
-               $nsproject     = $wgMetaNamespace;
-               $projecttable  = array(
-                       'Wikipedia'       => '维基百科',
-                       'Wikisource'      => '维基文库',
-                       'Wikinews'        => '维基新闻',
-                       'Wiktionary'      => '维基词典',
-                       'Wikibooks'       => '维基教科书',
-                       'Wikiquote'       => '维基语录',
-               );
-               $this->mNamespaceTables['gan-hans'] = array(
-                       'Media'          => '媒体',
-                       'Special'        => '特殊',
-                       'Talk'           => '談詑',
-                       'User'           => '用户',
-                       'User talk'      => '用户談詑',
-                       $nsproject
-                                       => isset($projecttable[$nsproject]) ? 
-                                               $projecttable[$nsproject] : $nsproject,
-                       $nsproject . ' talk'
-                                       => isset($projecttable[$nsproject]) ?
-                                               $projecttable[$nsproject] . '談詑' : $nsproject . '談詑',
-                       'File'           => '文件',
-                       'File talk'      => '文件談詑',
-                       'MediaWiki'      => 'MediaWiki',
-                       'MediaWiki talk' => 'MediaWiki談詑',
-                       'Template'       => '模板',
-                       'Template talk'  => '模板談詑',
-                       'Help'           => '帮助',
-                       'Help talk'      => '帮助談詑',
-                       'Category'       => '分类',
-                       'Category talk'  => '分类談詑',
-               );
-               $this->mNamespaceTables['gan-hant'] = array_merge($this->mNamespaceTables['gan-hans']);
-               $this->mNamespaceTables['gan-hant']['File'] = '檔案';
-               $this->mNamespaceTables['gan-hant']['File talk'] = '檔案談詑';
-               $this->mNamespaceTables['gan'] = array_merge($this->mNamespaceTables['gan-hans']);
        }
 
        function loadDefaultTables() {
@@ -117,7 +74,7 @@ class LanguageGan extends LanguageZh {
 
                $this->mConverter = new GanConverter( $this, 'gan',
                                                                $variants, $variantfallbacks,
-                                                               array(),array(),
+                                                               array(),
                                                                $ml);
 
                $wgHooks['ArticleSaveComplete'][] = $this->mConverter;
@@ -137,32 +94,16 @@ class LanguageGan extends LanguageZh {
        }
 
        // word segmentation
-       function stripForSearch( $string ) {
-               wfProfileIn( __METHOD__ );
-
-               // eventually this should be a word segmentation
-               // for now just treat each character as a word
-               // @fixme only do this for Han characters...
-               $t = preg_replace(
-                               "/([\\xc0-\\xff][\\x80-\\xbf]*)/",
-                               " $1", $string);
-
-        //always convert to gan-hans before indexing. it should be
-               //better to use gan-hans for search, since conversion from
-               //Traditional to Simplified is less ambiguous than the
-               //other way around
-
-               $t = $this->mConverter->autoConvert($t, 'gan-hans');
-               $t = parent::stripForSearch( $t );
-               wfProfileOut( __METHOD__ );
-               return $t;
-
+       function normalizeForSearch( $string, $autoVariant = 'gan-hans' ) {
+               // LanguageZh::normalizeForSearch
+               return parent::normalizeForSearch( $string, $autoVariant );
        }
 
        function convertForSearchResult( $termsArray ) {
                $terms = implode( '|', $termsArray );
+               $terms = self::convertDoubleWidth( $terms );
                $terms = implode( '|', $this->mConverter->autoConvertToAllVariants( $terms ) );
                $ret = array_unique( explode('|', $terms) );
                return $ret;
        }
-}
\ No newline at end of file
+}