r112095 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112094‎ | r112095 | r112096 >
Date:10:00, 22 February 2012
Author:nikerabbit
Status:ok (Comments)
Tags:i18nreview 
Comment:
Add language selector
Modified paths:
  • /trunk/extensions/Translate/lcadft/LCADFT.i18n.php (modified) (history)
  • /trunk/extensions/Translate/lcadft/SpecialTranslatorSignup.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/lcadft/LCADFT.i18n.php
@@ -20,6 +20,9 @@
2121 'lcadft-email-confirmed' => 'Your e-mail address is confirmed',
2222 'lcadft-email-unconfirmed' => 'Your e-mail address is not confirmed. $1',
2323 'lcadft-email-notset' => 'You have not provided an e-mail address. You can do that in your [[Special:Preferences|preferences]].',
 24+ 'lcadft-languages' => 'Languages',
 25+ 'lcadft-lang' => 'Language #$1',
 26+ 'lcadft-nolang' => 'Choose a language',
2427 'lcadft-contact' => 'Preferred contact methods',
2528 'lcadft-cmethod-email' => 'E-mail',
2629 'lcadft-cmethod-talkpage' => 'Talk page',
@@ -43,6 +46,9 @@
4447 'lcadft-emailstatus' => 'Label',
4548 'lcadft-email-unconfirmed' => 'Parameters:
4649 * $1 is a button which can be used to send confirmation email. Button text is {{msg-mw|mediawiki:confirmemail_send}}.',
 50+ 'lcadft-languages' => 'Fieldset header',
 51+ 'lcadft-lang' => 'Label for select, $1 is a numbeer',
 52+ 'lcadft-nolang' => 'First option in a language select',
4753 'lcadft-contact' => 'Fieldset header',
4854 'lcadft-cmethod-email' => 'Check option label',
4955 'lcadft-cmethod-talkpage' => 'Check option label',
Index: trunk/extensions/Translate/lcadft/SpecialTranslatorSignup.php
@@ -46,7 +46,7 @@
4747 );
4848 }
4949 public function getDataModel() {
50 - global $wgLCADFTContactMethods;
 50+ global $wgLCADFTContactMethods, $wgLang;
5151
5252 $m['username'] = array(
5353 'type' => 'info',
@@ -73,6 +73,33 @@
7474 'raw' => true,
7575 );
7676
 77+
 78+ $languages = Language::getLanguageNames();
 79+ ksort( $languages );
 80+
 81+ $options = array();
 82+ foreach ( $languages as $code => $name ) {
 83+ $display = wfBCP47( $code ) . ' - ' . $name;
 84+ $options[$display] = $code;
 85+ }
 86+
 87+ $options = array( wfMessage( 'lcadft-nolang' )->plain() => '' ) + $options;
 88+
 89+ for ( $i = 1; $i < 4; $i++ ) {
 90+ $m["lang-$i"] = array(
 91+ 'type' => 'select',
 92+ 'label-message' => array( "lcadft-lang", $wgLang->formatNum( $i ) ),
 93+ 'section' => 'languages',
 94+ 'options' => $options,
 95+ 'default' => $user->getOption( "lcadft-lang-$i" ),
 96+ );
 97+
 98+ if ( $i === 1 ) {
 99+ $m["lang-$i"]['default'] = $user->getOption( "lcadft-lang-$i", $wgLang->getCode() );
 100+ $m["lang-$i"]['required'] = true;
 101+ }
 102+ }
 103+
77104 foreach ( $wgLCADFTContactMethods as $method => $value ) {
78105 if ( $value === false ) {
79106 continue;

Comments

#Comment by Siebrand (talk | contribs)   19:28, 23 February 2012

Should we add a message key translatorsignup-summary with a basic introduction?

Something like: "Use this page to indicate which languages you are interested in translating in, and how and how often you would like to be contacted about new translation opportunities."

Sidenote: I think the data of this page can quite eventually nicely replace the Portal:Code/translators hack that's currently used for Special:SupportedLanguages (?).

Status & tagging log