Index: trunk/phase3/languages/LanguageConverter.php |
— | — | @@ -79,7 +79,7 @@ |
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
83 | | - * @access public |
| 83 | + * @public |
84 | 84 | */ |
85 | 85 | function getVariants() { |
86 | 86 | return $this->mVariants; |
— | — | @@ -107,7 +107,7 @@ |
108 | 108 | * get preferred language variants. |
109 | 109 | * @param boolean $fromUser Get it from $wgUser's preferences |
110 | 110 | * @return string the preferred language code |
111 | | - * @access public |
| 111 | + * @public |
112 | 112 | */ |
113 | 113 | function getPreferredVariant( $fromUser = true ) { |
114 | 114 | global $wgUser, $wgRequest, $wgVariantArticlePath, $wgDefaultLanguageVariant; |
— | — | @@ -325,7 +325,7 @@ |
326 | 326 | } |
327 | 327 | |
328 | 328 | /** |
329 | | - * @access private |
| 329 | + * @private |
330 | 330 | */ |
331 | 331 | function applyManualConv($convRule,$variant){ |
332 | 332 | if(!$variant) $variant = $this->getPreferredVariant(); |
— | — | @@ -337,7 +337,7 @@ |
338 | 338 | // use syntax -{T|zh:TitleZh;zh-tw:TitleTw}- for custom conversion in title |
339 | 339 | if($is_title_flag){ |
340 | 340 | $this->mTitleFromFlag = true; |
341 | | - $this->mTitleDisplay = $convRule->getRulesTitle(); |
| 341 | + $this->mTitleDisplay = $convRule->getTitle(); |
342 | 342 | } |
343 | 343 | |
344 | 344 | if($this->mManualLevel[$variant]=='disable') return; |
— | — | @@ -426,7 +426,7 @@ |
427 | 427 | * @param string $text text to be converted |
428 | 428 | * @param bool $isTitle whether this conversion is for the article title |
429 | 429 | * @return string converted text |
430 | | - * @access public |
| 430 | + * @public |
431 | 431 | */ |
432 | 432 | function convert( $text , $isTitle=false) { |
433 | 433 | |
— | — | @@ -463,10 +463,10 @@ |
464 | 464 | $this->mVariantNames, |
465 | 465 | $this->mDoContentConvert, |
466 | 466 | $this->mDoTitleConvert); |
467 | | - $crule->parseRules($plang, |
| 467 | + $crule->parse($plang, |
468 | 468 | $this->getVariantFallbacks($plang), |
469 | 469 | $this->mManualLevel[$plang]=='disable'); |
470 | | - $text .= $crule->getRulesDisplay(); |
| 470 | + $text .= $crule->getDisplay(); |
471 | 471 | $this->applyManualConv($crule,$plang); |
472 | 472 | |
473 | 473 | if(array_key_exists(1, $marked)){ |
— | — | @@ -489,7 +489,7 @@ |
490 | 490 | * @param string $link the name of the link |
491 | 491 | * @param mixed $nt the title object of the link |
492 | 492 | * @return null the input parameters may be modified upon return |
493 | | - * @access public |
| 493 | + * @public |
494 | 494 | */ |
495 | 495 | function findVariantLink( &$link, &$nt ) { |
496 | 496 | global $wgDisableLangConversion; |
— | — | @@ -532,7 +532,7 @@ |
533 | 533 | /** |
534 | 534 | * returns language specific hash options |
535 | 535 | * |
536 | | - * @access public |
| 536 | + * @public |
537 | 537 | */ |
538 | 538 | function getExtraHashOptions() { |
539 | 539 | $variant = $this->getPreferredVariant(); |
— | — | @@ -542,7 +542,7 @@ |
543 | 543 | /** |
544 | 544 | * get title text as defined in the body of the article text |
545 | 545 | * |
546 | | - * @access public |
| 546 | + * @public |
547 | 547 | */ |
548 | 548 | function getParsedTitle() { |
549 | 549 | return $this->mTitleDisplay; |
— | — | @@ -799,6 +799,7 @@ |
800 | 800 | } |
801 | 801 | |
802 | 802 | /** |
| 803 | + * parser for rules of language conversion , parse rules in -{ }- tag |
803 | 804 | * @ingroup Language |
804 | 805 | * @author fdcn <fdcn64@gmail.com> |
805 | 806 | */ |
— | — | @@ -860,16 +861,14 @@ |
861 | 862 | * @private |
862 | 863 | */ |
863 | 864 | function parseFlags(){ |
864 | | - $flags = array(); |
865 | 865 | $text = $this->mText; |
866 | | - |
867 | | - // for multi-FLAGs |
868 | 866 | if(strlen($text) < 2 ) { |
869 | 867 | $this->flags = array( 'R' ); |
870 | 868 | $this->rules = $text; |
871 | 869 | return; |
872 | 870 | } |
873 | 871 | |
| 872 | + $flags = array(); |
874 | 873 | $tt = explode($this->mMarkup['flagsep'], $text, 2); |
875 | 874 | |
876 | 875 | if(count($tt) == 2) { |
— | — | @@ -1007,11 +1006,12 @@ |
1008 | 1007 | return $this->rules; |
1009 | 1008 | } |
1010 | 1009 | } |
| 1010 | + |
1011 | 1011 | /** |
1012 | 1012 | * Parse rules and flags |
1013 | 1013 | * @public |
1014 | 1014 | */ |
1015 | | - function parseRules($variant,$variantFallbacks,$isMCDisable=false){ |
| 1015 | + function parse($variant,$variantFallbacks,$isMCDisable=false){ |
1016 | 1016 | $this->parseFlags(); |
1017 | 1017 | $this->generateConvTable(); |
1018 | 1018 | |
— | — | @@ -1021,7 +1021,7 @@ |
1022 | 1022 | if(count($this->bidtable)==0 && count($this->unidtable)==0 |
1023 | 1023 | && !in_array('N',$flags) && !in_array('T',$flags) ) |
1024 | 1024 | { |
1025 | | - $flags = array('R'); |
| 1025 | + $this->flags = $flags = array('R'); |
1026 | 1026 | } |
1027 | 1027 | |
1028 | 1028 | if( in_array('R',$flags) ) { |
— | — | @@ -1056,7 +1056,7 @@ |
1057 | 1057 | * @param string $variant the current variant |
1058 | 1058 | * @public |
1059 | 1059 | */ |
1060 | | - function getRulesDisplay(){ |
| 1060 | + function getDisplay(){ |
1061 | 1061 | return $this->ruleDisplay; |
1062 | 1062 | } |
1063 | 1063 | /** |
— | — | @@ -1064,7 +1064,7 @@ |
1065 | 1065 | * @param string $variant the current variant |
1066 | 1066 | * @public |
1067 | 1067 | */ |
1068 | | - function getRulesTitle(){ |
| 1068 | + function getTitle(){ |
1069 | 1069 | return $this->ruleTitle; |
1070 | 1070 | } |
1071 | 1071 | |
Index: trunk/phase3/languages/messages/MessagesZh.php |
— | — | @@ -10,6 +10,41 @@ |
11 | 11 | |
12 | 12 | $fallback = 'zh-hans'; |
13 | 13 | |
| 14 | +$namespaceAliases = array( |
| 15 | + '媒体' => NS_MEDIA, |
| 16 | + '媒體' => NS_MEDIA, |
| 17 | + '特殊' => NS_SPECIAL, |
| 18 | + '对话' => NS_TALK, |
| 19 | + '對話' => NS_TALK, |
| 20 | + '讨论' => NS_TALK, |
| 21 | + '討論' => NS_TALK, |
| 22 | + '用户' => NS_USER, |
| 23 | + '用戶' => NS_USER, |
| 24 | + '用户对话' => NS_USER_TALK, |
| 25 | + '用戶對話' => NS_USER_TALK, |
| 26 | + '用户讨论' => NS_USER_TALK, |
| 27 | + '用戶討論' => NS_USER_TALK, |
| 28 | + # This has never worked so it's unlikely to annoy anyone if I disable it -- TS |
| 29 | + #'{{SITENAME}}_对话' => NS_PROJECT_TALK |
| 30 | + #"{{SITENAME}}_對話" => NS_PROJECT_TALK |
| 31 | + '图像' => NS_IMAGE, |
| 32 | + '圖像' => NS_IMAGE, |
| 33 | + '图像对话' => NS_IMAGE_TALK, |
| 34 | + '圖像對話' => NS_IMAGE_TALK, |
| 35 | + '模板' => NS_TEMPLATE, |
| 36 | + '模板讨论'=> NS_TEMPLATE_TALK, |
| 37 | + "樣板" => NS_TEMPLATE, |
| 38 | + "樣板討論" => NS_TEMPLATE_TALK, |
| 39 | + '帮助' => NS_HELP, |
| 40 | + '帮助讨论'=> NS_HELP_TALK, |
| 41 | + "幫助" => NS_HELP, |
| 42 | + "幫助討論" => NS_HELP_TALK, |
| 43 | + '分类' => NS_CATEGORY, |
| 44 | + '分类讨论'=> NS_CATEGORY_TALK, |
| 45 | + "分類" => NS_CATEGORY, |
| 46 | + "分類討論" => NS_CATEGORY_TALK, |
| 47 | +); |
| 48 | + |
14 | 49 | $messages = array( |
15 | 50 | /* |
16 | 51 | Short names for language variants used for language conversion links. |