Index: trunk/extensions/Translate/tag/PageTranslationHooks.php |
— | — | @@ -59,13 +59,13 @@ |
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
63 | | - * Set the right page content language for translated pages ("Page/xx") |
64 | | - * and namespaces used for translating messages (similar to MediaWiki namespace pages) |
| 63 | + * Set the right page content language for translated pages ("Page/xx"). |
| 64 | + * Hook: PageContentLanguage |
65 | 65 | */ |
66 | 66 | public static function onPageContentLanguage( $title, &$pageLang ) { |
67 | 67 | global $wgTranslateMessageNamespaces; |
68 | 68 | // For translation pages, parse plural, grammar etc with correct language, and set the right direction |
69 | | - if ( TranslatablePage::isTranslationPage( $title ) || in_array( $title->getNamespace(), $wgTranslateMessageNamespaces ) ) { |
| 69 | + if ( TranslatablePage::isTranslationPage( $title ) ) { |
70 | 70 | list( , $code ) = TranslateUtils::figureMessage( $title->getText() ); |
71 | 71 | $pageLang = $code; |
72 | 72 | } |
Index: trunk/extensions/Translate/Translate.php |
— | — | @@ -54,6 +54,7 @@ |
55 | 55 | $wgHooks['UnitTestsList'][] = 'TranslateHooks::setupUnitTests'; |
56 | 56 | $wgHooks['LoadExtensionSchemaUpdates'][] = 'TranslateHooks::schemaUpdates'; |
57 | 57 | $wgHooks['ParserTestTables'][] = 'PageTranslationHooks::parserTestTables'; |
| 58 | +$wgHooks['PageContentLanguage'][] = 'TranslateHooks::onPageContentLanguage'; |
58 | 59 | |
59 | 60 | // Register special pages into MediaWiki |
60 | 61 | $wgSpecialPages['Translate'] = 'SpecialTranslate'; |
Index: trunk/extensions/Translate/TranslateHooks.php |
— | — | @@ -175,4 +175,19 @@ |
176 | 176 | return true; |
177 | 177 | } |
178 | 178 | |
| 179 | + |
| 180 | + /** |
| 181 | + * Set the right page content language for message group translations ("Page/xx"). |
| 182 | + * Hook: PageContentLanguage |
| 183 | + */ |
| 184 | + public static function onPageContentLanguage( $title, &$pageLang ) { |
| 185 | + global $wgTranslateMessageNamespaces; |
| 186 | + // For translation pages, parse plural, grammar etc with correct language, and set the right direction |
| 187 | + if ( in_array( $title->getNamespace(), $wgTranslateMessageNamespaces ) ) { |
| 188 | + list( , $code ) = TranslateUtils::figureMessage( $title->getText() ); |
| 189 | + $pageLang = $code; |
| 190 | + } |
| 191 | + return true; |
| 192 | + } |
| 193 | + |
179 | 194 | } |