r113682 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113681‎ | r113682 | r113683 >
Date:23:08, 12 March 2012
Author:brion
Status:ok
Tags:
Comment:
drop unused UploadWizardMessages class; transitional from before ResourceLoader
Modified paths:
  • /trunk/extensions/UploadWizard/UploadWizard.php (modified) (history)
  • /trunk/extensions/UploadWizard/UploadWizardMessages.php (deleted) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/UploadWizardMessages.php
@@ -1,59 +0,0 @@
2 -<?php
3 -/**
4 - * UploadWizardMessages
5 - *
6 - * Simple class to take messages from a modules' i18n.php and dump them into Javascript.
7 - *
8 - * @file
9 - * @ingroup Upload
10 - */
11 -
12 -/* This class is temporary, until Resource Loader is available. */
13 -
14 -class UploadWizardMessages {
15 -
16 - /**
17 - * getMessagesJs generates a javascript addMessages() calls for a given module and language
18 - *
19 - * @param String $moduleName the name of the module
20 - * @param String $langCode Name of scriptText module ( that hosts messages )
21 - * @return string
22 - */
23 - public static function getMessagesJs( $moduleName, $language ) {
24 - global $wgOut;
25 -
26 - // TODO this should be cached. Perhaps with Localisation Cache.
27 - global $wgExtensionMessagesFiles;
28 -
29 - // Empty out messages in the current scope
30 - $messages = array();
31 - require( $wgExtensionMessagesFiles[ $moduleName ] );
32 -
33 - // iterate over the default messages, and get this wiki's current messages
34 - // presumably this will include local overrides in MediaWiki: space
35 - $messagesForJs = array();
36 -
37 - // 'en' is the default language, so it will be the most complete
38 - foreach ( array_keys( $messages['en'] ) as $key ) {
39 - $messagesForJs[ $key ] = wfMsgGetKey( $key, /*DB*/true, $language, /*Transform*/false );
40 - }
41 -
42 - $messagesJson = FormatJson::encode( $messagesForJs );
43 - return 'window.mediaWiki.addMessages(' . $messagesJson . ');';
44 - }
45 -
46 -
47 - static function getNormalizedLangCode( $langCode ) {
48 - global $wgLang;
49 - // Check the langCode
50 - if ( !$langCode ) {
51 - if ( $wgLang ) {
52 - $langCode = $wgLang->getCode();
53 - } else {
54 - $langCode = 'en'; // desperation
55 - }
56 - }
57 -
58 - }
59 -
60 -}
Index: trunk/extensions/UploadWizard/UploadWizard.php
@@ -35,7 +35,6 @@
3636
3737 # Require modules, including the special page
3838 foreach ( array(
39 - 'UploadWizardMessages' => $wgUpwizDir,
4039 'UploadWizardHooks' => $wgUpwizDir,
4140 'ApiDeleteUploadCampaign' => $wgUpwizDir . '/api',
4241 'UploadWizardConfig' => $wgUpwizDir . '/includes',

Status & tagging log