Index: trunk/phase3/languages/LanguageConverter.php |
— | — | @@ -219,9 +219,9 @@ |
220 | 220 | 3. place holders created by the parser |
221 | 221 | */ |
222 | 222 | global $wgParser; |
223 | | - if (isset($wgParser) && $wgParser->UniqPrefix()!='') |
| 223 | + if (isset($wgParser) && $wgParser->UniqPrefix()!=''){ |
224 | 224 | $marker = '|' . $wgParser->UniqPrefix() . '[\-a-zA-Z0-9]+'; |
225 | | - else |
| 225 | + } else |
226 | 226 | $marker = ""; |
227 | 227 | |
228 | 228 | // this one is needed when the text is inside an html markup |
— | — | @@ -231,8 +231,10 @@ |
232 | 232 | $codefix = '<code>.+?<\/code>|'; |
233 | 233 | // disable convertsion of <script type="text/javascript"> ... </script> |
234 | 234 | $scriptfix = '<script.*?>.*?<\/script>|'; |
| 235 | + // disable conversion of <pre xxxx> ... </pre> |
| 236 | + $prefix = '<pre.*?>.*?<\/pre>|'; |
235 | 237 | |
236 | | - $reg = '/'.$codefix . $scriptfix . '<[^>]+>|&[a-zA-Z#][a-z0-9]+;' . $marker . $htmlfix . '/s'; |
| 238 | + $reg = '/'.$codefix . $scriptfix . $prefix . '<[^>]+>|&[a-zA-Z#][a-z0-9]+;' . $marker . $htmlfix . '/s'; |
237 | 239 | |
238 | 240 | $matches = preg_split($reg, $text, -1, PREG_SPLIT_OFFSET_CAPTURE); |
239 | 241 | |
— | — | @@ -256,6 +258,7 @@ |
257 | 259 | * @param string $text Text to convert |
258 | 260 | * @param string $variant Variant language code |
259 | 261 | * @return string Translated text |
| 262 | + * @private |
260 | 263 | */ |
261 | 264 | function translate( $text, $variant ) { |
262 | 265 | wfProfileIn( __METHOD__ ); |
— | — | @@ -323,6 +326,7 @@ |
324 | 327 | |
325 | 328 | /** |
326 | 329 | * Convert text using a parser object for context |
| 330 | + * @public |
327 | 331 | */ |
328 | 332 | function parserConvert( $text, &$parser ) { |
329 | 333 | global $wgDisableLangConversion; |
— | — | @@ -343,7 +347,7 @@ |
344 | 348 | |
345 | 349 | /** |
346 | 350 | * Parse flags with syntax -{FLAG| ... }- |
347 | | - * |
| 351 | + * @private |
348 | 352 | */ |
349 | 353 | function parseFlags($marked){ |
350 | 354 | $flags = array(); |
— | — | @@ -400,17 +404,19 @@ |
401 | 405 | } |
402 | 406 | if ( count($flags)==0 ) |
403 | 407 | $flags = array('S'); |
404 | | - |
405 | 408 | return array($rules,$flags); |
406 | 409 | } |
407 | 410 | |
| 411 | + /** |
| 412 | + * @private |
| 413 | + */ |
408 | 414 | function getRulesDesc($bidtable,$unidtable){ |
409 | 415 | $text=''; |
410 | 416 | foreach($bidtable as $k => $v) |
411 | 417 | $text .= $this->mVariantNames[$k].':'.$v.';'; |
412 | 418 | foreach($unidtable as $k => $a) |
413 | 419 | foreach($a as $from=>$to) |
414 | | - $text.=$from.'⇒'.$this->mVariantNames[$k].':'.$to.';'; |
| 420 | + $text.=$from.'⇁E.$this->mVariantNames[$k].':'.$to.';'; |
415 | 421 | return $text; |
416 | 422 | } |
417 | 423 | |
— | — | @@ -474,8 +480,9 @@ |
475 | 481 | // proces H,- flag or T only: output nothing |
476 | 482 | $disp = ''; |
477 | 483 | } elseif ( in_array('S',$flags) ){ |
478 | | - // the text converted |
479 | | - if($doConvert){ |
| 484 | + if( count($bidtable) + count($unidtable) == 0 ){ |
| 485 | + $disp = $rules; |
| 486 | + } elseif ($doConvert){// the text converted |
480 | 487 | // display current variant in bidirectional array |
481 | 488 | $disp = $this->getTextInCArray($variant,$bidtable); |
482 | 489 | // or display current variant in fallbacks |
— | — | @@ -495,7 +502,7 @@ |
496 | 503 | $disp = array_values($unidtable); |
497 | 504 | $disp = array_values($disp[0]); |
498 | 505 | $disp = $disp[0]; |
499 | | - } |
| 506 | + } |
500 | 507 | } |
501 | 508 | } else {// no convert |
502 | 509 | $disp = $rules; |
— | — | @@ -510,7 +517,10 @@ |
511 | 518 | return $disp; |
512 | 519 | } |
513 | 520 | |
514 | | - function applyManualFlag($flags,$bidtable,$unidtable,$variant=false){ |
| 521 | + /** |
| 522 | + * @access private |
| 523 | + */ |
| 524 | + function applyManualFlag($rules,$flags,$bidtable,$unidtable,$variant=false){ |
515 | 525 | if(!$variant) $variant = $this->getPreferredVariant(); |
516 | 526 | |
517 | 527 | $is_title_flag = in_array('T', $flags); |
— | — | @@ -582,11 +592,15 @@ |
583 | 593 | $bidtable,$unidtable, |
584 | 594 | $variant, |
585 | 595 | $this->mDoContentConvert); |
586 | | - $this->applyManualFlag($flags,$bidtable,$unidtable); |
| 596 | + $this->applyManualFlag($rules,$flags,$bidtable,$unidtable); |
587 | 597 | |
588 | 598 | return $disp; |
589 | 599 | } |
590 | 600 | |
| 601 | + /** |
| 602 | + * convert title |
| 603 | + * @private |
| 604 | + */ |
591 | 605 | function convertTitle($text){ |
592 | 606 | // check for __NOTC__ tag |
593 | 607 | if( !$this->mDoTitleConvert ) { |
— | — | @@ -931,6 +945,7 @@ |
932 | 946 | * |
933 | 947 | * @param string $text text to be tagged for no conversion |
934 | 948 | * @return string the tagged text |
| 949 | + * @public |
935 | 950 | */ |
936 | 951 | function markNoConversion($text, $noParse=false) { |
937 | 952 | # don't mark if already marked |
— | — | @@ -972,6 +987,7 @@ |
973 | 988 | /** |
974 | 989 | * Armour rendered math against conversion |
975 | 990 | * Wrap math into rawoutput -{R| math }- syntax |
| 991 | + * @public |
976 | 992 | */ |
977 | 993 | function armourMath($text){ |
978 | 994 | $ret = $this->mMarkup['begin'] . 'R|' . $text . $this->mMarkup['end']; |
Index: trunk/phase3/languages/messages/MessagesZh_hans.php |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | <?php |
3 | | -/** Simplified Chinese (中文(简体)) |
| 3 | +/** Chinese (Simplified) (中文 (简化字)) |
4 | 4 | * |
5 | 5 | * @ingroup Language |
6 | 6 | * @file |
Index: trunk/phase3/languages/messages/MessagesZh_hant.php |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | <?php |
3 | | -/** Traditional Chinese (中文(繁體)) |
| 3 | +/** Traditional Chinese (中文(傳統字)) |
4 | 4 | * |
5 | 5 | * @ingroup Language |
6 | 6 | * @file |
Index: trunk/phase3/languages/messages/MessagesZh_tw.php |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | <?php |
3 | | -/** Taiwan Chinese (中文(台灣)) |
| 3 | +/** Chinese (Taiwan) (中文(台灣)) |
4 | 4 | * |
5 | 5 | * @ingroup Language |
6 | 6 | * @file |