Add support for Number grouping(commafy) based on CLDR number grouping patterns like...
[lhc/web/wiklou.git] / includes / Preferences.php
index d33822b..a955b6f 100644 (file)
@@ -276,13 +276,9 @@ class Preferences {
                if ( !$wgDisableLangConversion ) {
                        $variants = $wgContLang->getVariants();
 
-                       $languages = Language::getLanguageNames( true );
                        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',
                                );
                        }
                }
@@ -314,7 +311,7 @@ class Preferences {
 
                // show a preview of the old signature first
                $oldsigWikiText = $wgParser->preSaveTransform( "~~~", new Title, $user, new ParserOptions );
-               $oldsigHTML = $wgOut->parseInline( $oldsigWikiText );
+               $oldsigHTML = $wgOut->parseInline( $oldsigWikiText, true, true );
                $defaultPreferences['oldsig'] = array(
                        'type' => 'info',
                        'raw' => true,
@@ -1215,12 +1212,13 @@ class Preferences {
 
        /**
         * @param $user User
+        * @param $context IContextSource
         * @param $formClass string
         * @return HtmlForm
         */
-       static function getFormObject( $user, $formClass = 'PreferencesForm' ) {
+       static function getFormObject( $user, IContextSource $context, $formClass = 'PreferencesForm' ) {
                $formDescriptor = Preferences::getPreferences( $user );
-               $htmlForm = new $formClass( $formDescriptor, 'prefs' );
+               $htmlForm = new $formClass( $formDescriptor, $context, 'prefs' );
 
                $htmlForm->setId( 'mw-prefs-form' );
                $htmlForm->setSubmitText( wfMsg( 'saveprefs' ) );
@@ -1534,6 +1532,6 @@ class PreferencesForm extends HTMLForm {
         * Get the whole body of the form.
         */
        function getBody() {
-               return $this->displaySection( $this->mFieldTree, '', true );
+               return $this->displaySection( $this->mFieldTree, '', 'mw-prefsection-' );
        }
 }