* 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)
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();
'type' => 'select',
'options' => $options,
'section' => 'personal/i18n',
+ 'help-message' => 'prefs-help-variant',
);
}
}
* 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;
+ }
}
/**
/**
* 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".
'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.
'userrights-irreversible-marker',
'tog-nolangconversion',
'tog-noconvertlink',
- 'yourvariant',
'variantname-zh-hans',
'variantname-zh-hant',
'variantname-zh-cn',