diff options
author | Alex Legler <alex@a3li.li> | 2015-01-06 16:23:29 +0100 |
---|---|---|
committer | Alex Legler <alex@a3li.li> | 2015-01-06 16:23:29 +0100 |
commit | 0406a114f25f3f4a37517dd377aa41d521c948eb (patch) | |
tree | 3869bfddabe7d2361ad54b06075dc93642e28193 /GentooToolbox | |
parent | Add localized message support (diff) | |
download | extensions-0406a114f25f3f4a37517dd377aa41d521c948eb.tar.gz extensions-0406a114f25f3f4a37517dd377aa41d521c948eb.tar.bz2 extensions-0406a114f25f3f4a37517dd377aa41d521c948eb.zip |
Use proper language detection
Diffstat (limited to 'GentooToolbox')
-rw-r--r-- | GentooToolbox/localizedmsg/LocalizedMsg.php | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/GentooToolbox/localizedmsg/LocalizedMsg.php b/GentooToolbox/localizedmsg/LocalizedMsg.php index 9db1abb2..634b0e61 100644 --- a/GentooToolbox/localizedmsg/LocalizedMsg.php +++ b/GentooToolbox/localizedmsg/LocalizedMsg.php @@ -8,7 +8,16 @@ class GTBXLocalizedMsg { } public static function LocalizedMsgParserFunction( $parser, $message, $language = 'en' ) { - return wfMessage( $message )->inLanguage( $language )->escaped(); + $is_translation_page = !( TranslatablePage::isTranslationPage( $parser->getTitle() ) === false ); + global $wgLanguageCode; + $language_code = $wgLanguageCode; + + if ( $is_translation_page ) { + list( , $code ) = TranslateUtils::figureMessage( $title->getText() ); + $language_code = $code; + } + + return wfMessage( $message )->inLanguage( $language_code )->escaped(); } } ?>
\ No newline at end of file |