http://www.mediawiki.org/wiki/Special:Code/MediaWiki/96723

Revision: 96723
Author:   robin
Date:     2011-09-10 17:12:35 +0000 (Sat, 10 Sep 2011)
Log Message:
-----------
* 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)

Modified Paths:
--------------
    trunk/phase3/includes/Preferences.php
    trunk/phase3/languages/Language.php
    trunk/phase3/languages/messages/MessagesEn.php
    trunk/phase3/maintenance/language/messageTypes.inc

Modified: trunk/phase3/includes/Preferences.php
===================================================================
--- trunk/phase3/includes/Preferences.php       2011-09-10 15:26:11 UTC (rev 
96722)
+++ trunk/phase3/includes/Preferences.php       2011-09-10 17:12:35 UTC (rev 
96723)
@@ -276,13 +276,9 @@
                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 @@
                                        'type' => 'select',
                                        'options' => $options,
                                        'section' => 'personal/i18n',
+                                       'help-message' => 'prefs-help-variant',
                                );
                        }
                }

Modified: trunk/phase3/languages/Language.php
===================================================================
--- trunk/phase3/languages/Language.php 2011-09-10 15:26:11 UTC (rev 96722)
+++ trunk/phase3/languages/Language.php 2011-09-10 17:12:35 UTC (rev 96723)
@@ -506,10 +506,20 @@
         * 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 @@
         /**
          * 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".

Modified: trunk/phase3/languages/messages/MessagesEn.php
===================================================================
--- trunk/phase3/languages/messages/MessagesEn.php      2011-09-10 15:26:11 UTC 
(rev 96722)
+++ trunk/phase3/languages/messages/MessagesEn.php      2011-09-10 17:12:35 UTC 
(rev 96723)
@@ -1841,7 +1841,8 @@
 '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 "<nowiki>~~~~</nowiki>" which will be converted into your signature and a 
timestamp.',
 'badsig'                        => 'Invalid raw signature.

Modified: trunk/phase3/maintenance/language/messageTypes.inc
===================================================================
--- trunk/phase3/maintenance/language/messageTypes.inc  2011-09-10 15:26:11 UTC 
(rev 96722)
+++ trunk/phase3/maintenance/language/messageTypes.inc  2011-09-10 17:12:35 UTC 
(rev 96723)
@@ -199,7 +199,6 @@
        'userrights-irreversible-marker',
        'tog-nolangconversion',
        'tog-noconvertlink',
-       'yourvariant',
        'variantname-zh-hans',
        'variantname-zh-hant',
        'variantname-zh-cn',


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to