From: Robin Pepermans Date: Sat, 10 Sep 2011 17:12:35 +0000 (+0000) Subject: * Change the message 'yourvariant' to a more descriptive one (might be a bit too... X-Git-Tag: 1.31.0-rc.0~27750 X-Git-Url: http://git.cyclocoop.org/%7B%7B%20url_for%28%27admin_vote_del%27%2C%20idvote=vote.voteid%29%20%7D%7D?a=commitdiff_plain;h=af5dc604f65a8641917189323e6761b510df9aa8;p=lhc%2Fweb%2Fwiklou.git * Change the message 'yourvariant' to a more descriptive one (might be a bit too long however), and remove it as an optional message. Also added a help message to explain it. * Make getVariantname fallback to the language name, and use that in Preferences. Shouldn't change the names in practice, but is a more logical implementation imho. * (Fix a typo in Language.php) --- diff --git a/includes/Preferences.php b/includes/Preferences.php index c6ed2f4cdb..9f4e5b2f42 100644 --- a/includes/Preferences.php +++ b/includes/Preferences.php @@ -276,13 +276,9 @@ class Preferences { if ( !$wgDisableLangConversion ) { $variants = $wgContLang->getVariants(); - $languages = Language::getLanguageNames(); foreach ( $variants as $v ) { $v = str_replace( '_', '-', strtolower( $v ) ); - if ( array_key_exists( $v, $languages ) ) { - // If it doesn't have a name, we'll pretend it doesn't exist - $variantArray[$v] = $languages[$v]; - } + $variantArray[$v] = $wgContLang->getVariantname( $v, false ); } $options = array(); @@ -297,6 +293,7 @@ class Preferences { 'type' => 'select', 'options' => $options, 'section' => 'personal/i18n', + 'help-message' => 'prefs-help-variant', ); } } diff --git a/languages/Language.php b/languages/Language.php index cf2c308b6e..f72801481f 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -506,10 +506,20 @@ class Language { * short names for language variants used for language conversion links. * * @param $code String + * @param $usemsg Use the "variantname-xyz" message if it exists * @return string */ - function getVariantname( $code ) { - return $this->getMessageFromDB( "variantname-$code" ); + function getVariantname( $code, $usemsg = true ) { + $msg = "variantname-$code"; + $codeArray = list( $rootCode ) = explode( '-', $code ); + if( $usemsg && wfMessage( $msg )->exists() ) { + return $this->getMessageFromDB( $msg ); + } elseif( $name = self::getLanguageName( $code ) ) { + return $name; # if it's defined as a language name, show that + } else { + # otherwise, output the language code + return $code; + } } /** @@ -2504,7 +2514,7 @@ class Language { /** * Normally we output all numbers in plain en_US style, that is * 293,291.235 for twohundredninetythreethousand-twohundredninetyone - * point twohundredthirtyfive. However this is not sutable for all + * point twohundredthirtyfive. However this is not suitable for all * languages, some such as Pakaran want ੨੯੩,੨੯੫.੨੩੫ and others such as * Icelandic just want to use commas instead of dots, and dots instead * of commas like "293.291,235". diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 18c0f51c5b..e555319f88 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -1841,7 +1841,8 @@ This cannot be undone.', 'prefs-registration-date-time' => '$1', # only translate this message to other languages if you have to change it 'yourrealname' => 'Real name:', 'yourlanguage' => 'Language:', -'yourvariant' => 'Variant:', # only translate this message to other languages if you have to change it +'yourvariant' => 'Content language variant:', +'prefs-help-variant' => 'Your preferred variant or orthography to display the content pages of this wiki in.', 'yournick' => 'New signature:', 'prefs-help-signature' => 'Comments on talk pages should be signed with "~~~~" which will be converted into your signature and a timestamp.', 'badsig' => 'Invalid raw signature. diff --git a/maintenance/language/messageTypes.inc b/maintenance/language/messageTypes.inc index 602263ddab..3195a65fe6 100644 --- a/maintenance/language/messageTypes.inc +++ b/maintenance/language/messageTypes.inc @@ -199,7 +199,6 @@ $wgOptionalMessages = array( 'userrights-irreversible-marker', 'tog-nolangconversion', 'tog-noconvertlink', - 'yourvariant', 'variantname-zh-hans', 'variantname-zh-hant', 'variantname-zh-cn',