Index: trunk/phase3/languages/LanguageZh.php |
— | — | @@ -347,23 +347,29 @@ |
348 | 348 | $text = $this->autoConvert($tfirst); |
349 | 349 | foreach($tarray as $txt) { |
350 | 350 | $marked = explode("}-", $txt); |
351 | | - $choice = explode(";", $marked{0}); |
| 351 | + |
| 352 | + //strip since it interferes with the parsing, plus, |
| 353 | + //all spaces should be stripped in this tag anyway. |
| 354 | + $marked[0] = str_replace(' ', '', $marked[0]); |
| 355 | + |
| 356 | + $choice = explode(";", $marked[0]); |
352 | 357 | /* see if this conversion is specifically for the |
353 | | - article title |
| 358 | + article title. the format is |
| 359 | + -{T|zh-cn:foo;zh-tw:bar}- |
354 | 360 | */ |
355 | 361 | $fortitle = false; |
356 | | - $tt = explode("T|", $marked{0}, 2); |
357 | | - if(sizeof($tt) == 2) { |
| 362 | + $tt = explode("|", $marked[0], 2); |
| 363 | + if(sizeof($tt) == 2 && trim($tt[0]) == 'T') { |
358 | 364 | $choice = explode(";", $tt[1]); |
359 | 365 | $fortitle = true; |
360 | 366 | } |
361 | 367 | else { |
362 | | - $choice = explode(";", $marked{0}); |
| 368 | + $choice = explode(";", $marked[0]); |
363 | 369 | } |
364 | 370 | $disp = ''; |
365 | 371 | if(!array_key_exists(1, $choice)) { |
366 | 372 | /* a single choice */ |
367 | | - $disp = $choice{0}; |
| 373 | + $disp = $choice[0]; |
368 | 374 | } else { |
369 | 375 | $choice1=false; |
370 | 376 | $choice2=false; |
— | — | @@ -373,8 +379,8 @@ |
374 | 380 | //syntax error in the markup, give up |
375 | 381 | break; |
376 | 382 | } |
377 | | - $code = trim($v{0}); |
378 | | - $content = trim($v{1}); |
| 383 | + $code = trim($v[0]); |
| 384 | + $content = trim($v[1]); |
379 | 385 | if($code == $plang) { |
380 | 386 | $choice1 = $content; |
381 | 387 | break; |
— | — | @@ -387,7 +393,7 @@ |
388 | 394 | elseif ( $choice2 ) |
389 | 395 | $disp = $choice2; |
390 | 396 | else |
391 | | - $disp = $marked{0}; |
| 397 | + $disp = $marked[0]; |
392 | 398 | } |
393 | 399 | |
394 | 400 | if($fortitle) |
— | — | @@ -395,7 +401,7 @@ |
396 | 402 | else |
397 | 403 | $text .= $disp; |
398 | 404 | if(array_key_exists(1, $marked)) |
399 | | - $text .= $this->autoConvert($marked{1}); |
| 405 | + $text .= $this->autoConvert($marked[1]); |
400 | 406 | } |
401 | 407 | |
402 | 408 | return $text; |