Index: trunk/phase3/languages/LanguageConverter.php |
— | — | @@ -487,10 +487,11 @@ |
488 | 488 | * |
489 | 489 | * @param string $text text to be converted |
490 | 490 | * @param bool $isTitle whether this conversion is for the article title |
| 491 | + * @param string $variant the variant we convert to |
491 | 492 | * @return string converted text |
492 | 493 | * @public |
493 | 494 | */ |
494 | | - function convert( $text, $isTitle = false ) { |
| 495 | + function convert( $text, $isTitle = false, $variant = none ) { |
495 | 496 | |
496 | 497 | $mw =& MagicWord::get( 'notitleconvert' ); |
497 | 498 | if( $mw->matchAndRemove( $text ) ) |
— | — | @@ -505,7 +506,10 @@ |
506 | 507 | if( $mw->matchStart( $text ) ) |
507 | 508 | return $text; |
508 | 509 | |
509 | | - $plang = $this->getPreferredVariant(); |
| 510 | + if( $variant && in_array( $variant, $this->mVariants ) ) |
| 511 | + $plang = $variant; |
| 512 | + else |
| 513 | + $plang = $this->getPreferredVariant(); |
510 | 514 | |
511 | 515 | // for title convertion |
512 | 516 | if ( $isTitle ) return $this->convertTitle( $text, $plang ); |
Index: trunk/phase3/languages/Language.php |
— | — | @@ -35,7 +35,7 @@ |
36 | 36 | class FakeConverter { |
37 | 37 | var $mLang; |
38 | 38 | function FakeConverter($langobj) {$this->mLang = $langobj;} |
39 | | - function convert($t, $i) {return $t;} |
| 39 | + function convert($t, $i, $v) {return $t;} |
40 | 40 | function parserConvert($t, $p) {return $t;} |
41 | 41 | function getVariants() { return array( $this->mLang->getCode() ); } |
42 | 42 | function getPreferredVariant() {return $this->mLang->getCode(); } |
— | — | @@ -2183,8 +2183,8 @@ |
2184 | 2184 | } |
2185 | 2185 | |
2186 | 2186 | # convert text to different variants of a language. |
2187 | | - function convert( $text, $isTitle = false) { |
2188 | | - return $this->mConverter->convert($text, $isTitle); |
| 2187 | + function convert( $text, $isTitle = false, $variant = none) { |
| 2188 | + return $this->mConverter->convert($text, $isTitle, $variant); |
2189 | 2189 | } |
2190 | 2190 | |
2191 | 2191 | # Convert text from within Parser |