r63651 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63650‎ | r63651 | r63652 >
Date:20:55, 12 March 2010
Author:neilk
Status:deferred
Tags:
Comment:
request unknown language as a code; also, have non-unknown default (english)
Modified paths:
  • /branches/js2-work/phase3/js/mwEmbed/modules/UploadWizard/mw.Language.js (modified) (history)

Diff [purge]

Index: branches/js2-work/phase3/js/mwEmbed/modules/UploadWizard/mw.Language.js
@@ -6,9 +6,11 @@
77 // TODO: make this a more common library, used by this and TimedText
88 mw.Language = {
99
 10+ defaultCode: 'en', // when we absolutely have no idea what language to preselect
 11+
1012 initialized: false,
1113
12 - UNKNOWN: 0,
 14+ UNKNOWN: 'unknown',
1315
1416 /**
1517 * List of all languages mediaWiki supports ( Avoid an api call to get this same info )
@@ -398,15 +400,15 @@
399401 mw.Language.initialized = true;
400402 },
401403
402 - getMenu: function(name, code, withUnknown) {
 404+ getMenu: function(name, code) {
403405 mw.Language.initialize();
404406 var $select = mw.Language.$_select.clone();
405407 $select.attr('name', name);
406 - if (withUnknown) {
 408+ if (code === mw.Language.UNKNOWN) {
407409 // n.b. MediaWiki LanguageHandler has ability to add custom label for 'Unknown'; possibly as pseudo-label
408410 $select.prepend($j('<option>').attr('value', mw.Language.UNKNOWN).append(gM('mwe-code-unknown')));
409 - }
410 - if (code !== undefined) {
 411+ $select.val(mw.Language.UNKNOWN);
 412+ } else if (code !== undefined) {
411413 $select.val(mw.Language.getClosest(code));
412414 }
413415 return $select.get(0);
@@ -419,7 +421,7 @@
420422 getClosest: function(code) {
421423 mw.Language.initialize();
422424 if (typeof (code) != 'string' || code === null || code.length === 0) {
423 - return undefined;
 425+ return mw.Language.defaultCode;
424426 }
425427 if (code == 'nan' || code == 'minnan') {
426428 return 'zh-min-nan';

Status & tagging log