r48043 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r48042‎ | r48043 | r48044 >
Date:02:44, 5 March 2009
Author:philip
Status:ok
Tags:
Comment:
varsep split pattern improve for unidirectional conversion. (LanguageConverter.php)
Modified paths:
  • /trunk/phase3/languages/LanguageConverter.php (modified) (history)

Diff [purge]

Index: trunk/phase3/languages/LanguageConverter.php
@@ -1013,11 +1013,15 @@
10141014 // [2] => ''
10151015 // )
10161016 $varsep_pattern = '/' . $markup['varsep'] . '\s*' . '(?=';
1017 - foreach( $variants as $variant )
1018 - $varsep_pattern .= $variant . '\s*' . $markup['codesep'] . '|';
 1017+ foreach( $variants as $variant ) {
 1018+ $varsep_pattern .= $variant . '\s*' . $markup['codesep'] . '|'; // zh-hans:xxx;zh-hant:yyy
 1019+ $varsep_pattern .= '[^;]*?' . $markup['unidsep'] . '\s*' . $variant
 1020+ . '\s*' . $markup['codesep'] . '|'; // xxx=>zh-hans:yyy; xxx=>zh-hant:zzz
 1021+ }
10191022 $varsep_pattern .= '\s*$)/';
10201023
10211024 $choice = preg_split($varsep_pattern, $rules);
 1025+
10221026 foreach( $choice as $c ) {
10231027 $v = explode($markup['codesep'], $c, 2);
10241028 if( count($v) != 2 )

Status & tagging log