Merge "Suppress section edit links with action=render"
[lhc/web/wiklou.git] / maintenance / language / languages.inc
1 <?php
2 /**
3 * Handle messages in the language files.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
19 *
20 * @file
21 * @ingroup MaintenanceLanguage
22 */
23
24 /**
25 * @ingroup MaintenanceLanguage
26 */
27 class languages {
28 protected $mLanguages; # List of languages
29
30 protected $mRawMessages; # Raw list of the messages in each language
31 protected $mMessages; # Messages in each language (except for English), divided to groups
32 protected $mFallback; # Fallback language in each language
33 protected $mGeneralMessages; # General messages in English, divided to groups
34 protected $mIgnoredMessages; # All the messages which should be exist only in the English file
35 protected $mOptionalMessages; # All the messages which may be translated or not, depending on the language
36
37 protected $mNamespaceNames; # Namespace names
38 protected $mNamespaceAliases; # Namespace aliases
39 protected $mMagicWords; # Magic words
40 protected $mSpecialPageAliases; # Special page aliases
41
42 /**
43 * Load the list of languages: all the Messages*.php
44 * files in the languages directory.
45 *
46 * @param $exif bool Treat the Exif messages?
47 */
48 function __construct( $exif = true ) {
49 require __DIR__ . '/messageTypes.inc';
50 $this->mIgnoredMessages = $wgIgnoredMessages;
51 if ( $exif ) {
52 $this->mOptionalMessages = array_merge( $wgOptionalMessages );
53 } else {
54 $this->mOptionalMessages = array_merge( $wgOptionalMessages, $wgEXIFMessages );
55 }
56
57 $this->mLanguages = array_keys( Language::fetchLanguageNames( null, 'mwfile' ) );
58 sort( $this->mLanguages );
59 }
60
61 /**
62 * Get the language list.
63 *
64 * @return array The language list.
65 */
66 public function getLanguages() {
67 return $this->mLanguages;
68 }
69
70 /**
71 * Get the ignored messages list.
72 *
73 * @return array The ignored messages list.
74 */
75 public function getIgnoredMessages() {
76 return $this->mIgnoredMessages;
77 }
78
79 /**
80 * Get the optional messages list.
81 *
82 * @return array The optional messages list.
83 */
84 public function getOptionalMessages() {
85 return $this->mOptionalMessages;
86 }
87
88 /**
89 * Load the language file.
90 *
91 * @param $code string The language code.
92 */
93 protected function loadFile( $code ) {
94 if ( isset( $this->mRawMessages[$code] ) &&
95 isset( $this->mFallback[$code] ) &&
96 isset( $this->mNamespaceNames[$code] ) &&
97 isset( $this->mNamespaceAliases[$code] ) &&
98 isset( $this->mMagicWords[$code] ) &&
99 isset( $this->mSpecialPageAliases[$code] )
100 ) {
101 return;
102 }
103 $this->mRawMessages[$code] = array();
104 $this->mFallback[$code] = '';
105 $this->mNamespaceNames[$code] = array();
106 $this->mNamespaceAliases[$code] = array();
107 $this->mMagicWords[$code] = array();
108 $this->mSpecialPageAliases[$code] = array();
109 $filename = Language::getMessagesFileName( $code );
110 if ( file_exists( $filename ) ) {
111 require $filename;
112 if ( isset( $messages ) ) {
113 $this->mRawMessages[$code] = $messages;
114 }
115 if ( isset( $fallback ) ) {
116 $this->mFallback[$code] = $fallback;
117 }
118 if ( isset( $namespaceNames ) ) {
119 $this->mNamespaceNames[$code] = $namespaceNames;
120 }
121 if ( isset( $namespaceAliases ) ) {
122 $this->mNamespaceAliases[$code] = $namespaceAliases;
123 }
124 if ( isset( $magicWords ) ) {
125 $this->mMagicWords[$code] = $magicWords;
126 }
127 if ( isset( $specialPageAliases ) ) {
128 $this->mSpecialPageAliases[$code] = $specialPageAliases;
129 }
130 }
131 }
132
133 /**
134 * Load the messages for a specific language (which is not English) and divide them to groups:
135 * all - all the messages.
136 * required - messages which should be translated in order to get a complete translation.
137 * optional - messages which can be translated, the fallback translation is used if not translated.
138 * obsolete - messages which should not be translated, either because they do not exist, or they are ignored messages.
139 * translated - messages which are either required or optional, but translated from English and needed.
140 *
141 * @param $code string The language code.
142 */
143 private function loadMessages( $code ) {
144 if ( isset( $this->mMessages[$code] ) ) {
145 return;
146 }
147 $this->loadFile( $code );
148 $this->loadGeneralMessages();
149 $this->mMessages[$code]['all'] = $this->mRawMessages[$code];
150 $this->mMessages[$code]['required'] = array();
151 $this->mMessages[$code]['optional'] = array();
152 $this->mMessages[$code]['obsolete'] = array();
153 $this->mMessages[$code]['translated'] = array();
154 foreach ( $this->mMessages[$code]['all'] as $key => $value ) {
155 if ( isset( $this->mGeneralMessages['required'][$key] ) ) {
156 $this->mMessages[$code]['required'][$key] = $value;
157 $this->mMessages[$code]['translated'][$key] = $value;
158 } elseif ( isset( $this->mGeneralMessages['optional'][$key] ) ) {
159 $this->mMessages[$code]['optional'][$key] = $value;
160 $this->mMessages[$code]['translated'][$key] = $value;
161 } else {
162 $this->mMessages[$code]['obsolete'][$key] = $value;
163 }
164 }
165 }
166
167 /**
168 * Load the messages for English and divide them to groups:
169 * all - all the messages.
170 * required - messages which should be translated to other languages in order to get a complete translation.
171 * optional - messages which can be translated to other languages, but it's not required for a complete translation.
172 * ignored - messages which should not be translated to other languages.
173 * translatable - messages which are either required or optional, but can be translated from English.
174 */
175 private function loadGeneralMessages() {
176 if ( isset( $this->mGeneralMessages ) ) {
177 return;
178 }
179 $this->loadFile( 'en' );
180 $this->mGeneralMessages['all'] = $this->mRawMessages['en'];
181 $this->mGeneralMessages['required'] = array();
182 $this->mGeneralMessages['optional'] = array();
183 $this->mGeneralMessages['ignored'] = array();
184 $this->mGeneralMessages['translatable'] = array();
185 foreach ( $this->mGeneralMessages['all'] as $key => $value ) {
186 if ( in_array( $key, $this->mIgnoredMessages ) ) {
187 $this->mGeneralMessages['ignored'][$key] = $value;
188 } elseif ( in_array( $key, $this->mOptionalMessages ) ) {
189 $this->mGeneralMessages['optional'][$key] = $value;
190 $this->mGeneralMessages['translatable'][$key] = $value;
191 } else {
192 $this->mGeneralMessages['required'][$key] = $value;
193 $this->mGeneralMessages['translatable'][$key] = $value;
194 }
195 }
196 }
197
198 /**
199 * Get all the messages for a specific language (not English), without the
200 * fallback language messages, divided to groups:
201 * all - all the messages.
202 * required - messages which should be translated in order to get a complete translation.
203 * optional - messages which can be translated, the fallback translation is used if not translated.
204 * obsolete - messages which should not be translated, either because they do not exist, or they are ignored messages.
205 * translated - messages which are either required or optional, but translated from English and needed.
206 *
207 * @param $code string The language code.
208 *
209 * @return string The messages in this language.
210 */
211 public function getMessages( $code ) {
212 $this->loadMessages( $code );
213
214 return $this->mMessages[$code];
215 }
216
217 /**
218 * Get all the general English messages, divided to groups:
219 * all - all the messages.
220 * required - messages which should be translated to other languages in order to get a complete translation.
221 * optional - messages which can be translated to other languages, but it's not required for a complete translation.
222 * ignored - messages which should not be translated to other languages.
223 * translatable - messages which are either required or optional, but can be translated from English.
224 *
225 * @return array The general English messages.
226 */
227 public function getGeneralMessages() {
228 $this->loadGeneralMessages();
229
230 return $this->mGeneralMessages;
231 }
232
233 /**
234 * Get fallback language code for a specific language.
235 *
236 * @param $code string The language code.
237 *
238 * @return string Fallback code.
239 */
240 public function getFallback( $code ) {
241 $this->loadFile( $code );
242
243 return $this->mFallback[$code];
244 }
245
246 /**
247 * Get namespace names for a specific language.
248 *
249 * @param $code string The language code.
250 *
251 * @return array Namespace names.
252 */
253 public function getNamespaceNames( $code ) {
254 $this->loadFile( $code );
255
256 return $this->mNamespaceNames[$code];
257 }
258
259 /**
260 * Get namespace aliases for a specific language.
261 *
262 * @param $code string The language code.
263 *
264 * @return array Namespace aliases.
265 */
266 public function getNamespaceAliases( $code ) {
267 $this->loadFile( $code );
268
269 return $this->mNamespaceAliases[$code];
270 }
271
272 /**
273 * Get magic words for a specific language.
274 *
275 * @param $code string The language code.
276 *
277 * @return array Magic words.
278 */
279 public function getMagicWords( $code ) {
280 $this->loadFile( $code );
281
282 return $this->mMagicWords[$code];
283 }
284
285 /**
286 * Get special page aliases for a specific language.
287 *
288 * @param $code string The language code.
289 *
290 * @return array Special page aliases.
291 */
292 public function getSpecialPageAliases( $code ) {
293 $this->loadFile( $code );
294
295 return $this->mSpecialPageAliases[$code];
296 }
297
298 /**
299 * Get the untranslated messages for a specific language.
300 *
301 * @param $code string The language code.
302 *
303 * @return array The untranslated messages for this language.
304 */
305 public function getUntranslatedMessages( $code ) {
306 $this->loadGeneralMessages();
307 $this->loadMessages( $code );
308
309 return array_diff_key( $this->mGeneralMessages['required'], $this->mMessages[$code]['required'] );
310 }
311
312 /**
313 * Get the duplicate messages for a specific language.
314 *
315 * @param $code string The language code.
316 *
317 * @return array The duplicate messages for this language.
318 */
319 public function getDuplicateMessages( $code ) {
320 $this->loadGeneralMessages();
321 $this->loadMessages( $code );
322 $duplicateMessages = array();
323 foreach ( $this->mMessages[$code]['translated'] as $key => $value ) {
324 if ( $this->mGeneralMessages['translatable'][$key] == $value ) {
325 $duplicateMessages[$key] = $value;
326 }
327 }
328
329 return $duplicateMessages;
330 }
331
332 /**
333 * Get the obsolete messages for a specific language.
334 *
335 * @param $code string The language code.
336 *
337 * @return array The obsolete messages for this language.
338 */
339 public function getObsoleteMessages( $code ) {
340 $this->loadGeneralMessages();
341 $this->loadMessages( $code );
342
343 return $this->mMessages[$code]['obsolete'];
344 }
345
346 /**
347 * Get the messages whose variables do not match the original ones.
348 *
349 * @param $code string The language code.
350 *
351 * @return array The messages whose variables do not match the original ones.
352 */
353 public function getMessagesWithMismatchVariables( $code ) {
354 $this->loadGeneralMessages();
355 $this->loadMessages( $code );
356 $variables = array( '\$1', '\$2', '\$3', '\$4', '\$5', '\$6', '\$7', '\$8', '\$9' );
357 $mismatchMessages = array();
358 foreach ( $this->mMessages[$code]['translated'] as $key => $value ) {
359 $missing = false;
360 foreach ( $variables as $var ) {
361 if ( preg_match( "/$var/sU", $this->mGeneralMessages['translatable'][$key] ) &&
362 !preg_match( "/$var/sU", $value )
363 ) {
364 $missing = true;
365 }
366 if ( !preg_match( "/$var/sU", $this->mGeneralMessages['translatable'][$key] ) &&
367 preg_match( "/$var/sU", $value )
368 ) {
369 $missing = true;
370 }
371 }
372 if ( $missing ) {
373 $mismatchMessages[$key] = $value;
374 }
375 }
376
377 return $mismatchMessages;
378 }
379
380 /**
381 * Get the messages which do not use plural.
382 *
383 * @param $code string The language code.
384 *
385 * @return array The messages which do not use plural in this language.
386 */
387 public function getMessagesWithoutPlural( $code ) {
388 $this->loadGeneralMessages();
389 $this->loadMessages( $code );
390 $messagesWithoutPlural = array();
391 foreach ( $this->mMessages[$code]['translated'] as $key => $value ) {
392 if ( stripos( $this->mGeneralMessages['translatable'][$key], '{{plural:' ) !== false && stripos( $value, '{{plural:' ) === false ) {
393 $messagesWithoutPlural[$key] = $value;
394 }
395 }
396
397 return $messagesWithoutPlural;
398 }
399
400 /**
401 * Get the empty messages.
402 *
403 * @param $code string The language code.
404 *
405 * @return array The empty messages for this language.
406 */
407 public function getEmptyMessages( $code ) {
408 $this->loadGeneralMessages();
409 $this->loadMessages( $code );
410 $emptyMessages = array();
411 foreach ( $this->mMessages[$code]['translated'] as $key => $value ) {
412 if ( $value === '' || $value === '-' ) {
413 $emptyMessages[$key] = $value;
414 }
415 }
416
417 return $emptyMessages;
418 }
419
420 /**
421 * Get the messages with trailing whitespace.
422 *
423 * @param $code string The language code.
424 *
425 * @return array The messages with trailing whitespace in this language.
426 */
427 public function getMessagesWithWhitespace( $code ) {
428 $this->loadGeneralMessages();
429 $this->loadMessages( $code );
430 $messagesWithWhitespace = array();
431 foreach ( $this->mMessages[$code]['translated'] as $key => $value ) {
432 if ( $this->mGeneralMessages['translatable'][$key] !== '' && $value !== rtrim( $value ) ) {
433 $messagesWithWhitespace[$key] = $value;
434 }
435 }
436
437 return $messagesWithWhitespace;
438 }
439
440 /**
441 * Get the non-XHTML messages.
442 *
443 * @param $code string The language code.
444 *
445 * @return array The non-XHTML messages for this language.
446 */
447 public function getNonXHTMLMessages( $code ) {
448 $this->loadGeneralMessages();
449 $this->loadMessages( $code );
450 $wrongPhrases = array(
451 '<hr *\\?>',
452 '<br *\\?>',
453 '<hr/>',
454 '<br/>',
455 '<hr>',
456 '<br>',
457 );
458 $wrongPhrases = '~(' . implode( '|', $wrongPhrases ) . ')~sDu';
459 $nonXHTMLMessages = array();
460 foreach ( $this->mMessages[$code]['translated'] as $key => $value ) {
461 if ( preg_match( $wrongPhrases, $value ) ) {
462 $nonXHTMLMessages[$key] = $value;
463 }
464 }
465
466 return $nonXHTMLMessages;
467 }
468
469 /**
470 * Get the messages which include wrong characters.
471 *
472 * @param $code string The language code.
473 *
474 * @return array The messages which include wrong characters in this language.
475 */
476 public function getMessagesWithWrongChars( $code ) {
477 $this->loadGeneralMessages();
478 $this->loadMessages( $code );
479 $wrongChars = array(
480 '[LRM]' => "\xE2\x80\x8E",
481 '[RLM]' => "\xE2\x80\x8F",
482 '[LRE]' => "\xE2\x80\xAA",
483 '[RLE]' => "\xE2\x80\xAB",
484 '[POP]' => "\xE2\x80\xAC",
485 '[LRO]' => "\xE2\x80\xAD",
486 '[RLO]' => "\xE2\x80\xAB",
487 '[ZWSP]' => "\xE2\x80\x8B",
488 '[NBSP]' => "\xC2\xA0",
489 '[WJ]' => "\xE2\x81\xA0",
490 '[BOM]' => "\xEF\xBB\xBF",
491 '[FFFD]' => "\xEF\xBF\xBD",
492 );
493 $wrongRegExp = '/(' . implode( '|', array_values( $wrongChars ) ) . ')/sDu';
494 $wrongCharsMessages = array();
495 foreach ( $this->mMessages[$code]['translated'] as $key => $value ) {
496 if ( preg_match( $wrongRegExp, $value ) ) {
497 foreach ( $wrongChars as $viewableChar => $hiddenChar ) {
498 $value = str_replace( $hiddenChar, $viewableChar, $value );
499 }
500 $wrongCharsMessages[$key] = $value;
501 }
502 }
503
504 return $wrongCharsMessages;
505 }
506
507 /**
508 * Get the messages which include dubious links.
509 *
510 * @param $code string The language code.
511 *
512 * @return array The messages which include dubious links in this language.
513 */
514 public function getMessagesWithDubiousLinks( $code ) {
515 $this->loadGeneralMessages();
516 $this->loadMessages( $code );
517 $tc = Title::legalChars() . '#%{}';
518 $messages = array();
519 foreach ( $this->mMessages[$code]['translated'] as $key => $value ) {
520 $matches = array();
521 preg_match_all( "/\[\[([{$tc}]+)(?:\\|(.+?))?]]/sDu", $value, $matches );
522 for ( $i = 0; $i < count( $matches[0] ); $i++ ) {
523 if ( preg_match( "/.*project.*/isDu", $matches[1][$i] ) ) {
524 $messages[$key][] = $matches[0][$i];
525 }
526 }
527
528 if ( isset( $messages[$key] ) ) {
529 $messages[$key] = implode( $messages[$key], ", " );
530 }
531 }
532
533 return $messages;
534 }
535
536 /**
537 * Get the messages which include unbalanced brackets.
538 *
539 * @param $code string The language code.
540 *
541 * @return array The messages which include unbalanced brackets in this language.
542 */
543 public function getMessagesWithUnbalanced( $code ) {
544 $this->loadGeneralMessages();
545 $this->loadMessages( $code );
546 $messages = array();
547 foreach ( $this->mMessages[$code]['translated'] as $key => $value ) {
548 $a = $b = $c = $d = 0;
549 foreach ( preg_split( '//', $value ) as $char ) {
550 switch ( $char ) {
551 case '[':
552 $a++;
553 break;
554 case ']':
555 $b++;
556 break;
557 case '{':
558 $c++;
559 break;
560 case '}':
561 $d++;
562 break;
563 }
564 }
565
566 if ( $a !== $b || $c !== $d ) {
567 $messages[$key] = "$a, $b, $c, $d";
568 }
569 }
570
571 return $messages;
572 }
573
574 /**
575 * Get the untranslated namespace names.
576 *
577 * @param $code string The language code.
578 *
579 * @return array The untranslated namespace names in this language.
580 */
581 public function getUntranslatedNamespaces( $code ) {
582 $this->loadFile( 'en' );
583 $this->loadFile( $code );
584 $namespacesDiff = array_diff_key( $this->mNamespaceNames['en'], $this->mNamespaceNames[$code] );
585 if ( isset( $namespacesDiff[NS_MAIN] ) ) {
586 unset( $namespacesDiff[NS_MAIN] );
587 }
588
589 return $namespacesDiff;
590 }
591
592 /**
593 * Get the project talk namespace names with no $1.
594 *
595 * @param $code string The language code.
596 *
597 * @return array The problematic project talk namespaces in this language.
598 */
599 public function getProblematicProjectTalks( $code ) {
600 $this->loadFile( $code );
601 $namespaces = array();
602
603 # Check default namespace name
604 if ( isset( $this->mNamespaceNames[$code][NS_PROJECT_TALK] ) ) {
605 $default = $this->mNamespaceNames[$code][NS_PROJECT_TALK];
606 if ( strpos( $default, '$1' ) === false ) {
607 $namespaces[$default] = 'default';
608 }
609 }
610
611 # Check namespace aliases
612 foreach ( $this->mNamespaceAliases[$code] as $key => $value ) {
613 if ( $value == NS_PROJECT_TALK && strpos( $key, '$1' ) === false ) {
614 $namespaces[$key] = '';
615 }
616 }
617
618 return $namespaces;
619 }
620
621 /**
622 * Get the untranslated magic words.
623 *
624 * @param $code string The language code.
625 *
626 * @return array The untranslated magic words in this language.
627 */
628 public function getUntranslatedMagicWords( $code ) {
629 $this->loadFile( 'en' );
630 $this->loadFile( $code );
631 $magicWords = array();
632 foreach ( $this->mMagicWords['en'] as $key => $value ) {
633 if ( !isset( $this->mMagicWords[$code][$key] ) ) {
634 $magicWords[$key] = $value[1];
635 }
636 }
637
638 return $magicWords;
639 }
640
641 /**
642 * Get the obsolete magic words.
643 *
644 * @param $code string The language code.
645 *
646 * @return array The obsolete magic words in this language.
647 */
648 public function getObsoleteMagicWords( $code ) {
649 $this->loadFile( 'en' );
650 $this->loadFile( $code );
651 $magicWords = array();
652 foreach ( $this->mMagicWords[$code] as $key => $value ) {
653 if ( !isset( $this->mMagicWords['en'][$key] ) ) {
654 $magicWords[$key] = $value[1];
655 }
656 }
657
658 return $magicWords;
659 }
660
661 /**
662 * Get the magic words that override the original English magic word.
663 *
664 * @param $code string The language code.
665 *
666 * @return array The overriding magic words in this language.
667 */
668 public function getOverridingMagicWords( $code ) {
669 $this->loadFile( 'en' );
670 $this->loadFile( $code );
671 $magicWords = array();
672 foreach ( $this->mMagicWords[$code] as $key => $local ) {
673 if ( !isset( $this->mMagicWords['en'][$key] ) ) {
674 # Unrecognized magic word
675 continue;
676 }
677 $en = $this->mMagicWords['en'][$key];
678 array_shift( $local );
679 array_shift( $en );
680 foreach ( $en as $word ) {
681 if ( !in_array( $word, $local ) ) {
682 $magicWords[$key] = $word;
683 break;
684 }
685 }
686 }
687
688 return $magicWords;
689 }
690
691 /**
692 * Get the magic words which do not match the case-sensitivity of the original words.
693 *
694 * @param $code string The language code.
695 *
696 * @return array The magic words whose case does not match in this language.
697 */
698 public function getCaseMismatchMagicWords( $code ) {
699 $this->loadFile( 'en' );
700 $this->loadFile( $code );
701 $magicWords = array();
702 foreach ( $this->mMagicWords[$code] as $key => $local ) {
703 if ( !isset( $this->mMagicWords['en'][$key] ) ) {
704 # Unrecognized magic word
705 continue;
706 }
707 if ( $local[0] != $this->mMagicWords['en'][$key][0] ) {
708 $magicWords[$key] = $local[0];
709 }
710 }
711
712 return $magicWords;
713 }
714
715 /**
716 * Get the untranslated special page names.
717 *
718 * @param $code string The language code.
719 *
720 * @return array The untranslated special page names in this language.
721 */
722 public function getUntraslatedSpecialPages( $code ) {
723 $this->loadFile( 'en' );
724 $this->loadFile( $code );
725 $specialPageAliases = array();
726 foreach ( $this->mSpecialPageAliases['en'] as $key => $value ) {
727 if ( !isset( $this->mSpecialPageAliases[$code][$key] ) ) {
728 $specialPageAliases[$key] = $value[0];
729 }
730 }
731
732 return $specialPageAliases;
733 }
734
735 /**
736 * Get the obsolete special page names.
737 *
738 * @param $code string The language code.
739 *
740 * @return array The obsolete special page names in this language.
741 */
742 public function getObsoleteSpecialPages( $code ) {
743 $this->loadFile( 'en' );
744 $this->loadFile( $code );
745 $specialPageAliases = array();
746 foreach ( $this->mSpecialPageAliases[$code] as $key => $value ) {
747 if ( !isset( $this->mSpecialPageAliases['en'][$key] ) ) {
748 $specialPageAliases[$key] = $value[0];
749 }
750 }
751
752 return $specialPageAliases;
753 }
754 }
755
756 class extensionLanguages extends languages {
757
758 /**
759 * @var MessageGroup
760 */
761 private $mMessageGroup;
762
763 /**
764 * Load the messages group.
765 * @param $group MessageGroup The messages group.
766 */
767 function __construct( MessageGroup $group ) {
768 $this->mMessageGroup = $group;
769
770 $this->mIgnoredMessages = $this->mMessageGroup->getIgnored();
771 $this->mOptionalMessages = $this->mMessageGroup->getOptional();
772 }
773
774 /**
775 * Get the extension name.
776 *
777 * @return string The extension name.
778 */
779 public function name() {
780 return $this->mMessageGroup->getLabel();
781 }
782
783 /**
784 * Load the language file.
785 *
786 * @param $code string The language code.
787 */
788 protected function loadFile( $code ) {
789 if ( !isset( $this->mRawMessages[$code] ) ) {
790 $this->mRawMessages[$code] = $this->mMessageGroup->load( $code );
791 if ( empty( $this->mRawMessages[$code] ) ) {
792 $this->mRawMessages[$code] = array();
793 }
794 }
795 }
796 }