Index: trunk/extensions/Translate/tag/SpecialPageTranslation.php |
— | — | @@ -350,7 +350,7 @@ |
351 | 351 | global $wgOut, $wgContLang; |
352 | 352 | |
353 | 353 | $wgOut->setSubtitle( $this->user->getSkin()->link( $page->getTitle() ) ); |
354 | | - TranslateUtils::injectCSS(); |
| 354 | + $wgOut->addModules( 'ext.translate' ); |
355 | 355 | |
356 | 356 | $wgOut->addWikiMsg( 'tpt-showpage-intro' ); |
357 | 357 | |
Index: trunk/extensions/Translate/tag/PageTranslationHooks.php |
— | — | @@ -72,9 +72,9 @@ |
73 | 73 | return true; |
74 | 74 | } |
75 | 75 | |
76 | | - // Only called form hook |
| 76 | + // Only called from hook |
77 | 77 | public static function injectCss( $outputpage, $text ) { |
78 | | - TranslateUtils::injectCSS(); |
| 78 | + $outputpage->addModules( 'ext.translate' ); |
79 | 79 | |
80 | 80 | return true; |
81 | 81 | } |
Index: trunk/extensions/Translate/Translate.php |
— | — | @@ -130,7 +130,7 @@ |
131 | 131 | ); |
132 | 132 | |
133 | 133 | // Client-side resource modules |
134 | | -$wgResourceModules['translate-css'] = array( |
| 134 | +$wgResourceModules['ext.translate'] = array( |
135 | 135 | 'styles' => 'Translate.css', |
136 | 136 | ) + $resourcePaths; |
137 | 137 | |
Index: trunk/extensions/Translate/utils/MessageTable.php |
— | — | @@ -65,7 +65,7 @@ |
66 | 66 | TranslationHelpers::addModules( $wgOut ); |
67 | 67 | $vars = array( 'trlKeys' => array_values( $this->collection->keys() ) ); |
68 | 68 | $wgOut->addScript( Skin::makeVariablesScript( $vars ) ); |
69 | | - TranslateUtils::addModules( $wgOut, 'ext.translate.messagetable' ); |
| 69 | + $wgOut->addModules( 'ext.translate.messagetable' ); |
70 | 70 | } |
71 | 71 | |
72 | 72 | public function header() { |
Index: trunk/extensions/Translate/utils/MessageWebImporter.php |
— | — | @@ -85,7 +85,8 @@ |
86 | 86 | } |
87 | 87 | |
88 | 88 | protected function doHeader() { |
89 | | - TranslateUtils::injectCSS(); |
| 89 | + global $wgOut; |
| 90 | + $wgOut->addModules( 'ext.translate' ); |
90 | 91 | |
91 | 92 | $formParams = array( |
92 | 93 | 'method' => 'post', |
Index: trunk/extensions/Translate/utils/TranslationHelpers.php |
— | — | @@ -1198,12 +1198,12 @@ |
1199 | 1199 | } |
1200 | 1200 | |
1201 | 1201 | public static function addModules( OutputPage $out ) { |
1202 | | - TranslateUtils::addModules( $out, array( |
1203 | | - 'ext.translate.quickedit', |
1204 | | - ) ); |
| 1202 | + $out->addModules( 'ext.translate.quickedit' ); |
1205 | 1203 | |
1206 | 1204 | // Might be needed, but ajax doesn't load it |
1207 | 1205 | // Globals :( |
| 1206 | + /// @todo: remove when 1.17 is no longer supported. |
| 1207 | + // The RL module name is different in 1.17 and >1.17 |
1208 | 1208 | $diff = new DifferenceEngine; |
1209 | 1209 | $diff->showDiffStyle(); |
1210 | 1210 | } |
Index: trunk/extensions/Translate/specials/SpecialSupportedLanguages.php |
— | — | @@ -33,7 +33,7 @@ |
34 | 34 | $this->purge = $wgRequest->getVal( 'action' ) === 'purge'; |
35 | 35 | |
36 | 36 | $this->setHeaders(); |
37 | | - TranslateUtils::addModules( $wgOut, 'ext.translate.special.supportedlanguages' ); |
| 37 | + $wgOut->addModules( 'ext.translate.special.supportedlanguages' ); |
38 | 38 | |
39 | 39 | $cache = wfGetCache( CACHE_ANYTHING ); |
40 | 40 | $cachekey = wfMemcKey( 'translate-supportedlanguages', $wgLang->getCode() ); |
Index: trunk/extensions/Translate/specials/SpecialTranslate.php |
— | — | @@ -33,7 +33,7 @@ |
34 | 34 | public function execute( $parameters ) { |
35 | 35 | global $wgOut, $wgTranslateBlacklist, $wgRequest; |
36 | 36 | |
37 | | - TranslateUtils::addModules( $wgOut, 'ext.translate.special.translate' ); |
| 37 | + $wgOut->addModules( 'ext.translate.special.translate' ); |
38 | 38 | |
39 | 39 | $this->setHeaders(); |
40 | 40 | |
Index: trunk/extensions/Translate/specials/SpecialTranslations.php |
— | — | @@ -271,6 +271,6 @@ |
272 | 272 | private static function includeAssets() { |
273 | 273 | global $wgOut; |
274 | 274 | TranslationHelpers::addModules( $wgOut ); |
275 | | - TranslateUtils::addModules( $wgOut, 'ext.translate.messagetable' ); |
| 275 | + $wgOut->addModules( 'ext.translate.messagetable' ); |
276 | 276 | } |
277 | 277 | } |
Index: trunk/extensions/Translate/specials/SpecialLanguageStats.php |
— | — | @@ -37,8 +37,8 @@ |
38 | 38 | $this->setHeaders(); |
39 | 39 | $this->outputHeader(); |
40 | 40 | |
41 | | - TranslateUtils::addModules( $wgOut, 'ext.translate.special.languagestats' ); |
42 | | - TranslateUtils::addModules( $wgOut, 'ext.translate.messagetable' ); |
| 41 | + $wgOut->addModules( 'ext.translate.special.languagestats' ); |
| 42 | + $wgOut->addModules( 'ext.translate.messagetable' ); |
43 | 43 | |
44 | 44 | // no UI when including() |
45 | 45 | if ( !$this->including() ) { |
Index: trunk/extensions/Translate/TranslateUtils.php |
— | — | @@ -318,26 +318,6 @@ |
319 | 319 | } |
320 | 320 | |
321 | 321 | /** |
322 | | - * Injects extension css (only once). |
323 | | - */ |
324 | | - public static function injectCSS() { |
325 | | - global $wgOut; |
326 | | - |
327 | | - if ( method_exists( $wgOut, 'addModules' ) ) { |
328 | | - $wgOut->addModuleStyles( 'translate-css' ); |
329 | | - return true; |
330 | | - } |
331 | | - |
332 | | - static $done = false; |
333 | | - |
334 | | - if ( !$done ) { |
335 | | - $wgOut->addExtensionStyle( self::assetPath( 'Translate.css' ) ); |
336 | | - } |
337 | | - |
338 | | - return $done = true; |
339 | | - } |
340 | | - |
341 | | - /** |
342 | 322 | * Construct the web address to given asset. |
343 | 323 | * @param $path \string Path to the resource relative to extensions root directory. |
344 | 324 | * @return \string Full or partial web path. |
— | — | @@ -347,24 +327,6 @@ |
348 | 328 | return "$wgExtensionAssetsPath/Translate/$path"; |
349 | 329 | } |
350 | 330 | |
351 | | - public static function addModules( $out, $modules ) { |
352 | | - if ( method_exists( $out, 'addModules' ) ) { |
353 | | - $out->addModules( $modules ); |
354 | | - } else { |
355 | | - global $wgResourceModules; |
356 | | - foreach ( (array) $modules as $module ) { |
357 | | - if ( isset( $wgResourceModules[$module]['styles'] ) ) { |
358 | | - $file = $wgResourceModules[$module]['styles']; |
359 | | - $out->addExtensionStyle( TranslateUtils::assetPath( $file ) ); |
360 | | - } |
361 | | - if ( isset( $wgResourceModules[$module]['scripts'] ) ) { |
362 | | - $file = $wgResourceModules[$module]['scripts']; |
363 | | - $out->addScriptFile( TranslateUtils::assetPath( $file ) ); |
364 | | - } |
365 | | - } |
366 | | - } |
367 | | - } |
368 | | - |
369 | 331 | /** |
370 | 332 | * Gets the path for cache files |
371 | 333 | * @param $filename \string |