Index: trunk/phase3/languages/messages/MessagesZh_hans.php |
— | — | @@ -10,27 +10,28 @@ |
11 | 11 | * @author O |
12 | 12 | * @author Shinjiman |
13 | 13 | * @author Wmr89502270 |
| 14 | + * @author Philip |
14 | 15 | */ |
15 | 16 | |
16 | 17 | $namespaceNames = array( |
17 | | - NS_MEDIA => 'Media', |
18 | | - NS_SPECIAL => 'Special', |
| 18 | + NS_MEDIA => '媒体', |
| 19 | + NS_SPECIAL => '特殊', |
19 | 20 | NS_MAIN => '', |
20 | | - NS_TALK => 'Talk', |
21 | | - NS_USER => 'User', |
22 | | - NS_USER_TALK => 'User_talk', |
| 21 | + NS_TALK => '讨论', |
| 22 | + NS_USER => '用户', |
| 23 | + NS_USER_TALK => '用户讨论', |
23 | 24 | # NS_PROJECT set by $wgMetaNamespace |
24 | | - NS_PROJECT_TALK => '$1_talk', |
25 | | - NS_FILE => 'File', |
26 | | - NS_FILE_TALK => 'File_talk', |
| 25 | + NS_PROJECT_TALK => '$1讨论', |
| 26 | + NS_FILE => '文件', |
| 27 | + NS_FILE_TALK => '文件讨论', |
27 | 28 | NS_MEDIAWIKI => 'MediaWiki', |
28 | | - NS_MEDIAWIKI_TALK => 'MediaWiki_talk', |
29 | | - NS_TEMPLATE => 'Template', |
30 | | - NS_TEMPLATE_TALK => 'Template_talk', |
31 | | - NS_HELP => 'Help', |
32 | | - NS_HELP_TALK => 'Help_talk', |
33 | | - NS_CATEGORY => 'Category', |
34 | | - NS_CATEGORY_TALK => 'Category_talk' |
| 29 | + NS_MEDIAWIKI_TALK => 'MediaWiki讨论', |
| 30 | + NS_TEMPLATE => '模板', |
| 31 | + NS_TEMPLATE_TALK => '模板讨论', |
| 32 | + NS_HELP => '帮助', |
| 33 | + NS_HELP_TALK => '帮助讨论', |
| 34 | + NS_CATEGORY => '分类', |
| 35 | + NS_CATEGORY_TALK => '分类讨论' |
35 | 36 | ); |
36 | 37 | |
37 | 38 | $namespaceAliases = array( |
— | — | @@ -49,13 +50,19 @@ |
50 | 51 | 'Image' => NS_FILE, |
51 | 52 | 'Image_talk' => NS_FILE_TALK, |
52 | 53 | '图像对话' => NS_FILE_TALK, |
| 54 | + '图像讨论' => NS_FILE_TALK, |
53 | 55 | '档案对话' => NS_FILE_TALK, |
| 56 | + '档案讨论' => NS_FILE_TALK, |
54 | 57 | '文件对话' => NS_FILE_TALK, |
| 58 | + '文件讨论' => NS_FILE_TALK, |
55 | 59 | '模板' => NS_TEMPLATE, |
| 60 | + '模板对话'=> NS_TEMPLATE_TALK, |
56 | 61 | '模板讨论'=> NS_TEMPLATE_TALK, |
57 | 62 | '帮助' => NS_HELP, |
| 63 | + '帮助对话'=> NS_HELP_TALK, |
58 | 64 | '帮助讨论'=> NS_HELP_TALK, |
59 | 65 | '分类' => NS_CATEGORY, |
| 66 | + '分类对话'=> NS_CATEGORY_TALK, |
60 | 67 | '分类讨论'=> NS_CATEGORY_TALK, |
61 | 68 | ); |
62 | 69 | |
Index: trunk/phase3/languages/messages/MessagesZh.php |
— | — | @@ -4,12 +4,34 @@ |
5 | 5 | * @ingroup Language |
6 | 6 | * @file |
7 | 7 | * |
| 8 | + * @author Philip |
8 | 9 | */ |
9 | 10 | |
10 | 11 | # Stub message file for converter code "zh" |
11 | 12 | |
12 | 13 | $fallback = 'zh-hans'; |
13 | 14 | |
| 15 | +$namespaceNames = array( |
| 16 | + NS_MEDIA => 'Media', |
| 17 | + NS_SPECIAL => 'Special', |
| 18 | + NS_MAIN => '', |
| 19 | + NS_TALK => 'Talk', |
| 20 | + NS_USER => 'User', |
| 21 | + NS_USER_TALK => 'User_talk', |
| 22 | + # NS_PROJECT set by $wgMetaNamespace |
| 23 | + NS_PROJECT_TALK => '$1_talk', |
| 24 | + NS_FILE => 'File', |
| 25 | + NS_FILE_TALK => 'File_talk', |
| 26 | + NS_MEDIAWIKI => 'MediaWiki', |
| 27 | + NS_MEDIAWIKI_TALK => 'MediaWiki_talk', |
| 28 | + NS_TEMPLATE => 'Template', |
| 29 | + NS_TEMPLATE_TALK => 'Template_talk', |
| 30 | + NS_HELP => 'Help', |
| 31 | + NS_HELP_TALK => 'Help_talk', |
| 32 | + NS_CATEGORY => 'Category', |
| 33 | + NS_CATEGORY_TALK => 'Category_talk' |
| 34 | +); |
| 35 | + |
14 | 36 | $namespaceAliases = array( |
15 | 37 | '媒体' => NS_MEDIA, |
16 | 38 | '媒體' => NS_MEDIA, |
— | — | @@ -34,22 +56,39 @@ |
35 | 57 | '文件' => NS_FILE, |
36 | 58 | '图像对话' => NS_FILE_TALK, |
37 | 59 | '圖像對話' => NS_FILE_TALK, |
| 60 | + '图像讨论' => NS_FILE_TALK, |
| 61 | + '圖像討論' => NS_FILE_TALK, |
38 | 62 | '档案对话' => NS_FILE_TALK, |
39 | 63 | '檔案對話' => NS_FILE_TALK, |
40 | | - '文件对話' => NS_FILE_TALK, |
| 64 | + '档案讨论' => NS_FILE_TALK, |
| 65 | + '檔案討論' => NS_FILE_TALK, |
| 66 | + '文件对话' => NS_FILE_TALK, |
41 | 67 | '文件對話' => NS_FILE_TALK, |
| 68 | + '文件讨论' => NS_FILE_TALK, |
| 69 | + '文件討論' => NS_FILE_TALK, |
42 | 70 | '模板' => NS_TEMPLATE, |
43 | | - '模板讨论'=> NS_TEMPLATE_TALK, |
44 | | - "樣板" => NS_TEMPLATE, |
45 | | - "樣板討論" => NS_TEMPLATE_TALK, |
| 71 | + '样板' => NS_TEMPLATE, |
| 72 | + '樣板' => NS_TEMPLATE, |
| 73 | + '模板对话' => NS_TEMPLATE_TALK, |
| 74 | + '模板對話' => NS_TEMPLATE_TALK, |
| 75 | + '模板讨论' => NS_TEMPLATE_TALK, |
| 76 | + '模板討論' => NS_TEMPLATE_TALK, |
| 77 | + '样板对话' => NS_TEMPLATE_TALK, |
| 78 | + '樣板對話' => NS_TEMPLATE_TALK, |
| 79 | + '样板讨论' => NS_TEMPLATE_TALK, |
| 80 | + '樣板討論' => NS_TEMPLATE_TALK, |
46 | 81 | '帮助' => NS_HELP, |
47 | | - '帮助讨论'=> NS_HELP_TALK, |
48 | | - "幫助" => NS_HELP, |
49 | | - "幫助討論" => NS_HELP_TALK, |
| 82 | + '幫助' => NS_HELP, |
| 83 | + '帮助对话' => NS_HELP_TALK, |
| 84 | + '幫助對話' => NS_HELP_TALK, |
| 85 | + '帮助讨论' => NS_HELP_TALK, |
| 86 | + '幫助討論' => NS_HELP_TALK, |
50 | 87 | '分类' => NS_CATEGORY, |
| 88 | + '分類' => NS_CATEGORY, |
| 89 | + '分类对话'=> NS_CATEGORY_TALK, |
| 90 | + '分類對話' => NS_CATEGORY_TALK, |
51 | 91 | '分类讨论'=> NS_CATEGORY_TALK, |
52 | | - "分類" => NS_CATEGORY, |
53 | | - "分類討論" => NS_CATEGORY_TALK, |
| 92 | + '分類討論' => NS_CATEGORY_TALK, |
54 | 93 | ); |
55 | 94 | |
56 | 95 | $messages = array( |
Index: trunk/phase3/languages/messages/MessagesZh_hant.php |
— | — | @@ -9,37 +9,40 @@ |
10 | 10 | * @author Shinjiman |
11 | 11 | * @author Skjackey tse |
12 | 12 | * @author Wrightbus |
| 13 | + * @author Philip |
13 | 14 | */ |
14 | 15 | |
15 | 16 | $fallback = 'zh-hans'; |
16 | 17 | |
17 | 18 | $namespaceNames = array( |
18 | | - NS_MEDIA => 'Media', |
19 | | - NS_SPECIAL => 'Special', |
| 19 | + NS_MEDIA => '媒體', |
| 20 | + NS_SPECIAL => '特殊', |
20 | 21 | NS_MAIN => '', |
21 | | - NS_TALK => 'Talk', |
22 | | - NS_USER => 'User', |
23 | | - NS_USER_TALK => 'User_talk', |
| 22 | + NS_TALK => '討論', |
| 23 | + NS_USER => '用戶', |
| 24 | + NS_USER_TALK => '用戶討論', |
24 | 25 | # NS_PROJECT set by $wgMetaNamespace |
25 | | - NS_PROJECT_TALK => '$1_talk', |
26 | | - NS_FILE => 'File', |
27 | | - NS_FILE_TALK => 'File_talk', |
| 26 | + NS_PROJECT_TALK => '$1討論', |
| 27 | + NS_FILE => '檔案', |
| 28 | + NS_FILE_TALK => '檔案討論', |
28 | 29 | NS_MEDIAWIKI => 'MediaWiki', |
29 | | - NS_MEDIAWIKI_TALK => 'MediaWiki_talk', |
30 | | - NS_TEMPLATE => 'Template', |
31 | | - NS_TEMPLATE_TALK => 'Template_talk', |
32 | | - NS_HELP => 'Help', |
33 | | - NS_HELP_TALK => 'Help_talk', |
34 | | - NS_CATEGORY => 'Category', |
35 | | - NS_CATEGORY_TALK => 'Category_talk' |
| 30 | + NS_MEDIAWIKI_TALK => 'MediaWiki討論', |
| 31 | + NS_TEMPLATE => '模板', |
| 32 | + NS_TEMPLATE_TALK => '模板討論', |
| 33 | + NS_HELP => '幫助', |
| 34 | + NS_HELP_TALK => '幫助討論', |
| 35 | + NS_CATEGORY => '分類', |
| 36 | + NS_CATEGORY_TALK => '分類討論' |
36 | 37 | ); |
37 | 38 | |
38 | 39 | $namespaceAliases = array( |
39 | 40 | "媒體" => NS_MEDIA, |
40 | 41 | "特殊" => NS_SPECIAL, |
41 | 42 | "對話" => NS_TALK, |
| 43 | + "討論" => NS_USER_TALK, |
42 | 44 | "用戶" => NS_USER, |
43 | 45 | "用戶對話" => NS_USER_TALK, |
| 46 | + "用戶討論" => NS_USER_TALK, |
44 | 47 | # This has never worked so it's unlikely to annoy anyone if I disable it -- TS |
45 | 48 | #"{{SITENAME}}_對話" => NS_PROJECT_TALK |
46 | 49 | "圖像" => NS_FILE, |
— | — | @@ -48,13 +51,22 @@ |
49 | 52 | 'Image' => NS_FILE, |
50 | 53 | 'Image_talk' => NS_FILE_TALK, |
51 | 54 | "圖像對話" => NS_FILE_TALK, |
| 55 | + "圖像討論" => NS_FILE_TALK, |
52 | 56 | "檔案對話" => NS_FILE_TALK, |
| 57 | + "檔案討論" => NS_FILE_TALK, |
53 | 58 | "文件對話" => NS_FILE_TALK, |
| 59 | + "文件討論" => NS_FILE_TALK, |
54 | 60 | "樣板" => NS_TEMPLATE, |
| 61 | + "模板" => NS_TEMPLATE, |
| 62 | + "樣板對話" => NS_TEMPLATE_TALK, |
55 | 63 | "樣板討論" => NS_TEMPLATE_TALK, |
| 64 | + "模板對話" => NS_TEMPLATE_TALK, |
| 65 | + "模板討論" => NS_TEMPLATE_TALK, |
56 | 66 | "幫助" => NS_HELP, |
| 67 | + "幫助對話" => NS_HELP_TALK, |
57 | 68 | "幫助討論" => NS_HELP_TALK, |
58 | 69 | "分類" => NS_CATEGORY, |
| 70 | + "分類對話" => NS_CATEGORY_TALK, |
59 | 71 | "分類討論" => NS_CATEGORY_TALK, |
60 | 72 | ); |
61 | 73 | |
Index: trunk/phase3/languages/classes/LanguageZh.php |
— | — | @@ -34,7 +34,54 @@ |
35 | 35 | 'zh-my' => '大马', |
36 | 36 | ); |
37 | 37 | $this->mVariantNames = array_merge($this->mVariantNames,$names); |
| 38 | + $this->loadNamespaceTables(); |
38 | 39 | } |
| 40 | + |
| 41 | + function loadNamespaceTables() { |
| 42 | + global $wgMetaNamespace; |
| 43 | + $nsproject = $wgMetaNamespace; |
| 44 | + $projecttable = array( |
| 45 | + 'Wikipedia' => '维基百科', |
| 46 | + 'Wikisource' => '维基文库', |
| 47 | + 'Wikinews' => '维基新闻', |
| 48 | + 'Wiktionary' => '维基词典', |
| 49 | + 'Wikibooks' => '维基教科书', |
| 50 | + 'Wikiquote' => '维基语录', |
| 51 | + ); |
| 52 | + $this->mNamespaceTables['zh-hans'] = array( |
| 53 | + 'Media' => '媒体', |
| 54 | + 'Special' => '特殊', |
| 55 | + 'Talk' => '讨论', |
| 56 | + 'User' => '用户', |
| 57 | + 'User Talk' => '用户讨论', |
| 58 | + $nsproject |
| 59 | + => isset($projecttable[$nsproject]) ? |
| 60 | + $projecttable[$nsproject] : $nsproject, |
| 61 | + $nsproject . ' talk' |
| 62 | + => isset($projecttable[$nsproject]) ? |
| 63 | + $projecttable[$nsproject] . '讨论' : $nsproject . '讨论', |
| 64 | + 'File' => '文件', |
| 65 | + 'File talk' => '文件讨论', |
| 66 | + 'MediaWiki' => 'MediaWiki', |
| 67 | + 'MediaWiki talk' => 'MediaWiki讨论', |
| 68 | + 'Template' => '模板', |
| 69 | + 'Template talk' => '模板讨论', |
| 70 | + 'Help' => '帮助', |
| 71 | + 'Help talk' => '帮助讨论', |
| 72 | + 'Category' => '分类', |
| 73 | + 'Category talk' => '分类讨论', |
| 74 | + ); |
| 75 | + $this->mNamespaceTables['zh-hant'] = array_merge($this->mNamespaceTables['zh-hans']); |
| 76 | + $this->mNamespaceTables['zh-hant']['File'] = '檔案'; |
| 77 | + $this->mNamespaceTables['zh-hant']['File talk'] = '檔案討論'; |
| 78 | + $this->mNamespaceTables['zh'] = array_merge($this->mNamespaceTables['zh-hans']); |
| 79 | + $this->mNamespaceTables['zh-cn'] = array_merge($this->mNamespaceTables['zh-hans']); |
| 80 | + $this->mNamespaceTables['zh-hk'] = array_merge($this->mNamespaceTables['zh-hant']); |
| 81 | + $this->mNamespaceTables['zh-mo'] = array_merge($this->mNamespaceTables['zh-hant']); |
| 82 | + $this->mNamespaceTables['zh-my'] = array_merge($this->mNamespaceTables['zh-hans']); |
| 83 | + $this->mNamespaceTables['zh-sg'] = array_merge($this->mNamespaceTables['zh-hans']); |
| 84 | + $this->mNamespaceTables['zh-tw'] = array_merge($this->mNamespaceTables['zh-hant']); |
| 85 | + } |
39 | 86 | |
40 | 87 | function loadDefaultTables() { |
41 | 88 | require( dirname(__FILE__)."/../../includes/ZhConversion.php" ); |
Index: trunk/phase3/languages/LanguageConverter.php |
— | — | @@ -23,6 +23,7 @@ |
24 | 24 | var $mTables; |
25 | 25 | var $mManualAddTables; |
26 | 26 | var $mManualRemoveTables; |
| 27 | + var $mNamespaceTables; |
27 | 28 | var $mTitleDisplay=''; |
28 | 29 | var $mDoTitleConvert=true, $mDoContentConvert=true; |
29 | 30 | var $mManualLevel; // 'bidirectional' 'unidirectional' 'disable' for each variants |
— | — | @@ -89,6 +90,7 @@ |
90 | 91 | :'bidirectional'; |
91 | 92 | $this->mManualAddTables[$v] = array(); |
92 | 93 | $this->mManualRemoveTables[$v] = array(); |
| 94 | + $this->mNamespaceTables[$v] = array(); |
93 | 95 | } |
94 | 96 | } |
95 | 97 | |
— | — | @@ -425,12 +427,28 @@ |
426 | 428 | $parser->mOutput->setTitleText( $this->mTitleDisplay ); |
427 | 429 | return $text; |
428 | 430 | } |
| 431 | + |
| 432 | + /** |
| 433 | + * convert namespace |
| 434 | + * @param string $title the title included namespace |
| 435 | + * @return array of string |
| 436 | + * @private |
| 437 | + */ |
| 438 | + function convertNamespace( $title, $variant ) { |
| 439 | + $splittitle = explode( ':', $title ); |
| 440 | + if (count($splittitle) < 2) |
| 441 | + return $title; |
| 442 | + if ( isset( $this->mNamespaceTables[$variant][$splittitle[0]] ) ) |
| 443 | + $splittitle[0] = $this->mNamespaceTables[$variant][$splittitle[0]]; |
| 444 | + $ret = implode(':', $splittitle ); |
| 445 | + return $ret; |
| 446 | + } |
429 | 447 | |
430 | 448 | /** |
431 | | - * convert title |
| 449 | + * convert title |
432 | 450 | * @private |
433 | 451 | */ |
434 | | - function convertTitle( $text ){ |
| 452 | + function convertTitle( $text, $variant ){ |
435 | 453 | global $wgDisableTitleConversion, $wgUser; |
436 | 454 | |
437 | 455 | // check for global param and __NOTC__ tag |
— | — | @@ -452,7 +470,8 @@ |
453 | 471 | if ( $isredir == 'no' || $action == 'edit' || $action == 'submit' || $linkconvert == 'no' ) { |
454 | 472 | return $text; |
455 | 473 | } else { |
456 | | - $this->mTitleDisplay = $this->convert($text); |
| 474 | + $text = $this->convertNamespace( $text, $variant ); |
| 475 | + $this->mTitleDisplay = $this->convert( $text ); |
457 | 476 | return $this->mTitleDisplay; |
458 | 477 | } |
459 | 478 | } |
— | — | @@ -488,10 +507,11 @@ |
489 | 508 | if( $mw->matchStart( $text ) ) |
490 | 509 | return $text; |
491 | 510 | |
| 511 | + $plang = $this->getPreferredVariant(); |
| 512 | + |
492 | 513 | // for title convertion |
493 | | - if ( $isTitle ) return $this->convertTitle( $text ); |
| 514 | + if ( $isTitle ) return $this->convertTitle( $text, $plang ); |
494 | 515 | |
495 | | - $plang = $this->getPreferredVariant(); |
496 | 516 | $tarray = StringUtils::explode( $this->mMarkup['end'], $text ); |
497 | 517 | $text = ''; |
498 | 518 | |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -84,6 +84,8 @@ |
85 | 85 | class "mw-searchresult" |
86 | 86 | * (bug 15283) Interwiki imports can now fetch included templates |
87 | 87 | * Treat svn:// URLs as external links by default |
| 88 | +* New function to convert namespace text for display (only applies on wiki with |
| 89 | + LanguageConverter class) |
88 | 90 | |
89 | 91 | === Bug fixes in 1.15 === |
90 | 92 | * (bug 16968) Special:Upload no longer throws useless warnings. |