r45031 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r45030‎ | r45031 | r45032 >
Date:18:00, 25 December 2008
Author:ialex
Status:ok
Tags:
Comment:
Per Nikerabbit and Siebrand: removed $skinNames from localisation files and replaced them with messages. Messages names are "skinname-<skin>" where <skin> is the internal name of the skin.
Updates for other languages should come soon :)
Modified paths:
  • /trunk/phase3/includes/specials/SpecialPreferences.php (modified) (history)
  • /trunk/phase3/languages/Language.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)
  • /trunk/phase3/maintenance/language/checkLanguage.inc (modified) (history)
  • /trunk/phase3/maintenance/language/languages.inc (modified) (history)
  • /trunk/phase3/maintenance/language/messages.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/language/messages.inc
@@ -2164,6 +2164,16 @@
21652165 'numauthors',
21662166 'numtalkauthors',
21672167 ),
 2168+ 'skin' => array(
 2169+ 'skinname-standard',
 2170+ 'skinname-nostalgia',
 2171+ 'skinname-cologneblue',
 2172+ 'skinname-monobook',
 2173+ 'skinname-myskin',
 2174+ 'skinname-chick',
 2175+ 'skinname-simple',
 2176+ 'skinname-modern',
 2177+ ),
21682178 'math' => array(
21692179 'mw_math_png',
21702180 'mw_math_simple',
@@ -2972,6 +2982,7 @@
29732983 'attribution' => 'Attribution',
29742984 'spamprotection' => 'Spam protection',
29752985 'info' => 'Info page',
 2986+ 'skin' => 'Skins names',
29762987 'math' => 'Math options',
29772988 'patrolling' => 'Patrolling',
29782989 'patrol-log' => 'Patrol log',
Index: trunk/phase3/maintenance/language/checkLanguage.inc
@@ -74,7 +74,7 @@
7575 return array(
7676 'untranslated', 'duplicate', 'obsolete', 'variables', 'empty', 'plural',
7777 'whitespace', 'xhtml', 'chars', 'links', 'unbalanced', 'namespace',
78 - 'projecttalk', 'skin', 'magic', 'magic-old', 'magic-over', 'magic-case',
 78+ 'projecttalk', 'magic', 'magic-old', 'magic-over', 'magic-case',
7979 'special', 'special-old',
8080 );
8181 }
@@ -85,7 +85,7 @@
8686 */
8787 protected function nonMessageChecks() {
8888 return array(
89 - 'namespace', 'projecttalk', 'skin', 'magic', 'magic-old', 'magic-over',
 89+ 'namespace', 'projecttalk', 'magic', 'magic-old', 'magic-over',
9090 'magic-case', 'special', 'special-old',
9191 );
9292 }
@@ -120,7 +120,6 @@
121121 'unbalanced' => 'getMessagesWithUnbalanced',
122122 'namespace' => 'getUntranslatedNamespaces',
123123 'projecttalk' => 'getProblematicProjectTalks',
124 - 'skin' => 'getUntranslatedSkins',
125124 'magic' => 'getUntranslatedMagicWords',
126125 'magic-old' => 'getObsoleteMagicWords',
127126 'magic-over' => 'getOverridingMagicWords',
@@ -140,7 +139,6 @@
141140 return array(
142141 'namespace' => array( 'getNamespaceNames', 'en' ),
143142 'projecttalk' => null,
144 - 'skin' => array( 'getSkinNames', 'en' ),
145143 'magic' => array( 'getMagicWords', 'en' ),
146144 'magic-old' => array( 'getMagicWords', null ),
147145 'magic-over' => array( 'getMagicWords', null ),
@@ -169,7 +167,6 @@
170168 'unbalanced' => '$1 message(s) of $2 in $3 have unbalanced {[]}:',
171169 'namespace' => '$1 namespace name(s) of $2 are not translated to $3, but exist in en:',
172170 'projecttalk' => '$1 namespace name(s) and alias(es) in $3 are project talk namespaces without the parameter:',
173 - 'skin' => '$1 skin name(s) of $2 are not translated to $3, but exist in en:',
174171 'magic' => '$1 magic word(s) of $2 are not translated to $3, but exist in en:',
175172 'magic-old' => '$1 magic word(s) of $2 do not exist in en, but exist in $3:',
176173 'magic-over' => '$1 magic word(s) of $2 in $3 do not contain the original en word(s):',
@@ -211,7 +208,6 @@
212209 * unbalanced: Messages which contains unequal numbers of opening {[ and closing ]}.
213210 * namespace: Namespace names that were not translated.
214211 * projecttalk: Namespace names and aliases where the project talk does not contain $1.
215 - * skin: Skin names that were not translated.
216212 * magic: Magic words that were not translated.
217213 * magic-old: Magic words which do not exist.
218214 * magic-over: Magic words that override the original English word.
Index: trunk/phase3/maintenance/language/languages.inc
@@ -20,7 +20,6 @@
2121
2222 protected $mNamespaceNames; # Namespace names
2323 protected $mNamespaceAliases; # Namespace aliases
24 - protected $mSkinNames; # Skin names
2524 protected $mMagicWords; # Magic words
2625 protected $mSpecialPageAliases; # Special page aliases
2726
@@ -79,7 +78,6 @@
8079 if ( isset( $this->mRawMessages[$code] ) &&
8180 isset( $this->mNamespaceNames[$code] ) &&
8281 isset( $this->mNamespaceAliases[$code] ) &&
83 - isset( $this->mSkinNames[$code] ) &&
8482 isset( $this->mMagicWords[$code] ) &&
8583 isset( $this->mSpecialPageAliases[$code] ) ) {
8684 return;
@@ -87,7 +85,6 @@
8886 $this->mRawMessages[$code] = array();
8987 $this->mNamespaceNames[$code] = array();
9088 $this->mNamespaceAliases[$code] = array();
91 - $this->mSkinNames[$code] = array();
9289 $this->mMagicWords[$code] = array();
9390 $this->mSpecialPageAliases[$code] = array();
9491 $filename = Language::getMessagesFileName( $code );
@@ -102,9 +99,6 @@
103100 if ( isset( $namespaceAliases ) ) {
104101 $this->mNamespaceAliases[$code] = $namespaceAliases;
105102 }
106 - if ( isset( $skinNames ) ) {
107 - $this->mSkinNames[$code] = $skinNames;
108 - }
109103 if ( isset( $magicWords ) ) {
110104 $this->mMagicWords[$code] = $magicWords;
111105 }
@@ -237,18 +231,6 @@
238232 }
239233
240234 /**
241 - * Get skin names for a specific language.
242 - *
243 - * @param $code The language code.
244 - *
245 - * @return Skin names.
246 - */
247 - public function getSkinNames( $code ) {
248 - $this->loadFile( $code );
249 - return $this->mSkinNames[$code];
250 - }
251 -
252 - /**
253235 * Get magic words for a specific language.
254236 *
255237 * @param $code The language code.
@@ -576,19 +558,6 @@
577559 }
578560
579561 /**
580 - * Get the untranslated skin names.
581 - *
582 - * @param $code The language code.
583 - *
584 - * @return The untranslated skin names in this language.
585 - */
586 - public function getUntranslatedSkins( $code ) {
587 - $this->loadFile( 'en' );
588 - $this->loadFile( $code );
589 - return array_diff_key( $this->mSkinNames['en'], $this->mSkinNames[$code] );
590 - }
591 -
592 - /**
593562 * Get the untranslated magic words.
594563 *
595564 * @param $code The language code.
Index: trunk/phase3/includes/specials/SpecialPreferences.php
@@ -552,7 +552,6 @@
553553 }
554554
555555 $qbs = $wgLang->getQuickbarSettings();
556 - $skinNames = $wgLang->getSkinNames();
557556 $mathopts = $wgLang->getMathNames();
558557 $dateopts = $wgLang->getDatePreferences();
559558 $togs = User::getToggles();
@@ -834,23 +833,25 @@
835834 #
836835 global $wgAllowUserSkin;
837836 if( $wgAllowUserSkin ) {
838 - $wgOut->addHTML( "<fieldset>\n<legend>\n" . wfMsg('skin') . "</legend>\n" );
 837+ $wgOut->addHTML( "<fieldset>\n<legend>\n" . wfMsg( 'skin' ) . "</legend>\n" );
839838 $mptitle = Title::newMainPage();
840 - $previewtext = wfMsg('skin-preview');
 839+ $previewtext = wfMsg( 'skin-preview' );
841840 # Only show members of Skin::getSkinNames() rather than
842841 # $skinNames (skins is all skin names from Language.php)
843842 $validSkinNames = Skin::getUsableSkins();
844843 # Sort by UI skin name. First though need to update validSkinNames as sometimes
845844 # the skinkey & UI skinname differ (e.g. "standard" skinkey is "Classic" in the UI).
846 - foreach ($validSkinNames as $skinkey => & $skinname ) {
847 - if ( isset( $skinNames[$skinkey] ) ) {
848 - $skinname = $skinNames[$skinkey];
 845+ foreach ( $validSkinNames as $skinkey => &$skinname ) {
 846+ $msgName = "skinname-{$skinkey}";
 847+ $localisedSkinName = wfMsg( $msgName );
 848+ if ( !wfEmptyMsg( $msgName, $localisedSkinName ) ) {
 849+ $skinname = $localisedSkinName;
849850 }
850851 }
851852 asort($validSkinNames);
852853 foreach ($validSkinNames as $skinkey => $sn ) {
853854 $checked = $skinkey == $this->mSkin ? ' checked="checked"' : '';
854 - $mplink = htmlspecialchars($mptitle->getLocalURL("useskin=$skinkey"));
 855+ $mplink = htmlspecialchars( $mptitle->getLocalURL( "useskin=$skinkey" ) );
855856 $previewlink = "(<a target='_blank' href=\"$mplink\">$previewtext</a>)";
856857 if( $skinkey == $wgDefaultSkin )
857858 $sn .= ' (' . wfMsg( 'default' ) . ')';
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -104,20 +104,6 @@
105105 $namespaceAliases = array();
106106
107107 /**
108 - * Skin names. If any key is not specified, the English one will be used.
109 - */
110 -$skinNames = array(
111 - 'standard' => 'Classic',
112 - 'nostalgia' => 'Nostalgia',
113 - 'cologneblue' => 'Cologne Blue',
114 - 'monobook' => 'MonoBook',
115 - 'myskin' => 'MySkin',
116 - 'chick' => 'Chick',
117 - 'simple' => 'Simple',
118 - 'modern' => 'Modern',
119 -);
120 -
121 -/**
122108 * Deprecated, use the message array
123109 */
124110 $mathNames = array(
@@ -3019,6 +3005,16 @@
30203006 'numauthors' => 'Number of distinct authors (page): $1',
30213007 'numtalkauthors' => 'Number of distinct authors (discussion page): $1',
30223008
 3009+# Skins names
 3010+'skinname-standard' => 'Classic',
 3011+'skinname-nostalgia' => 'Nostalgia',
 3012+'skinname-cologneblue' => 'Cologne Blue',
 3013+'skinname-monobook' => 'MonoBook',
 3014+'skinname-myskin' => 'MySkin',
 3015+'skinname-chick' => 'Chick',
 3016+'skinname-simple' => 'Simple',
 3017+'skinname-modern' => 'Modern',
 3018+
30233019 # Math options
30243020 'mw_math_png' => 'Always render PNG',
30253021 'mw_math_simple' => 'HTML if very simple or else PNG',
Index: trunk/phase3/languages/Language.php
@@ -56,9 +56,9 @@
5757 var $mConverter, $mVariants, $mCode, $mLoaded = false;
5858 var $mMagicExtensions = array(), $mMagicHookDone = false;
5959
60 - static public $mLocalisationKeys = array( 'fallback', 'namespaceNames',
61 - 'skinNames', 'mathNames',
62 - 'bookstoreList', 'magicWords', 'messages', 'rtl', 'digitTransformTable',
 60+ static public $mLocalisationKeys = array(
 61+ 'fallback', 'namespaceNames', 'mathNames', 'bookstoreList',
 62+ 'magicWords', 'messages', 'rtl', 'digitTransformTable',
6363 'separatorTransformTable', 'fallback8bitEncoding', 'linkPrefixExtension',
6464 'defaultUserOptionOverrides', 'linkTrail', 'namespaceAliases',
6565 'dateFormats', 'datePreferences', 'datePreferenceMigrationMap',
@@ -320,7 +320,7 @@
321321 if ( isset( $aliases[$name][0] ) ) {
322322 $name = $aliases[$name][0];
323323 }
324 - return $this->getNsText(NS_SPECIAL) . ':' . $name;
 324+ return $this->getNsText( NS_SPECIAL ) . ':' . $name;
325325 }
326326
327327 function getQuickbarSettings() {
@@ -333,11 +333,6 @@
334334 );
335335 }
336336
337 - function getSkinNames() {
338 - $this->load();
339 - return $this->skinNames;
340 - }
341 -
342337 function getMathNames() {
343338 $this->load();
344339 return $this->mathNames;

Follow-up revisions

RevisionCommit summaryAuthorDate
r45035Per r45031: removed skin names localisation from Special:Magicialex18:22, 25 December 2008
r45081FIXME: broken. Language::getSkinNames() was removed in r45031.siebrand11:42, 27 December 2008

Status & tagging log