Index: trunk/extensions/Babel/Babel.class.php |
— | — | @@ -9,24 +9,12 @@ |
10 | 10 | class Babel { |
11 | 11 | |
12 | 12 | /** |
13 | | - * Define the three posisble genders as constants. |
14 | | - */ |
15 | | - const GENDER_FEMALE = 1; |
16 | | - const GENDER_MALE = 2; |
17 | | - const GENDER_NEUTER = 0; |
18 | | - |
19 | | - /** |
20 | 13 | * Various values from the message cache. |
21 | 14 | */ |
22 | 15 | private $_prefixes, $_suffixes, $_cellspacing, $_directionality, $_url, |
23 | 16 | $_title, $_footer; |
24 | 17 | |
25 | 18 | /** |
26 | | - * Whether or not male, female or neuter messages should be prefered. |
27 | | - */ |
28 | | - private $_gender = self::GENDER_NEUTER; |
29 | | - |
30 | | - /** |
31 | 19 | * Array: Language codes. |
32 | 20 | */ |
33 | 21 | private $_codes; |
— | — | @@ -82,9 +70,6 @@ |
83 | 71 | // Parse the options and provide an array. |
84 | 72 | $options = $this->_parseOptions( $parameters ); |
85 | 73 | |
86 | | - // Process gender stuff. |
87 | | - $this->_setGender( $options ); |
88 | | - |
89 | 74 | // Do a link batch on all the parameters so that their information is |
90 | 75 | // cached for use later on. |
91 | 76 | $this->_doTemplateLinkBatch( $parameters ); |
— | — | @@ -267,31 +252,6 @@ |
268 | 253 | } |
269 | 254 | |
270 | 255 | /** |
271 | | - * Identify what gender has been specified within the function. |
272 | | - * |
273 | | - * @param $options Array: Options. |
274 | | - */ |
275 | | - private function _setGender( array $options ) { |
276 | | - |
277 | | - // Identify whether #female or #male have been specified as options and |
278 | | - // set gender as appropriate. |
279 | | - if( array_key_exists( 'female', $options ) ) { |
280 | | - |
281 | | - $this->_gender = self::GENDER_FEMALE; |
282 | | - |
283 | | - } elseif( array_key_exists( 'male', $options ) ) { |
284 | | - |
285 | | - $this->_gender = self::GENDER_MALE; |
286 | | - |
287 | | - } else { |
288 | | - |
289 | | - $this->_gender = self::GENDER_NEUTER; |
290 | | - |
291 | | - } |
292 | | - |
293 | | - } |
294 | | - |
295 | | - /** |
296 | 256 | * Identify whether or not the template exists or not. |
297 | 257 | * |
298 | 258 | * @param $title String: Name of the template to check. |
— | — | @@ -477,104 +437,36 @@ |
478 | 438 | */ |
479 | 439 | private function _getText( $name, $language, $level ) { |
480 | 440 | |
481 | | - // If gender not neuter then try getting the gender specific message. |
482 | | - if( $this->_gender === self::GENDER_FEMALE ) { |
| 441 | + global $wgTitle; |
483 | 442 | |
484 | | - // Try the language of the box in female. |
485 | | - $text = wfMsgExt( "babel-$level-n-female", |
486 | | - array( 'language' => $language ), |
487 | | - ":Category:{$this->_addFixes( "$language-$level",'category' )}", |
488 | | - ":Category:{$this->_addFixes( $language,'category' )}" |
489 | | - ); |
490 | | - |
491 | | - // Get the fallback message for comparison in female. |
492 | | - $fallback = wfMsgExt( "babel-$level-n-female", |
493 | | - array( 'language' => Language::getFallbackfor( $language ) ), |
494 | | - ":Category:{$this->_addFixes( "$language-$level",'category' )}", |
495 | | - ":Category:{$this->_addFixes( $language,'category' )}" |
496 | | - ); |
497 | | - |
498 | | - // Translation not found, use the generic translation of the |
499 | | - // highest level fallback possible in female. |
500 | | - if( $text == $fallback ) { |
501 | | - |
502 | | - $text = wfMsgExt( "babel-$level-female", |
503 | | - array( 'language' => $language ), |
504 | | - ":Category:{$this->_addFixes( "$language-$level",'category')}", |
505 | | - ":Category:{$this->_addFixes( $language,'category' )}", |
506 | | - $name |
507 | | - ); |
508 | | - |
509 | | - } |
510 | | - |
511 | | - // Not empty, return. |
512 | | - if( $text != '' ) { |
513 | | - |
514 | | - return $text; |
515 | | - |
516 | | - } |
517 | | - |
518 | | - } elseif( $this->_gender === self::GENDER_MALE ) { |
519 | | - |
520 | | - // Try the language of the box in male. |
521 | | - $text = wfMsgExt( "babel-$level-n-male", |
522 | | - array( 'language' => $language ), |
523 | | - ":Category:{$this->_addFixes( "$language-$level",'category' )}", |
524 | | - ":Category:{$this->_addFixes( $language,'category' )}" |
525 | | - ); |
526 | | - |
527 | | - // Get the fallback message for comparison in male. |
528 | | - $fallback = wfMsgExt( "babel-$level-n-male", |
529 | | - array( 'language' => Language::getFallbackfor( $language ) ), |
530 | | - ":Category:{$this->_addFixes( "$language-$level",'category' )}", |
531 | | - ":Category:{$this->_addFixes( $language,'category' )}" |
532 | | - ); |
533 | | - |
534 | | - // Translation not found, use the generic translation of the |
535 | | - // highest level fallback possible in male. |
536 | | - if( $text == $fallback ) { |
537 | | - |
538 | | - $text = wfMsgExt( "babel-$level-male", |
539 | | - array( 'language' => $language ), |
540 | | - ":Category:{$this->_addFixes( "$language-$level",'category')}", |
541 | | - ":Category:{$this->_addFixes( $language,'category' )}", |
542 | | - $name |
543 | | - ); |
544 | | - |
545 | | - } |
546 | | - |
547 | | - // Not empty, return. |
548 | | - if( $text != '' ) { |
549 | | - |
550 | | - return $text; |
551 | | - |
552 | | - } |
553 | | - |
554 | | - } |
555 | | - |
556 | | - // Try the language of the box. |
| 443 | + // Try the language of the box in female. |
557 | 444 | $text = wfMsgExt( "babel-$level-n", |
558 | | - array( 'language' => $language ), |
| 445 | + array( 'language' => $language, 'parsemag' ), |
559 | 446 | ":Category:{$this->_addFixes( "$language-$level",'category' )}", |
560 | | - ":Category:{$this->_addFixes( $language,'category' )}" |
| 447 | + ":Category:{$this->_addFixes( $language,'category' )}", |
| 448 | + '', |
| 449 | + $wgTitle->getDBkey() |
561 | 450 | ); |
562 | 451 | |
563 | | - // Get the fallback message for comparison. |
| 452 | + // Get the fallback message for comparison in female. |
564 | 453 | $fallback = wfMsgExt( "babel-$level-n", |
565 | | - array( 'language' => Language::getFallbackfor( $language ) ), |
| 454 | + array( 'language' => Language::getFallbackfor( $language ), 'parsemag' ), |
566 | 455 | ":Category:{$this->_addFixes( "$language-$level",'category' )}", |
567 | | - ":Category:{$this->_addFixes( $language,'category' )}" |
| 456 | + ":Category:{$this->_addFixes( $language,'category' )}", |
| 457 | + '', |
| 458 | + $wgTitle->getDBkey() |
568 | 459 | ); |
569 | 460 | |
570 | 461 | // Translation not found, use the generic translation of the |
571 | | - // highest level fallback possible. |
| 462 | + // highest level fallback possible in female. |
572 | 463 | if( $text == $fallback ) { |
573 | 464 | |
574 | 465 | $text = wfMsgExt( "babel-$level", |
575 | | - array( 'language' => $language ), |
| 466 | + array( 'language' => $language, 'parsemag' ), |
576 | 467 | ":Category:{$this->_addFixes( "$language-$level",'category')}", |
577 | 468 | ":Category:{$this->_addFixes( $language,'category' )}", |
578 | | - $name |
| 469 | + $name, |
| 470 | + $wgTitle->getDBkey() |
579 | 471 | ); |
580 | 472 | |
581 | 473 | } |
Index: trunk/extensions/Babel/Babel.i18n.php |
— | — | @@ -40,38 +40,6 @@ |
41 | 41 | 'babel-5-n' => 'This user has [[$1|professional]] knowledge of [[$2|English]].', |
42 | 42 | 'babel-N-n' => 'This user has a [[$1|native]] understanding of [[$2|English]].', |
43 | 43 | |
44 | | - 'babel-0-female' => '', # Optional. |
45 | | - 'babel-1-female' => '', # Optional. |
46 | | - 'babel-2-female' => '', # Optional. |
47 | | - 'babel-3-female' => '', # Optional. |
48 | | - 'babel-4-female' => '', # Optional. |
49 | | - 'babel-5-female' => '', # Optional. |
50 | | - 'babel-N-female' => '', # Optional. |
51 | | - |
52 | | - 'babel-0-n-female' => '', # Optional. |
53 | | - 'babel-1-n-female' => '', # Optional. |
54 | | - 'babel-2-n-female' => '', # Optional. |
55 | | - 'babel-3-n-female' => '', # Optional. |
56 | | - 'babel-4-n-female' => '', # Optional. |
57 | | - 'babel-5-n-female' => '', # Optional. |
58 | | - 'babel-N-n-female' => '', # Optional. |
59 | | - |
60 | | - 'babel-0-male' => '', # Optional. |
61 | | - 'babel-1-male' => '', # Optional. |
62 | | - 'babel-2-male' => '', # Optional. |
63 | | - 'babel-3-male' => '', # Optional. |
64 | | - 'babel-4-male' => '', # Optional. |
65 | | - 'babel-5-male' => '', # Optional. |
66 | | - 'babel-N-male' => '', # Optional. |
67 | | - |
68 | | - 'babel-0-n-male' => '', # Optional. |
69 | | - 'babel-1-n-male' => '', # Optional. |
70 | | - 'babel-2-n-male' => '', # Optional. |
71 | | - 'babel-3-n-male' => '', # Optional. |
72 | | - 'babel-4-n-male' => '', # Optional. |
73 | | - 'babel-5-n-male' => '', # Optional. |
74 | | - 'babel-N-n-male' => '', # Optional. |
75 | | - |
76 | 44 | 'babel-box-cellspacing' => '0', # Do not translate or duplicate this message to other languages. |
77 | 45 | |
78 | 46 | 'babel-category-prefix' => '', # Do not translate or duplicate this message to other languages. |