From 352cbb523ef1d98774085f0c12c8c4908f934a46 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Thu, 25 Dec 2008 18:00:26 +0000 Subject: [PATCH] Per Nikerabbit and Siebrand: removed $skinNames from localisation files and replaced them with messages. Messages names are "skinname-" where is the internal name of the skin. Updates for other languages should come soon :) --- includes/specials/SpecialPreferences.php | 15 ++++++------ languages/Language.php | 13 +++------- languages/messages/MessagesEn.php | 24 ++++++++---------- maintenance/language/checkLanguage.inc | 8 ++---- maintenance/language/languages.inc | 31 ------------------------ maintenance/language/messages.inc | 11 +++++++++ 6 files changed, 35 insertions(+), 67 deletions(-) diff --git a/includes/specials/SpecialPreferences.php b/includes/specials/SpecialPreferences.php index ab50486c95..ca2236ee04 100644 --- a/includes/specials/SpecialPreferences.php +++ b/includes/specials/SpecialPreferences.php @@ -552,7 +552,6 @@ class PreferencesForm { } $qbs = $wgLang->getQuickbarSettings(); - $skinNames = $wgLang->getSkinNames(); $mathopts = $wgLang->getMathNames(); $dateopts = $wgLang->getDatePreferences(); $togs = User::getToggles(); @@ -834,23 +833,25 @@ class PreferencesForm { # global $wgAllowUserSkin; if( $wgAllowUserSkin ) { - $wgOut->addHTML( "
\n\n" . wfMsg('skin') . "\n" ); + $wgOut->addHTML( "
\n\n" . wfMsg( 'skin' ) . "\n" ); $mptitle = Title::newMainPage(); - $previewtext = wfMsg('skin-preview'); + $previewtext = wfMsg( 'skin-preview' ); # Only show members of Skin::getSkinNames() rather than # $skinNames (skins is all skin names from Language.php) $validSkinNames = Skin::getUsableSkins(); # Sort by UI skin name. First though need to update validSkinNames as sometimes # the skinkey & UI skinname differ (e.g. "standard" skinkey is "Classic" in the UI). - foreach ($validSkinNames as $skinkey => & $skinname ) { - if ( isset( $skinNames[$skinkey] ) ) { - $skinname = $skinNames[$skinkey]; + foreach ( $validSkinNames as $skinkey => &$skinname ) { + $msgName = "skinname-{$skinkey}"; + $localisedSkinName = wfMsg( $msgName ); + if ( !wfEmptyMsg( $msgName, $localisedSkinName ) ) { + $skinname = $localisedSkinName; } } asort($validSkinNames); foreach ($validSkinNames as $skinkey => $sn ) { $checked = $skinkey == $this->mSkin ? ' checked="checked"' : ''; - $mplink = htmlspecialchars($mptitle->getLocalURL("useskin=$skinkey")); + $mplink = htmlspecialchars( $mptitle->getLocalURL( "useskin=$skinkey" ) ); $previewlink = "($previewtext)"; if( $skinkey == $wgDefaultSkin ) $sn .= ' (' . wfMsg( 'default' ) . ')'; diff --git a/languages/Language.php b/languages/Language.php index 1e626689ad..26554be916 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -56,9 +56,9 @@ class Language { var $mConverter, $mVariants, $mCode, $mLoaded = false; var $mMagicExtensions = array(), $mMagicHookDone = false; - static public $mLocalisationKeys = array( 'fallback', 'namespaceNames', - 'skinNames', 'mathNames', - 'bookstoreList', 'magicWords', 'messages', 'rtl', 'digitTransformTable', + static public $mLocalisationKeys = array( + 'fallback', 'namespaceNames', 'mathNames', 'bookstoreList', + 'magicWords', 'messages', 'rtl', 'digitTransformTable', 'separatorTransformTable', 'fallback8bitEncoding', 'linkPrefixExtension', 'defaultUserOptionOverrides', 'linkTrail', 'namespaceAliases', 'dateFormats', 'datePreferences', 'datePreferenceMigrationMap', @@ -320,7 +320,7 @@ class Language { if ( isset( $aliases[$name][0] ) ) { $name = $aliases[$name][0]; } - return $this->getNsText(NS_SPECIAL) . ':' . $name; + return $this->getNsText( NS_SPECIAL ) . ':' . $name; } function getQuickbarSettings() { @@ -333,11 +333,6 @@ class Language { ); } - function getSkinNames() { - $this->load(); - return $this->skinNames; - } - function getMathNames() { $this->load(); return $this->mathNames; diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index f6148c2146..0772c3c819 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -103,20 +103,6 @@ $namespaceNames = array( */ $namespaceAliases = array(); -/** - * Skin names. If any key is not specified, the English one will be used. - */ -$skinNames = array( - 'standard' => 'Classic', - 'nostalgia' => 'Nostalgia', - 'cologneblue' => 'Cologne Blue', - 'monobook' => 'MonoBook', - 'myskin' => 'MySkin', - 'chick' => 'Chick', - 'simple' => 'Simple', - 'modern' => 'Modern', -); - /** * Deprecated, use the message array */ @@ -3019,6 +3005,16 @@ This is probably caused by a link to a blacklisted external site.', 'numauthors' => 'Number of distinct authors (page): $1', 'numtalkauthors' => 'Number of distinct authors (discussion page): $1', +# Skins names +'skinname-standard' => 'Classic', +'skinname-nostalgia' => 'Nostalgia', +'skinname-cologneblue' => 'Cologne Blue', +'skinname-monobook' => 'MonoBook', +'skinname-myskin' => 'MySkin', +'skinname-chick' => 'Chick', +'skinname-simple' => 'Simple', +'skinname-modern' => 'Modern', + # Math options 'mw_math_png' => 'Always render PNG', 'mw_math_simple' => 'HTML if very simple or else PNG', diff --git a/maintenance/language/checkLanguage.inc b/maintenance/language/checkLanguage.inc index c0d699ca10..889d702bd5 100644 --- a/maintenance/language/checkLanguage.inc +++ b/maintenance/language/checkLanguage.inc @@ -74,7 +74,7 @@ class CheckLanguageCLI { return array( 'untranslated', 'duplicate', 'obsolete', 'variables', 'empty', 'plural', 'whitespace', 'xhtml', 'chars', 'links', 'unbalanced', 'namespace', - 'projecttalk', 'skin', 'magic', 'magic-old', 'magic-over', 'magic-case', + 'projecttalk', 'magic', 'magic-old', 'magic-over', 'magic-case', 'special', 'special-old', ); } @@ -85,7 +85,7 @@ class CheckLanguageCLI { */ protected function nonMessageChecks() { return array( - 'namespace', 'projecttalk', 'skin', 'magic', 'magic-old', 'magic-over', + 'namespace', 'projecttalk', 'magic', 'magic-old', 'magic-over', 'magic-case', 'special', 'special-old', ); } @@ -120,7 +120,6 @@ class CheckLanguageCLI { 'unbalanced' => 'getMessagesWithUnbalanced', 'namespace' => 'getUntranslatedNamespaces', 'projecttalk' => 'getProblematicProjectTalks', - 'skin' => 'getUntranslatedSkins', 'magic' => 'getUntranslatedMagicWords', 'magic-old' => 'getObsoleteMagicWords', 'magic-over' => 'getOverridingMagicWords', @@ -140,7 +139,6 @@ class CheckLanguageCLI { return array( 'namespace' => array( 'getNamespaceNames', 'en' ), 'projecttalk' => null, - 'skin' => array( 'getSkinNames', 'en' ), 'magic' => array( 'getMagicWords', 'en' ), 'magic-old' => array( 'getMagicWords', null ), 'magic-over' => array( 'getMagicWords', null ), @@ -169,7 +167,6 @@ class CheckLanguageCLI { 'unbalanced' => '$1 message(s) of $2 in $3 have unbalanced {[]}:', 'namespace' => '$1 namespace name(s) of $2 are not translated to $3, but exist in en:', 'projecttalk' => '$1 namespace name(s) and alias(es) in $3 are project talk namespaces without the parameter:', - 'skin' => '$1 skin name(s) of $2 are not translated to $3, but exist in en:', 'magic' => '$1 magic word(s) of $2 are not translated to $3, but exist in en:', 'magic-old' => '$1 magic word(s) of $2 do not exist in en, but exist in $3:', 'magic-over' => '$1 magic word(s) of $2 in $3 do not contain the original en word(s):', @@ -211,7 +208,6 @@ Check codes (ideally, all of them should result 0; all the checks are executed b * unbalanced: Messages which contains unequal numbers of opening {[ and closing ]}. * namespace: Namespace names that were not translated. * projecttalk: Namespace names and aliases where the project talk does not contain $1. - * skin: Skin names that were not translated. * magic: Magic words that were not translated. * magic-old: Magic words which do not exist. * magic-over: Magic words that override the original English word. diff --git a/maintenance/language/languages.inc b/maintenance/language/languages.inc index 9aecb4ce22..61ad287fd6 100644 --- a/maintenance/language/languages.inc +++ b/maintenance/language/languages.inc @@ -20,7 +20,6 @@ class languages { protected $mNamespaceNames; # Namespace names protected $mNamespaceAliases; # Namespace aliases - protected $mSkinNames; # Skin names protected $mMagicWords; # Magic words protected $mSpecialPageAliases; # Special page aliases @@ -79,7 +78,6 @@ class languages { if ( isset( $this->mRawMessages[$code] ) && isset( $this->mNamespaceNames[$code] ) && isset( $this->mNamespaceAliases[$code] ) && - isset( $this->mSkinNames[$code] ) && isset( $this->mMagicWords[$code] ) && isset( $this->mSpecialPageAliases[$code] ) ) { return; @@ -87,7 +85,6 @@ class languages { $this->mRawMessages[$code] = array(); $this->mNamespaceNames[$code] = array(); $this->mNamespaceAliases[$code] = array(); - $this->mSkinNames[$code] = array(); $this->mMagicWords[$code] = array(); $this->mSpecialPageAliases[$code] = array(); $filename = Language::getMessagesFileName( $code ); @@ -102,9 +99,6 @@ class languages { if ( isset( $namespaceAliases ) ) { $this->mNamespaceAliases[$code] = $namespaceAliases; } - if ( isset( $skinNames ) ) { - $this->mSkinNames[$code] = $skinNames; - } if ( isset( $magicWords ) ) { $this->mMagicWords[$code] = $magicWords; } @@ -236,18 +230,6 @@ class languages { return $this->mNamespaceAliases[$code]; } - /** - * Get skin names for a specific language. - * - * @param $code The language code. - * - * @return Skin names. - */ - public function getSkinNames( $code ) { - $this->loadFile( $code ); - return $this->mSkinNames[$code]; - } - /** * Get magic words for a specific language. * @@ -575,19 +557,6 @@ class languages { return $namespaces; } - /** - * Get the untranslated skin names. - * - * @param $code The language code. - * - * @return The untranslated skin names in this language. - */ - public function getUntranslatedSkins( $code ) { - $this->loadFile( 'en' ); - $this->loadFile( $code ); - return array_diff_key( $this->mSkinNames['en'], $this->mSkinNames[$code] ); - } - /** * Get the untranslated magic words. * diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index 7ac430c537..03a1e72a94 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -2164,6 +2164,16 @@ $wgMessageStructure = array( 'numauthors', 'numtalkauthors', ), + 'skin' => array( + 'skinname-standard', + 'skinname-nostalgia', + 'skinname-cologneblue', + 'skinname-monobook', + 'skinname-myskin', + 'skinname-chick', + 'skinname-simple', + 'skinname-modern', + ), 'math' => array( 'mw_math_png', 'mw_math_simple', @@ -2972,6 +2982,7 @@ XHTML id names.", 'attribution' => 'Attribution', 'spamprotection' => 'Spam protection', 'info' => 'Info page', + 'skin' => 'Skins names', 'math' => 'Math options', 'patrolling' => 'Patrolling', 'patrol-log' => 'Patrol log', -- 2.20.1