r63628 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63627‎ | r63628 | r63629 >
Date:02:43, 12 March 2010
Author:neilk
Status:deferred (Comments)
Tags:
Comment:
language menus, done less wrong
Modified paths:
  • /branches/js2-work/phase3/js/mwEmbed/modules/UploadWizard/loader.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/UploadWizard/mw.Language.js (added) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/UploadWizard/mw.UploadWizard.js (modified) (history)

Diff [purge]

Index: branches/js2-work/phase3/js/mwEmbed/modules/UploadWizard/mw.Language.js
@@ -0,0 +1,473 @@
 2+mw.addMessages({
 3+ 'mwe-code-unknown': 'Unknown language'
 4+});
 5+
 6+
 7+// TODO: make this a more common library, used by this and TimedText
 8+mw.Language = {
 9+
 10+ initialized: false,
 11+
 12+ UNKNOWN: 0,
 13+
 14+ /**
 15+ * List of all languages mediaWiki supports ( Avoid an api call to get this same info )
 16+ * http://commons.wikimedia.org/w/api.php?action=query&meta=siteinfo&siprop=languages&format=jsonfm
 17+ *
 18+ * Languages sorted by name, using tools in $SVNROOT/mediawiki/trunk/tools/langcodes
 19+ * This is somewhat better than sorting by code (which produces totally bizarre results) but is not
 20+ * a true lexicographic sort
 21+ */
 22+ languages: [
 23+ { code: "ace", text: "Ac\u00e8h" },
 24+ { code: "af", text: "Afrikaans" },
 25+ { code: "ak", text: "Akan" },
 26+ { code: "als", text: "Alemannisch" }, // } XXX someone fix this please
 27+ { code: "gsw", text: "Alemannisch" }, // }
 28+ { code: "ang", text: "Anglo-Saxon" },
 29+ { code: "an", text: "Aragon\u00e9s" },
 30+ { code: "roa-rup", text: "Arm\u00e3neashce" },
 31+ { code: "frp", text: "Arpetan" },
 32+ { code: "ast", text: "Asturianu" },
 33+ { code: "gn", text: "Ava\u00f1e'\u1ebd" },
 34+ { code: "ay", text: "Aymar aru" },
 35+ { code: "az", text: "Az\u0259rbaycan" },
 36+ { code: "id", text: "Bahasa Indonesia" },
 37+ { code: "ms", text: "Bahasa Melayu" },
 38+ { code: "bm", text: "Bamanankan" },
 39+ { code: "map-bms", text: "Basa Banyumasan" },
 40+ { code: "jv", text: "Basa Jawa" },
 41+ { code: "su", text: "Basa Sunda" },
 42+ { code: "bcl", text: "Bikol Central" },
 43+ { code: "bi", text: "Bislama" },
 44+ { code: "bar", text: "Boarisch" },
 45+ { code: "bs", text: "Bosanski" },
 46+ { code: "br", text: "Brezhoneg" },
 47+ { code: "en-gb", text: "British English" },
 48+ { code: "nan", text: "B\u00e2n-l\u00e2m-g\u00fa" },
 49+ { code: "zh-min-nan", text: "B\u00e2n-l\u00e2m-g\u00fa" },
 50+ { code: "ca", text: "Catal\u00e0" },
 51+ { code: "ceb", text: "Cebuano" },
 52+ { code: "ch", text: "Chamoru" },
 53+ { code: "cbk-zam", text: "Chavacano de Zamboanga" },
 54+ { code: "ny", text: "Chi-Chewa" },
 55+ { code: "cho", text: "Choctaw" },
 56+ { code: "sei", text: "Cmique Itom" },
 57+ { code: "co", text: "Corsu" },
 58+ { code: "cy", text: "Cymraeg" },
 59+ { code: "da", text: "Dansk" },
 60+ { code: "dk", text: "Dansk (deprecated:da)" }, // XXX deprecated?
 61+ { code: "pdc", text: "Deitsch" },
 62+ { code: "de", text: "Deutsch" },
 63+ { code: "de-formal", text: "Deutsch (Sie-Form)" },
 64+ { code: "nv", text: "Din\u00e9 bizaad" },
 65+ { code: "dsb", text: "Dolnoserbski" },
 66+ { code: "na", text: "Dorerin Naoero" },
 67+ { code: "mh", text: "Ebon" },
 68+ { code: "et", text: "Eesti" },
 69+ { code: "eml", text: "Emili\u00e0n e rumagn\u00f2l" },
 70+ { code: "en", text: "English" },
 71+ { code: "es", text: "Espa\u00f1ol" },
 72+ { code: "eo", text: "Esperanto" },
 73+ { code: "ext", text: "Estreme\u00f1u" },
 74+ { code: "eu", text: "Euskara" },
 75+ { code: "ee", text: "E\u028begbe" },
 76+ { code: "hif", text: "Fiji Hindi" }, // } XXX fix this
 77+ { code: "hif-latn", text: "Fiji Hindi" }, // }
 78+ { code: "fr", text: "Fran\u00e7ais" },
 79+ { code: "frc", text: "Fran\u00e7ais canadien" },
 80+ { code: "fy", text: "Frysk" },
 81+ { code: "ff", text: "Fulfulde" },
 82+ { code: "fur", text: "Furlan" },
 83+ { code: "fo", text: "F\u00f8royskt" },
 84+ { code: "ga", text: "Gaeilge" },
 85+ { code: "gv", text: "Gaelg" },
 86+ { code: "sm", text: "Gagana Samoa" },
 87+ { code: "gag", text: "Gagauz" },
 88+ { code: "gl", text: "Galego" },
 89+ { code: "aln", text: "Geg\u00eb" },
 90+ { code: "gd", text: "G\u00e0idhlig" },
 91+ { code: "ki", text: "G\u0129k\u0169y\u0169" },
 92+ { code: "hak", text: "Hak-k\u00e2-fa" },
 93+ { code: "haw", text: "Hawai`i" },
 94+ { code: "ho", text: "Hiri Motu" },
 95+ { code: "hsb", text: "Hornjoserbsce" },
 96+ { code: "hr", text: "Hrvatski" },
 97+ { code: "io", text: "Ido" },
 98+ { code: "ig", text: "Igbo" },
 99+ { code: "ilo", text: "Ilokano" },
 100+ { code: "hil", text: "Ilonggo" },
 101+ { code: "ia", text: "Interlingua" },
 102+ { code: "ie", text: "Interlingue" },
 103+ { code: "it", text: "Italiano" },
 104+ { code: "ik", text: "I\u00f1upiak" },
 105+ { code: "jut", text: "Jysk" },
 106+ { code: "kl", text: "Kalaallisut" },
 107+ { code: "kr", text: "Kanuri" },
 108+ { code: "pam", text: "Kapampangan" },
 109+ { code: "csb", text: "Kasz\u00ebbsczi" },
 110+ { code: "kw", text: "Kernowek" },
 111+ { code: "krj", text: "Kinaray-a" },
 112+ { code: "rw", text: "Kinyarwanda" },
 113+ { code: "rn", text: "Kirundi" },
 114+ { code: "sw", text: "Kiswahili" },
 115+ { code: "kg", text: "Kongo" },
 116+ { code: "avk", text: "Kotava" },
 117+ { code: "ht", text: "Krey\u00f2l ayisyen" },
 118+ { code: "kri", text: "Krio" },
 119+ { code: "ku", text: "Kurd\u00ee \/ \u0643\u0648\u0631\u062f\u06cc" },
 120+ { code: "kiu", text: "Kurmanc\u00ee" },
 121+ { code: "kj", text: "Kwanyama" },
 122+ { code: "lad", text: "Ladino" },
 123+ { code: "la", text: "Latina" },
 124+ { code: "lv", text: "Latvie\u0161u" },
 125+ { code: "lt", text: "Lietuvi\u0173" },
 126+ { code: "li", text: "Limburgs" },
 127+ { code: "lfn", text: "Lingua Franca Nova" },
 128+ { code: "ln", text: "Ling\u00e1la" },
 129+ { code: "jbo", text: "Lojban" },
 130+ { code: "lg", text: "Luganda" },
 131+ { code: "lmo", text: "Lumbaart" },
 132+ { code: "lb", text: "L\u00ebtzebuergesch" },
 133+ { code: "lij", text: "L\u00edguru" },
 134+ { code: "hu", text: "Magyar" },
 135+ { code: "mg", text: "Malagasy" },
 136+ { code: "mt", text: "Malti" },
 137+ { code: "arn", text: "Mapudungun" },
 138+ { code: "mwl", text: "Mirand\u00e9s" },
 139+ { code: "mus", text: "Mvskoke" },
 140+ { code: "cdo", text: "M\u00ecng-d\u0115\u0324ng-ng\u1e73\u0304" },
 141+ { code: "mi", text: "M\u0101ori" },
 142+ { code: "fj", text: "Na Vosa Vakaviti" },
 143+ { code: "nl", text: "Nederlands" },
 144+ { code: "nds-nl", text: "Nedersaksisch" },
 145+ { code: "niu", text: "Niu\u0113" },
 146+ { code: "nap", text: "Nnapulitano" },
 147+ { code: "pih", text: "Norfuk \/ Pitkern" },
 148+ { code: "nb", text: "Norsk (bokm\u00e5l)" },
 149+ { code: "no", text: "Norsk (bokm\u00e5l)" },
 150+ { code: "nn", text: "Norsk (nynorsk)" },
 151+ { code: "nrm", text: "Nouormand" },
 152+ { code: "nov", text: "Novial" },
 153+ { code: "nah", text: "N\u0101huatl" },
 154+ { code: "cr", text: "N\u0113hiyaw\u0113win \/ \u14c0\u1426\u1403\u152d\u140d\u140f\u1423" },
 155+ { code: "uz", text: "O'zbek" },
 156+ { code: "oc", text: "Occitan" },
 157+ { code: "om", text: "Oromoo" },
 158+ { code: "ng", text: "Oshiwambo" },
 159+ { code: "hz", text: "Otsiherero" },
 160+ { code: "pag", text: "Pangasinan" },
 161+ { code: "pap", text: "Papiamentu" },
 162+ { code: "pfl", text: "Pf\u00e4lzisch" },
 163+ { code: "pcd", text: "Picard" },
 164+ { code: "pms", text: "Piemont\u00e8is" },
 165+ { code: "nds", text: "Plattd\u00fc\u00fctsch" },
 166+ { code: "pdt", text: "Plautdietsch" },
 167+ { code: "pl", text: "Polski" },
 168+ { code: "pt", text: "Portugu\u00eas" },
 169+ { code: "pt-br", text: "Portugu\u00eas do Brasil" },
 170+ { code: "aa", text: "Qaf\u00e1r af" },
 171+ { code: "kaa", text: "Qaraqalpaqsha" },
 172+ { code: "crh", text: "Q\u0131r\u0131mtatarca" },
 173+ { code: "ty", text: "Reo M\u0101`ohi" },
 174+ { code: "ksh", text: "Ripoarisch" },
 175+ { code: "rmy", text: "Romani" },
 176+ { code: "ro", text: "Rom\u00e2n\u0103" },
 177+ { code: "rm", text: "Rumantsch" },
 178+ { code: "qu", text: "Runa Simi" },
 179+ { code: "sc", text: "Sardu" },
 180+ { code: "sdc", text: "Sassaresu" },
 181+ { code: "sli", text: "Schl\u00e4sch" },
 182+ { code: "de-ch", text: "Schweizer Hochdeutsch" },
 183+ { code: "sco", text: "Scots" },
 184+ { code: "stq", text: "Seeltersk" },
 185+ { code: "st", text: "Sesotho" },
 186+ { code: "nso", text: "Sesotho sa Leboa" },
 187+ { code: "tn", text: "Setswana" },
 188+ { code: "sq", text: "Shqip" },
 189+ { code: "ss", text: "SiSwati" },
 190+ { code: "scn", text: "Sicilianu" },
 191+ { code: "loz", text: "Silozi" },
 192+ { code: "simple", text: "Simple English" },
 193+ { code: "sk", text: "Sloven\u010dina" },
 194+ { code: "sl", text: "Sloven\u0161\u010dina" },
 195+ { code: "so", text: "Soomaaliga" },
 196+ { code: "ckb", text: "Soran\u00ee \/ \u06a9\u0648\u0631\u062f\u06cc" },
 197+ { code: "srn", text: "Sranantongo" },
 198+ { code: "sr-el", text: "Srpski (latinica)" },
 199+ { code: "sh", text: "Srpskohrvatski \/ \u0421\u0440\u043f\u0441\u043a\u043e\u0445\u0440\u0432\u0430\u0442\u0441\u043a\u0438" },
 200+ { code: "fi", text: "Suomi" },
 201+ { code: "sv", text: "Svenska" },
 202+ { code: "se", text: "S\u00e1megiella" },
 203+ { code: "sg", text: "S\u00e4ng\u00f6" },
 204+ { code: "tl", text: "Tagalog" },
 205+ { code: "kab", text: "Taqbaylit" },
 206+ { code: "roa-tara", text: "Tarand\u00edne" },
 207+ { code: "rif", text: "Tarifit" },
 208+ { code: "tt-latn", text: "Tatar\u00e7a" },
 209+ { code: "shi", text: "Ta\u0161l\u1e25iyt" },
 210+ { code: "tet", text: "Tetun" },
 211+ { code: "vi", text: "Ti\u1ebfng Vi\u1ec7t" },
 212+ { code: "tpi", text: "Tok Pisin" },
 213+ { code: "tokipona", text: "Toki Pona" },
 214+ { code: "tp", text: "Toki Pona (deprecated:tokipona)" }, // XXX deprecated?
 215+ { code: "chy", text: "Tsets\u00eahest\u00e2hese" },
 216+ { code: "ve", text: "Tshivenda" },
 217+ { code: "tw", text: "Twi" },
 218+ { code: "tk", text: "T\u00fcrkmen\u00e7e" },
 219+ { code: "tr", text: "T\u00fcrk\u00e7e" },
 220+ { code: "ug-latn", text: "Uyghurche\u200e" },
 221+ { code: "ug", text: "Uyghurche\u200e \/ \u0626\u06c7\u064a\u063a\u06c7\u0631\u0686\u06d5" },
 222+ { code: "za", text: "Vahcuengh" },
 223+ { code: "vep", text: "Vepsan kel'" },
 224+ { code: "ruq", text: "Vl\u0103he\u015fte" },
 225+ { code: "ruq-latn", text: "Vl\u0103he\u015fte" },
 226+ { code: "vo", text: "Volap\u00fck" },
 227+ { code: "vec", text: "V\u00e8neto" },
 228+ { code: "fiu-vro", text: "V\u00f5ro" },
 229+ { code: "vro", text: "V\u00f5ro" },
 230+ { code: "wa", text: "Walon" },
 231+ { code: "vls", text: "West-Vlams" },
 232+ { code: "war", text: "Winaray" },
 233+ { code: "wo", text: "Wolof" },
 234+ { code: "ts", text: "Xitsonga" },
 235+ { code: "yo", text: "Yor\u00f9b\u00e1" },
 236+ { code: "diq", text: "Zazaki" },
 237+ { code: "zea", text: "Ze\u00eauws" },
 238+ { code: "sn", text: "chiShona" },
 239+ { code: "tum", text: "chiTumbuka" },
 240+ { code: "ike-latn", text: "inuktitut" },
 241+ { code: "xh", text: "isiXhosa" },
 242+ { code: "zu", text: "isiZulu" },
 243+ { code: "to", text: "lea faka-Tonga" },
 244+ { code: "tg-latn", text: "tojik\u012b" },
 245+ { code: "is", text: "\u00cdslenska" },
 246+ { code: "de-at", text: "\u00d6sterreichisches Deutsch" },
 247+ { code: "szl", text: "\u015al\u016fnski" },
 248+ { code: "el", text: "\u0395\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03ac" },
 249+ { code: "pnt", text: "\u03a0\u03bf\u03bd\u03c4\u03b9\u03b1\u03ba\u03ac" },
 250+ { code: "av", text: "\u0410\u0432\u0430\u0440" },
 251+ { code: "ab", text: "\u0410\u04a7\u0441\u0443\u0430" },
 252+ { code: "ba", text: "\u0411\u0430\u0448\u04a1\u043e\u0440\u0442" },
 253+ { code: "be", text: "\u0411\u0435\u043b\u0430\u0440\u0443\u0441\u043a\u0430\u044f" },
 254+ { code: "be-tarask", text: "\u0411\u0435\u043b\u0430\u0440\u0443\u0441\u043a\u0430\u044f (\u0442\u0430\u0440\u0430\u0448\u043a\u0435\u0432\u0456\u0446\u0430)" },
 255+ { code: "be-x-old", text: "\u0411\u0435\u043b\u0430\u0440\u0443\u0441\u043a\u0430\u044f (\u0442\u0430\u0440\u0430\u0448\u043a\u0435\u0432\u0456\u0446\u0430)" },
 256+ { code: "bxr", text: "\u0411\u0443\u0440\u044f\u0430\u0434" },
 257+ { code: "bg", text: "\u0411\u044a\u043b\u0433\u0430\u0440\u0441\u043a\u0438" },
 258+ { code: "ruq-cyrl", text: "\u0412\u043b\u0430\u0445\u0435\u0441\u0442\u0435" },
 259+ { code: "inh", text: "\u0413\u0406\u0430\u043b\u0433\u0406\u0430\u0439 \u011eal\u011faj" },
 260+ { code: "os", text: "\u0418\u0440\u043e\u043d\u0430\u0443" },
 261+ { code: "kv", text: "\u041a\u043e\u043c\u0438" },
 262+ { code: "ky", text: "\u041a\u044b\u0440\u0433\u044b\u0437\u0447\u0430" },
 263+ { code: "lbe", text: "\u041b\u0430\u043a\u043a\u0443" },
 264+ { code: "lez", text: "\u041b\u0435\u0437\u0433\u0438" },
 265+ { code: "mk", text: "\u041c\u0430\u043a\u0435\u0434\u043e\u043d\u0441\u043a\u0438" },
 266+ { code: "mdf", text: "\u041c\u043e\u043a\u0448\u0435\u043d\u044c" },
 267+ { code: "mo", text: "\u041c\u043e\u043b\u0434\u043e\u0432\u0435\u043d\u044f\u0441\u043a\u044d" },
 268+ { code: "mn", text: "\u041c\u043e\u043d\u0433\u043e\u043b" },
 269+ { code: "ce", text: "\u041d\u043e\u0445\u0447\u0438\u0439\u043d" },
 270+ { code: "mhr", text: "\u041e\u043b\u044b\u043a \u041c\u0430\u0440\u0438\u0439" },
 271+ { code: "ru", text: "\u0420\u0443\u0441\u0441\u043a\u0438\u0439" },
 272+ { code: "sah", text: "\u0421\u0430\u0445\u0430 \u0442\u044b\u043b\u0430" },
 273+ { code: "cu", text: "\u0421\u043b\u043e\u0432\u0463\u0301\u043d\u044c\u0441\u043a\u044a \/ \u2c14\u2c0e\u2c11\u2c02\u2c21\u2c10\u2c20\u2c14\u2c0d\u2c1f" },
 274+ { code: "sr-ec", text: "\u0421\u0440\u043f\u0441\u043a\u0438 (\u045b\u0438\u0440\u0438\u043b\u0438\u0446\u0430)" },
 275+ { code: "sr", text: "\u0421\u0440\u043f\u0441\u043a\u0438 \/ Srpski" },
 276+ { code: "tt-cyrl", text: "\u0422\u0430\u0442\u0430\u0440\u0447\u0430" },
 277+ { code: "tt", text: "\u0422\u0430\u0442\u0430\u0440\u0447\u0430\/Tatar\u00e7a" },
 278+ { code: "tg", text: "\u0422\u043e\u04b7\u0438\u043a\u04e3" },
 279+ { code: "tg-cyrl", text: "\u0422\u043e\u04b7\u0438\u043a\u04e3" },
 280+ { code: "tyv", text: "\u0422\u044b\u0432\u0430 \u0434\u044b\u043b" },
 281+ { code: "udm", text: "\u0423\u0434\u043c\u0443\u0440\u0442" },
 282+ { code: "uk", text: "\u0423\u043a\u0440\u0430\u0457\u043d\u0441\u044c\u043a\u0430" },
 283+ { code: "xal", text: "\u0425\u0430\u043b\u044c\u043c\u0433" },
 284+ { code: "cv", text: "\u0427\u04d1\u0432\u0430\u0448\u043b\u0430" },
 285+ { code: "myv", text: "\u042d\u0440\u0437\u044f\u043d\u044c" },
 286+ { code: "kk", text: "\u049a\u0430\u0437\u0430\u049b\u0448\u0430" },
 287+ { code: "hy", text: "\u0540\u0561\u0575\u0565\u0580\u0565\u0576" },
 288+ { code: "yi", text: "\u05d9\u05d9\u05b4\u05d3\u05d9\u05e9" },
 289+ { code: "he", text: "\u05e2\u05d1\u05e8\u05d9\u05ea" },
 290+ { code: "ug-arab", text: "\u0626\u06c7\u064a\u063a\u06c7\u0631\u0686\u06d5" },
 291+ { code: "ur", text: "\u0627\u0631\u062f\u0648" },
 292+ { code: "ar", text: "\u0627\u0644\u0639\u0631\u0628\u064a\u0629" },
 293+ { code: "bqi", text: "\u0628\u062e\u062a\u064a\u0627\u0631\u064a" },
 294+ { code: "bcc", text: "\u0628\u0644\u0648\u0686\u06cc \u0645\u06a9\u0631\u0627\u0646\u06cc" },
 295+ { code: "sd", text: "\u0633\u0646\u068c\u064a" },
 296+ { code: "fa", text: "\u0641\u0627\u0631\u0633\u06cc" },
 297+ { code: "arz", text: "\u0645\u0635\u0631\u0649" },
 298+ { code: "mzn", text: "\u0645\u064e\u0632\u0650\u0631\u0648\u0646\u064a" },
 299+ { code: "ha", text: "\u0647\u064e\u0648\u064f\u0633\u064e" },
 300+ { code: "pnb", text: "\u067e\u0646\u062c\u0627\u0628\u06cc" },
 301+ { code: "ps", text: "\u067e\u069a\u062a\u0648" },
 302+ { code: "glk", text: "\u06af\u06cc\u0644\u06a9\u06cc" },
 303+ { code: "arc", text: "\u0710\u072a\u0721\u071d\u0710" },
 304+ { code: "dv", text: "\u078b\u07a8\u0788\u07ac\u0780\u07a8\u0784\u07a6\u0790\u07b0" },
 305+ { code: "ks", text: "\u0915\u0936\u094d\u092e\u0940\u0930\u0940 - (\u0643\u0634\u0645\u064a\u0631\u064a)" },
 306+ { code: "new", text: "\u0928\u0947\u092a\u093e\u0932 \u092d\u093e\u0937\u093e" },
 307+ { code: "ne", text: "\u0928\u0947\u092a\u093e\u0932\u0940" },
 308+ { code: "pi", text: "\u092a\u093e\u093f\u0934" },
 309+ { code: "hif-deva", text: "\u092b\u093c\u0940\u091c\u0940 \u0939\u093f\u0928\u094d\u0926\u0940" },
 310+ { code: "bh", text: "\u092d\u094b\u091c\u092a\u0941\u0930\u0940" },
 311+ { code: "mr", text: "\u092e\u0930\u093e\u0920\u0940" },
 312+ { code: "mai", text: "\u092e\u0948\u0925\u093f\u0932\u0940" },
 313+ { code: "sa", text: "\u0938\u0902\u0938\u094d\u0915\u0943\u0924" },
 314+ { code: "hi", text: "\u0939\u093f\u0928\u094d\u0926\u0940" },
 315+ { code: "as", text: "\u0985\u09b8\u09ae\u09c0\u09af\u09bc\u09be" },
 316+ { code: "bpy", text: "\u0987\u09ae\u09be\u09b0 \u09a0\u09be\u09b0\/\u09ac\u09bf\u09b7\u09cd\u09a3\u09c1\u09aa\u09cd\u09b0\u09bf\u09af\u09bc\u09be \u09ae\u09a3\u09bf\u09aa\u09c1\u09b0\u09c0" },
 317+ { code: "bn", text: "\u09ac\u09be\u0982\u09b2\u09be" },
 318+ { code: "pa", text: "\u0a2a\u0a70\u0a1c\u0a3e\u0a2c\u0a40" },
 319+ { code: "gu", text: "\u0a97\u0ac1\u0a9c\u0ab0\u0abe\u0aa4\u0ac0" },
 320+ { code: "or", text: "\u0b13\u0b21\u0b3c\u0b3f\u0b06" },
 321+ { code: "ta", text: "\u0ba4\u0bae\u0bbf\u0bb4\u0bcd" },
 322+ { code: "te", text: "\u0c24\u0c46\u0c32\u0c41\u0c17\u0c41" },
 323+ { code: "sma", text: "\u00c5arjelsaemien" },
 324+ { code: "kn", text: "\u0c95\u0ca8\u0ccd\u0ca8\u0ca1" },
 325+ { code: "tcy", text: "\u0ca4\u0cc1\u0cb3\u0cc1" },
 326+ { code: "ml", text: "\u0d2e\u0d32\u0d2f\u0d3e\u0d33\u0d02" },
 327+ { code: "si", text: "\u0dc3\u0dd2\u0d82\u0dc4\u0dbd" },
 328+ { code: "th", text: "\u0e44\u0e17\u0e22" },
 329+ { code: "lo", text: "\u0ea5\u0eb2\u0ea7" },
 330+ { code: "dz", text: "\u0f47\u0f7c\u0f44\u0f0b\u0f41" },
 331+ { code: "bo", text: "\u0f56\u0f7c\u0f51\u0f0b\u0f61\u0f72\u0f42" },
 332+ { code: "my", text: "\u1019\u103c\u1014\u103a\u1019\u102c\u1018\u102c\u101e\u102c" },
 333+ { code: "cs", text: "\u010cesky" },
 334+ { code: "xmf", text: "\u10db\u10d0\u10e0\u10d2\u10d0\u10da\u10e3\u10e0\u10d8" },
 335+ { code: "ka", text: "\u10e5\u10d0\u10e0\u10d7\u10e3\u10da\u10d8" },
 336+ { code: "ti", text: "\u1275\u130d\u122d\u129b" },
 337+ { code: "am", text: "\u12a0\u121b\u122d\u129b" },
 338+ { code: "chr", text: "\u13e3\u13b3\u13a9" },
 339+ { code: "ike-cans", text: "\u1403\u14c4\u1483\u144e\u1450\u1466" },
 340+ { code: "iu", text: "\u1403\u14c4\u1483\u144e\u1450\u1466\/inuktitut" },
 341+ { code: "km", text: "\u1797\u17b6\u179f\u17b6\u1781\u17d2\u1798\u17c2\u179a" },
 342+ { code: "bat-smg", text: "\u017demait\u0117\u0161ka" },
 343+ { code: "bug", text: "\u1a05\u1a14 \u1a15\u1a18\u1a01\u1a17" },
 344+ { code: "grc", text: "\u1f08\u03c1\u03c7\u03b1\u03af\u03b1 \u1f11\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u1f74" },
 345+ { code: "ku-latn", text: "\u202aKurd\u00ee (lat\u00een\u00ee)\u202c" },
 346+ { code: "kk-tr", text: "\u202aQazaq\u015fa (T\u00fcrk\u00efya)\u202c" },
 347+ { code: "kk-latn", text: "\u202aQazaq\u015fa (lat\u0131n)\u202c" },
 348+ { code: "crh-latn", text: "\u202aQ\u0131r\u0131mtatarca (Latin)\u202c" },
 349+ { code: "ckb-latn", text: "\u202aSoran\u00ee (lat\u00een\u00ee)\u202c" },
 350+ { code: "crh-cyrl", text: "\u202a\u041a\u044a\u044b\u0440\u044b\u043c\u0442\u0430\u0442\u0430\u0440\u0434\u0436\u0430 (\u041a\u0438\u0440\u0438\u043b\u043b)\u202c" },
 351+ { code: "kk-cyrl", text: "\u202a\u049a\u0430\u0437\u0430\u049b\u0448\u0430 (\u043a\u0438\u0440\u0438\u043b)\u202c" },
 352+ { code: "kk-kz", text: "\u202a\u049a\u0430\u0437\u0430\u049b\u0448\u0430 (\u049a\u0430\u0437\u0430\u049b\u0441\u0442\u0430\u043d)\u202c" },
 353+ { code: "kk-arab", text: "\u202b\u0642\u0627\u0632\u0627\u0642\u0634\u0627 (\u062a\u0674\u0648\u062a\u06d5)\u202c" },
 354+ { code: "kk-cn", text: "\u202b\u0642\u0627\u0632\u0627\u0642\u0634\u0627 (\u062c\u06c7\u0646\u06af\u0648)\u202c" },
 355+ { code: "ku-arab", text: "\u202b\u0643\u0648\u0631\u062f\u064a (\u0639\u06d5\u0631\u06d5\u0628\u06cc)\u202c" },
 356+ { code: "ckb-arab", text: "\u202b\u06a9\u0648\u0631\u062f\u06cc (\u0639\u06d5\u0631\u06d5\u0628\u06cc)\u202c" },
 357+ { code: "zh", text: "\u4e2d\u6587" },
 358+ { code: "zh-cn", text: "\u4e2d\u6587(\u4e2d\u56fd\u5927\u9646)" },
 359+ { code: "zh-tw", text: "\u4e2d\u6587(\u53f0\u7063)" },
 360+ { code: "zh-sg", text: "\u4e2d\u6587(\u65b0\u52a0\u5761)" },
 361+ { code: "zh-mo", text: "\u4e2d\u6587(\u6fb3\u9580)" },
 362+ { code: "zh-hans", text: "\u4e2d\u6587(\u7b80\u4f53)" },
 363+ { code: "zh-hant", text: "\u4e2d\u6587(\u7e41\u9ad4)" },
 364+ { code: "zh-hk", text: "\u4e2d\u6587(\u9999\u6e2f)" },
 365+ { code: "zh-my", text: "\u4e2d\u6587(\u9a6c\u6765\u897f\u4e9a)" },
 366+ { code: "wuu", text: "\u5434\u8bed" },
 367+ { code: "lzh", text: "\u6587\u8a00" },
 368+ { code: "zh-classical", text: "\u6587\u8a00" },
 369+ { code: "ja", text: "\u65e5\u672c\u8a9e" },
 370+ { code: "yue", text: "\u7cb5\u8a9e" },
 371+ { code: "zh-yue", text: "\u7cb5\u8a9e" },
 372+ { code: "gan", text: "\u8d1b\u8a9e" },
 373+ { code: "gan-hant", text: "\u8d1b\u8a9e(\u7e41\u9ad4)" },
 374+ { code: "gan-hans", text: "\u8d63\u8bed(\u7b80\u4f53)" },
 375+ { code: "ii", text: "\ua187\ua259" },
 376+ { code: "ko", text: "\ud55c\uad6d\uc5b4" },
 377+ { code: "ko-kp", text: "\ud55c\uad6d\uc5b4 (\uc870\uc120)" },
 378+ { code: "got", text: "\ud800\udf32\ud800\udf3f\ud800\udf44\ud800\udf39\ud800\udf43\ud800\udf3a" },
 379+ ],
 380+
 381+ // cache some useful objects
 382+ // 1) mostly ready-to-go language HTML menu. When/if we upgrade, make it a jQuery combobox
 383+ // 2) dict of language code to name -- useful for testing for existence, maybe other things.
 384+ initialize: function() {
 385+ if (mw.Language.initialized) {
 386+ return;
 387+ }
 388+ mw.Language._codes = {};
 389+ var select = $j('<select/>');
 390+ $j.each(mw.Language.languages, function(i, language) {
 391+ select.append(
 392+ $j('<option>')
 393+ .attr('value', language.code)
 394+ .append(language.text)
 395+ );
 396+ mw.Language._codes[language.code] = language.text;
 397+ });
 398+ mw.Language.$_select = select;
 399+ mw.Language.initialized = true;
 400+ },
 401+
 402+ getMenu: function(id, code, withUnknown) {
 403+ mw.Language.initialize();
 404+ var $select = mw.Language.$_select.clone();
 405+ $select.attr('id', id)
 406+ .attr('name', id);
 407+ if (withUnknown) {
 408+ // n.b. MediaWiki LanguageHandler has ability to add custom label for 'Unknown'; possibly as pseudo-label
 409+ $select.prepend($j('<option>').attr('value', mw.Language.UNKNOWN).append(gM('mwe-code-unknown')));
 410+ }
 411+ if (code !== undefined) {
 412+ $select.val(mw.Language.getClosest(code));
 413+ }
 414+ return $select.get(0);
 415+ },
 416+
 417+ /* logic from MediaWiki:LanguageHandler.js */
 418+ // handle null cases, special cases for some Chinese variants
 419+ // Otherwise, if handed "foo-bar-baz" language, try to match most specific language,
 420+ // "foo-bar-baz", then "foo-bar", then "foo"
 421+ getClosest: function(code) {
 422+ mw.Language.initialize();
 423+ if (typeof (code) != 'string' || code === null || code.length === 0) {
 424+ return undefined;
 425+ }
 426+ if (code == 'nan' || code == 'minnan') {
 427+ return 'zh-min-nan';
 428+ } else if (mw.Language._codes[code] !== undefined) {
 429+ return code;
 430+ }
 431+ return mw.Language.getClosest(code.substring(0, code.indexOf('-')));
 432+ },
 433+
 434+ // XXX n.b. there are a lot of "closest matching language" features in older MediaWiki:LanguageHandler; we will have to emulate
 435+
 436+
 437+ // enhance a simple text input to be an autocompleting language menu
 438+ // this will work when/if we move to jQuery 1.4. As of now the autocomplete is too underpowered for our needs without
 439+ // serious hackery
 440+ /*
 441+ $j.fn.languageMenu = function(options) {
 442+ var _this = this;
 443+ _this.autocomplete(null, {
 444+ minChars: 0,
 445+ width: 310,
 446+ selectFirst: true,
 447+ autoFill: true,
 448+ mustMatch: true,
 449+ matchContains: false,
 450+ highlightItem: true,
 451+ scroll: true,
 452+ scrollHeight: 220,
 453+ formatItem: function(row, i, max, term) {
 454+ return row.code + " " + row.code;
 455+ },
 456+ formatMatch: function(row, i, max, term) {
 457+ return row.code + " " + row.code;
 458+ },
 459+ formatResult: function(row) {
 460+ return row.code;
 461+ }
 462+ }, mw.languages);
 463+
 464+ // and add a dropdown so we can see the thingy, too
 465+ return _this;
 466+ };
 467+ */
 468+
 469+ // XXX the concept of "internal language" exists in UploadForm.js -- seems to be how they handled i18n, with
 470+ // language codes that has underscores rather than dashes, ("en_gb" rather than the correct "en-gb").
 471+ // although other info such as Information boxes was recorded correctly.
 472+ // This is presumed not to apply to the shiny new world of JS2, where i18n is handled in other ways.
 473+
 474+}
Property changes on: branches/js2-work/phase3/js/mwEmbed/modules/UploadWizard/mw.Language.js
___________________________________________________________________
Name: svn:eol-style
1475 + native
Index: branches/js2-work/phase3/js/mwEmbed/modules/UploadWizard/loader.js
@@ -10,8 +10,8 @@
1111 });
1212
1313 // Add class file paths ( From ROOT )
14 - // "mw.UploadHandler" : "modules/UploadWizard/mw.UploadHandler.js",
15 - mw.addClassFilePaths( {
 14+ mw.addClassFilePaths( {
 15+ "mw.Language" : "modules/UploadWizard/mw.Language.js",
1616 "mw.UploadWizard" : "modules/UploadWizard/mw.UploadWizard.js",
1717 "mw.UploadApiProcessor" : "modules/UploadWizard/mw.UploadApiProcessor.js",
1818 "mw.IframeTransport" : "modules/UploadWizard/mw.IframeTransport.js",
@@ -22,7 +22,8 @@
2323 });
2424
2525 mw.addClassStyleSheets( {
26 - 'mw.UploadWizard' : 'modules/UploadWizard/css/uploadWizard.css'
 26+ 'mw.UploadWizard' : 'modules/UploadWizard/css/uploadWizard.css',
 27+ '$j.fn.autocomplete' : 'jquery/plugins/jquery.autocomplete.css'
2728 } );
2829
2930 //Set a variable for the base upload interface for easy inclution
@@ -35,7 +36,8 @@
3637 [
3738 '$j.ui.progressbar',
3839 '$j.ui.dialog',
39 - '$j.ui.draggable'
 40+ '$j.ui.draggable',
 41+ '$j.fn.autocomplete'
4042 ]
4143 ];
4244
@@ -54,6 +56,7 @@
5557
5658 //Add uploadwizard classes to a new "request" var:
5759 request.push( [
 60+ 'mw.Language',
5861 'mw.IframeTransport',
5962 'mw.ApiUploadHandler',
6063 'mw.UploadWizard'
@@ -71,6 +74,7 @@
7275
7376 //Add uploadwizard classes to a new "request" var:
7477 request.push( [
 78+ 'mw.Language',
7579 'mw.IframeTransport',
7680 'mw.ApiUploadHandler',
7781 'mw.MockUploadHandler',
Index: branches/js2-work/phase3/js/mwEmbed/modules/UploadWizard/mw.UploadWizard.js
@@ -23,8 +23,8 @@
2424 'mwe-upwiz-provenance-website': 'They come from a website',
2525 'mwe-upwiz-provenance-custom': 'Did you know? You can <a href="$1">customize</a> the default options you see here.',
2626 'mwe-upwiz-more-options': 'more options...',
27 - 'mwe-upwiz-desc-lang': 'Description in',
28 - 'mwe-upwiz-desc-lang-another': 'add a description in another language',
 27+ 'mwe-upwiz-desc': 'Description in',
 28+ 'mwe-upwiz-desc-another': 'add a description in another language',
2929 'mwe-upwiz-title': 'Title',
3030 'mwe-upwiz-categories-intro': 'Help people find your works by adding categories',
3131 'mwe-upwiz-categories-another': 'Add other categories',
@@ -42,7 +42,7 @@
4343 'mwe-upwiz-other': 'Other information',
4444 'mwe-upwiz-other-prefill': 'Free wikitext field',
4545 'mwe-upwiz-showall': 'show all',
46 - 'mwe-upwiz-desc-lang': 'Description in', // caution: FRAGMENT -- bad for i18n
 46+ 'mwe-upwiz-desc': 'Description in', // caution: FRAGMENT -- bad for i18n
4747
4848 'mwe-upwiz-upload-error-bad-filename-extension': 'This wiki does not accept filenames with the extension "$1".',
4949 'mwe-upwiz-upload-error-duplicate': 'This file was previously uploaded to this wiki.',
@@ -263,30 +263,23 @@
264264
265265 mw.UploadWizardDescription = function(languageCode) {
266266 var _this = this;
267 -
268 - // XXX obtain list of real languages from config
269 - var languageMenu = $j('<select name="lang" class="mwe-upwiz-desc-lang"></select>');
270267
271 - // this could be cached, and cloned as necessary...?
272 - var languages = mw.getConfig('languages');
273 - for (var i = 0; i < languages.length; i++) {
274 - var language = languages[i];
275 - var selected = "";
276 - if (language.code == languageCode) {
277 - selected = " selected";
278 - }
279 - var option = $j('<option value="' + language.code + selected + ">" + language.name + '</option>');
280 - languageMenu.append(option);
 268+ // Logic copied from MediaWiki:UploadForm.js
 269+ // Per request from Portuguese and Brazilian users, treat Brazilian Portuguese as Portuguese.
 270+ if (languageCode == 'pt-br') {
 271+ languageCode = 'pt';
 272+ } else if (languageCode == 'en-gb') {
 273+ languageCode = 'en';
281274 }
282275
283 -
284 - _this.languageMenu = languageMenu.get(0);
 276+ _this.languageMenu = mw.Language.getMenu("lang", languageCode);
 277+
285278 _this.description = $j('<input name="desc" class="mwe-upwiz-desc-lang-text" type="text" size="40"/>').get(0);
286279
287280 _this.removeCtrl = $j('<a class="mwe-upwiz-desc-lang-remove" href="#">x</a>').get(0);
288281 _this.removeCtrl.click = function () { _this.remove() };
289282
290 - _this.div = $j('<div class="mwe-upwiz-desc-lang"></div>')
 283+ _this.div = $j('<div class="mwe-upwiz-desc-lang-container"></div>')
291284 .append(_this.languageMenu)
292285 .append(_this.description)
293286 .append(_this.removeCtrl);
@@ -294,6 +287,7 @@
295288 };
296289
297290 mw.UploadWizardDescription.prototype = {
 291+
298292 remove: function() {
299293 // XXX todo
300294 },
@@ -320,10 +314,10 @@
321315
322316 _this.descriptionsContainerDiv =
323317 $j('<div class="mwe-upwiz-metadata-descriptions-container"></div>')
324 - .append( $j('<div class="mwe-upwiz-metadata-descriptions-title">' + gM('mwe-upwiz-desc-lang') + '</div>') )
 318+ .append( $j('<div class="mwe-upwiz-metadata-descriptions-title">' + gM('mwe-upwiz-desc') + '</div>') )
325319 .append(_this.descriptionsDiv)
326320 .append( $j('<div class="mwe-upwiz-metadata-descriptions-add"></div>')
327 - .append( $j('<a href="#">' + gM('mwe-upwiz-desc-lang-another') + '</a>').click( function() { _this.addDescription() } ) )
 321+ .append( $j('<a href="#">' + gM('mwe-upwiz-desc-another') + '</a>').click( function() { _this.addDescription() } ) )
328322 );
329323
330324
@@ -421,9 +415,9 @@
422416 var upload = result.upload;
423417 mw.log("populating from result");
424418 _this.setThumbnail(upload.filename, mw.getConfig('thumbnailWidth'));
425 - _this.setSource(upload. result);
 419+ //_this.setSource(upload. result);
426420
427 - _this.setFilename(upload.filename);
 421+ //_this.setFilename(upload.filename);
428422
429423 //_this.setDescription(); // is there anything worthwhile here? image comment?
430424 //_this.setDate(upload.metadata);
@@ -474,7 +468,6 @@
475469 if (data.query.pages[-1]) {
476470 // not found ? error
477471 }
478 - // this long chain of properties only works because this method expects exactly one result
479472 for ( var page_id in data.query.pages ) {
480473 var page = data.query.pages[ page_id ];
481474 if (! page.imageinfo ) {
@@ -692,7 +685,7 @@
693686 addUpload: function() {
694687 var _this = this;
695688 var idx = _this.uploads.length; // or?
696 - if (idx + 1 > _this.maxUploads) {
 689+ if (idx == _this.maxUploads) {
697690 return false;
698691 }
699692
@@ -718,7 +711,6 @@
719712 $j(ui.div).append(ui.removeCtrl);
720713
721714 upload.ui = ui;
722 -
723715 // handler -- usually ApiUploadHandler
724716 upload.handler = new _this.uploadHandlerClass(upload.ui);
725717
@@ -742,6 +734,11 @@
743735
744736 $j("#mwe-upwiz-files").append(upload.ui.div);
745737
 738+
 739+
 740+
 741+ //$j("#testac").languageMenu();
 742+
746743 // update the uploadUi to add files - we may be over limit
747744 _this.updateFileCounts();
748745

Comments

#Comment by Nikerabbit (talk | contribs)   09:24, 12 March 2010

Duplicating the language codes here is a maintenance problem. In addition you are creating inconsistency since in every other places they are consistently sorted by the language code.

#Comment by NeilK (talk | contribs)   18:37, 12 March 2010

Please see the comments on this revision for my response.

#Comment by NeilK (talk | contribs)   18:33, 12 March 2010

@Nikerabbit:

I agree that this will be a maintenance problem if kept around long-term, but we are sprinting to get a prototype out the door, just to test if our ideas about usability are going in the right direction. This definitely should be relocated to some common library.

I see you've done a lot of work with the localizations on MediaWiki -- I'm new to this and appreciate orientation towards the right thing to do.

I agree that this is inconsistent, but I would also argue that the existing situation could be improved. With 356 languages and an effectively random ordering from the user's point of view, some languages are just unfindable. Something has to be changed.

Let's assume that we want to have *some* canonical order in menus created by JS, the API, or PHP. Is there a place where we could establish that kind of canonical ordering?

#Comment by Nikerabbit (talk | contribs)   18:59, 12 March 2010

I'm not sure if the value we sort by is the core issue here. I think we need an another approach instead, for example incremental search which matches all three ways to refer to a language (language code, native name, name in the current interface language).

It seems that in this case user is not selecting his own language for first time, but instead a language for the text he is going to write. Would it not be better to list the language names in his/her interface language? The cldr extension provides those – to an extend. The coverage leaves quite much to desire, which is one reason not to sort using the language names, if the list contains translated and untranslated names. Also, the cldr extension is not currently active on Wikimedia, but Brion was positive about using it in the past.

In general, I do agree that sorting by language name is better than sorting by language code for normal users which we can't expect to know many language codes.

#Comment by NeilK (talk | contribs)   21:54, 12 March 2010

> Would it not be better to list the language names in his/her interface language? The cldr extension provides those

Ah, this looks really good. At least it's a start. We should be reusing the great work that's been done with the CLDR.

The best way IMO is to provide a list of names in the current interface language, plus the name in the target language. So when the interface is in English, we see things like:

  Chinese (中文)

Anyway, going translated means there are N**2 translations which has obvious scaling issues when we go to 356**2.

There are other usability issues. It seems to me that popular languages ought to be easier to find. And the variants ought to have less emphasis.

I'm starting to think the really right thing is to have some kind of multi-level menu. We show the top 20 languages in full translation, and then have some way to get to other languages, perhaps separated out by geography. e.g. "European languages" > "Northern European" > "Latvian". Or "Other" > "Constructed languages" > "Lojban".

Anyway this is just idle speculation and I need to learn more -- I will create a page on the Usability wiki sometime soon and will update this thread. Unfortunately I can't work on this right away.

Status & tagging log