r23981 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23980‎ | r23981 | r23982 >
Date:22:36, 10 July 2007
Author:sanbeg
Status:old
Tags:
Comment:
First crack at German translation; corrrect me if I'm wrong (& add Heberw if you know it)
Modified paths:
  • /trunk/extensions/LabeledSectionTransclusion/lst.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LabeledSectionTransclusion/lst.php
@@ -42,8 +42,24 @@
4343
4444 /// Add the magic words - possibly with more readable aliases
4545 function wfLabeledSectionTransclusionMagic( &$magicWords, $langCode ) {
46 - $magicWords['lst'] = array( 0, 'lst', 'section' );
47 - $magicWords['lstx'] = array( 0, 'lstx', 'section-x' );
 46+ global $wgParser, $wgLstLocal;
 47+
 48+ switch ($langCode) {
 49+ case 'de':
 50+ $include = 'steil';
 51+ $exclude = 'steil-x';
 52+ $wgLstLocal=array('section'=>'steil', 'begin'=>'anfang', 'end'=>'ende');
 53+ }
 54+
 55+ if (isset($include)) {
 56+ $magicWords['lst'] = array( 0, 'lst', 'section', $include );
 57+ $magicWords['lstx'] = array( 0, 'lstx', 'section-x', $exclude );
 58+ $wgParser->setHook( $include, 'wfLstNoop' );
 59+ } else {
 60+ $magicWords['lst'] = array( 0, 'lst', 'section' );
 61+ $magicWords['lstx'] = array( 0, 'lstx', 'section-x' );
 62+ }
 63+
4864 return true;
4965 }
5066
@@ -141,13 +157,25 @@
142158 */
143159 function wfLst_pat_($sec, $to)
144160 {
 161+ global $wgLstLocal;
 162+
145163 $to_sec = ($to == '')?$sec : $to;
146164 $sec = preg_quote($sec, '/');
147165 $to_sec = preg_quote($to_sec, '/');
148166 $ws="(?:\s+[^>]+)?"; //was like $ws="\s*"
149 - return "/<section$ws\s+(?i:begin)=".
 167+ if (isset($wgLstLocal)){
 168+ $begin="(?i:begin|$wgLstLocal[begin])";
 169+ $end="(?i:end|$wgLstLocal[end])";
 170+ $section_re = "(?:section|$wgLstLocal[section])";
 171+ } else {
 172+ $begin="(?i:begin)";
 173+ $end="(?i:end)";
 174+ $section_re = "section";
 175+ }
 176+
 177+ return "/<$section_re$ws\s+$begin=".
150178 "(?:$sec|\"$sec\"|'$sec')".
151 - "$ws\/?>(.*?)\n?<section$ws\s+(?:[^>]+\s+)?(?i:end)=".
 179+ "$ws\/?>(.*?)\n?<$section_re$ws\s+(?:[^>]+\s+)?$end=".
152180 "(?:$to_sec|\"$to_sec\"|'$to_sec')".
153181 "$ws\/?>/s";
154182 }

Status & tagging log