1. LanguageConverter enabled for LanguageGan, per the request from Gan Wikipedia.
2. Update the Chinese conversion tables.
This commit is contained in:
parent
fc1f87ca77
commit
b8b9e1e477
12 changed files with 4489 additions and 2123 deletions
|
|
@ -2546,7 +2546,7 @@ $zh2Hant = array(
|
|||
'龟' => '龜',
|
||||
'𡒄' => '壈',
|
||||
'𨱏' => '鎝',
|
||||
'<EFBFBD><EFBFBD><EFBFBD>' => '鱇',
|
||||
'𩾌' => '鱇',
|
||||
'' => '棡',
|
||||
'0多只' => '0多隻',
|
||||
'0天后' => '0天後',
|
||||
|
|
@ -3922,6 +3922,7 @@ $zh2Hant = array(
|
|||
'多占' => '多佔',
|
||||
'多划' => '多劃',
|
||||
'多只是' => '多只是',
|
||||
'多只需' => '多只需',
|
||||
'多天后' => '多天後',
|
||||
'多于' => '多於',
|
||||
'多冲' => '多衝',
|
||||
|
|
@ -5483,7 +5484,6 @@ $zh2Hant = array(
|
|||
'乐于' => '樂於',
|
||||
'樊于期' => '樊於期',
|
||||
'梁上' => '樑上',
|
||||
'梁书' => '樑書',
|
||||
'梁柱' => '樑柱',
|
||||
'标志着' => '標志著',
|
||||
'标杆' => '標杆',
|
||||
|
|
@ -10985,7 +10985,7 @@ $zh2Hans = array(
|
|||
'鰾' => '鳔',
|
||||
'鱂' => '鳉',
|
||||
'鱅' => '鳙',
|
||||
'鱇' => '<EFBFBD><EFBFBD><EFBFBD>',
|
||||
'鱇' => '𩾌',
|
||||
'鱈' => '鳕',
|
||||
'鱉' => '鳖',
|
||||
'鱒' => '鳟',
|
||||
|
|
@ -11726,6 +11726,7 @@ $zh2Hans = array(
|
|||
'尋著者' => '寻著者',
|
||||
'尋著述' => '寻著述',
|
||||
'將軍抽車' => '将军抽車',
|
||||
'尼乾陀' => '尼乾陀',
|
||||
'展著' => '展着',
|
||||
'展著書' => '展著书',
|
||||
'展著作' => '展著作',
|
||||
|
|
@ -12192,6 +12193,7 @@ $zh2Hans = array(
|
|||
'於夫罗' => '於夫罗',
|
||||
'於夫羅' => '於夫罗',
|
||||
'於姓' => '於姓',
|
||||
'於崇文' => '於崇文',
|
||||
'於戲' => '於戏',
|
||||
'於梨華' => '於梨华',
|
||||
'於梨华' => '於梨华',
|
||||
|
|
|
|||
|
|
@ -101,8 +101,8 @@ def GetManualTable( dest ):
|
|||
elem = elem.strip('|')
|
||||
if elem:
|
||||
temp2 = elem.split( '|', 1 )
|
||||
from_char = temp2[0][-1:]
|
||||
to_chars = [code[-1:] for code in temp2[1].split('|')]
|
||||
from_char = chr( int( temp2[0][2:7], 16 ) )
|
||||
to_chars = [chr( int( code[2:7], 16 ) ) for code in temp2[1].split('|')]
|
||||
char_table[from_char] = to_chars
|
||||
return char_table
|
||||
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ U+08d5e赞|U+08d0a贊|U+08b9a讚|
|
|||
U+0E82D|U+068E1棡|
|
||||
U+29F8C𩾌|U+09C47鱇|
|
||||
U+070BC炼|U+07149煉|U+0934A鍊|
|
||||
U+0432A个|U+0500B個|U+07B87箇|
|
||||
U+04E2A个|U+0500B個|U+07B87箇|
|
||||
U+094F2铲|U+093DF鏟|U+05277剷|
|
||||
U+05EB5庵|U+05EB5庵|U+083F4菴|
|
||||
U+05F69彩|U+05F69彩|U+07DB5綵|
|
||||
|
|
@ -2032,4 +2032,7 @@
|
|||
因著《
|
||||
因著〈
|
||||
李泽钜
|
||||
於祥玉
|
||||
於祥玉
|
||||
於崇文
|
||||
尼乾陀
|
||||
於崇文
|
||||
|
|
@ -66,7 +66,7 @@ U+07E34縴|U+07EA4纤|
|
|||
U+07E94纔|U+0624D才|
|
||||
U+08591薑|U+059DC姜|
|
||||
U+0884A衊|U+08511蔑|
|
||||
U+08A17託|U+06258托|U+8BAC讬|
|
||||
U+08A17託|U+06258托|U+08BAC讬|
|
||||
U+08B8E讎|U+04EC7仇|
|
||||
U+08B9A讚|U+08D5E赞|
|
||||
U+08FF4迴|U+056DE回|
|
||||
|
|
@ -104,7 +104,7 @@ U+08986覆|U+08986覆|U+0590D复|
|
|||
U+085C9藉|U+085C9藉|U+0501F借|
|
||||
U+05138儸|U+03469㑩|U+07F57罗|
|
||||
U+06FDB濛|U+06FDB濛|U+08499蒙|
|
||||
U+07B87箇|U+0432A个|
|
||||
U+07B87箇|U+04E2A个|
|
||||
U+05277剷|U+094F2铲|
|
||||
U+05690嚐|U+05C1D尝|
|
||||
U+055AB喫|U+05403吃|
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
萬隻
|
||||
億隻
|
||||
多只是
|
||||
多只需
|
||||
最多只
|
||||
多隻
|
||||
0多隻
|
||||
|
|
|
|||
|
|
@ -248,6 +248,7 @@
|
|||
公裡
|
||||
箇中
|
||||
樑子
|
||||
樑書
|
||||
讚成
|
||||
讚同
|
||||
鐘表店
|
||||
|
|
@ -99,7 +99,9 @@
|
|||
'fy' => 'Frysk', # Frisian
|
||||
'ga' => 'Gaeilge', # Irish
|
||||
'gag' => 'Gagauz', # Gagauz
|
||||
'gan' => '贛語', # Gan
|
||||
'gan' => '贛語', # Gan-hant
|
||||
'gan-hans' => '赣语(简体)', # Gan-hans
|
||||
'gan-hant' => '贛語(繁體)', # Gan-hant
|
||||
'gd' => 'Gàidhlig', # Scots Gaelic
|
||||
'gl' => 'Galego', # Galician
|
||||
'glk' => 'گیلکی', # Gilaki
|
||||
|
|
|
|||
168
languages/classes/LanguageGan.php
Normal file
168
languages/classes/LanguageGan.php
Normal file
|
|
@ -0,0 +1,168 @@
|
|||
<?php
|
||||
|
||||
require_once( dirname(__FILE__).'/../LanguageConverter.php' );
|
||||
require_once( dirname(__FILE__).'/LanguageZh.php' );
|
||||
|
||||
/**
|
||||
* @ingroup Language
|
||||
*/
|
||||
class GanConverter extends LanguageConverter {
|
||||
|
||||
function __construct($langobj, $maincode,
|
||||
$variants=array(),
|
||||
$variantfallbacks=array(),
|
||||
$markup=array(),
|
||||
$flags = array(),
|
||||
$manualLevel = array() ) {
|
||||
$this->mDescCodeSep = ':';
|
||||
$this->mDescVarSep = ';';
|
||||
parent::__construct($langobj, $maincode,
|
||||
$variants,
|
||||
$variantfallbacks,
|
||||
$markup,
|
||||
$flags,
|
||||
$manualLevel);
|
||||
$names = array(
|
||||
'gan' => '原文',
|
||||
'gan-hans' => '简体',
|
||||
'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() {
|
||||
require( dirname(__FILE__)."/../../includes/ZhConversion.php" );
|
||||
$this->mTables = array(
|
||||
'gan-hans' => new ReplacementArray( $zh2Hans ),
|
||||
'gan-hant' => new ReplacementArray( $zh2Hant ),
|
||||
'gan' => new ReplacementArray
|
||||
);
|
||||
}
|
||||
|
||||
/* there shouldn't be any latin text in Chinese conversion, so no need
|
||||
to mark anything.
|
||||
$noParse is there for compatibility with LanguageConvert::markNoConversion
|
||||
*/
|
||||
function markNoConversion($text, $noParse = false) {
|
||||
return $text;
|
||||
}
|
||||
|
||||
function convertCategoryKey( $key ) {
|
||||
return $this->autoConvert( $key, 'gan' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* class that handles both Traditional and Simplified Chinese
|
||||
* right now it only distinguish gan_hans, gan_hant.
|
||||
*
|
||||
* @ingroup Language
|
||||
*/
|
||||
class LanguageGan extends LanguageZh {
|
||||
|
||||
function __construct() {
|
||||
global $wgHooks;
|
||||
parent::__construct();
|
||||
|
||||
$variants = array('gan','gan-hans','gan-hant');
|
||||
$variantfallbacks = array(
|
||||
'gan' => array('gan-hans','gan-hant'),
|
||||
'gan-hans' => array('gan'),
|
||||
'gan-hant' => array('gan'),
|
||||
);
|
||||
$ml=array(
|
||||
'gan' => 'disable',
|
||||
);
|
||||
|
||||
$this->mConverter = new GanConverter( $this, 'gan',
|
||||
$variants, $variantfallbacks,
|
||||
array(),array(),
|
||||
$ml);
|
||||
|
||||
$wgHooks['ArticleSaveComplete'][] = $this->mConverter;
|
||||
}
|
||||
|
||||
# this should give much better diff info
|
||||
function segmentForDiff( $text ) {
|
||||
return preg_replace(
|
||||
"/([\\xc0-\\xff][\\x80-\\xbf]*)/e",
|
||||
"' ' .\"$1\"", $text);
|
||||
}
|
||||
|
||||
function unsegmentForDiff( $text ) {
|
||||
return preg_replace(
|
||||
"/ ([\\xc0-\\xff][\\x80-\\xbf]*)/e",
|
||||
"\"$1\"", $text);
|
||||
}
|
||||
|
||||
// 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 convertForSearchResult( $termsArray ) {
|
||||
$terms = implode( '|', $termsArray );
|
||||
$terms = implode( '|', $this->mConverter->autoConvertToAllVariants( $terms ) );
|
||||
$ret = array_unique( explode('|', $terms) );
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
2135
languages/messages/MessagesGan_hans.php
Normal file
2135
languages/messages/MessagesGan_hans.php
Normal file
File diff suppressed because it is too large
Load diff
2134
languages/messages/MessagesGan_hant.php
Normal file
2134
languages/messages/MessagesGan_hant.php
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue