1 module nxt.languages; 2 3 @safe pure: 4 5 import nxt.conv_ex : toDefaulted; 6 7 /** Language Code according to ISO 639-1 plus computer languages. 8 * 9 * See_Also: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes 10 * See_Also: http://www.mathguide.de/info/tools/languagecode.html 11 * See_Also: http://msdn.microsoft.com/en-us/library/ms533052(v=vs.85).aspx 12 */ 13 enum Lang 14 { 15 unknown, 16 nullValue = unknown, // `FlatHashMap` null support 17 holeValue, // `FlatHashMap` hole support 18 19 en, english = en, /// English 20 en_US, american_english = en_US, /// American. English 21 en_GB, british_english = en_GB, /// British English 22 en_CA, canadian_english = en_CA, /// Canadian English 23 // ac, /// TODO? 24 // ace, /// TODO? 25 // ai, /// TODO? 26 // ain, /// TODO? 27 af, afrikaans = af, afr = afrikaans, /// Afrikaans 28 ar, arabic = ar, /// Arabic 29 // ary, /// TODO? 30 // arc, /// TODO? 31 ae, avestan = ae, /// Avestan Iran (extinct) 32 ak, akan = ak, /// Akan 33 // akk, /// TODO? 34 an, aragonese = an, /// Aragonese 35 // ang, /// TODO? 36 as, assamese = as, /// Assamese 37 // ase, /// TODO? 38 // ast, /// TODO? 39 // ax, /// TODO? 40 az, azerbaijani = az, azeri = azerbaijani, /// Azerbaijani (Azeri) 41 hy, armenian = hy, /// Armenian: Armenia 42 eu, basque = eu, /// Basque: Spain, France 43 ba, baskhir = ba, /// Baskhir: Volga, Urals, Central Asia 44 // ban, /// TODO? 45 be, belarusian = be, /// Belarusian 46 // bj, /// TODO? 47 bn, bengali = bn, /// Bengali (Bangla): Bangladesh, India 48 br, breton = br, /// Breton: France 49 bs, bosnian = bs, /// Bosnian 50 bg, bulgarian = bg, bul = bulgarian, /// Bulgarian 51 bo, tibetan = bo, /// Tibetan 52 // bp, /// TODO? 53 // bt, /// TODO? 54 my, burmese = my, /// Burmese: Myanmar 55 zh, chinese = zh, /// Chinese (Mandarin, Putonghua): China, Singapore 56 crh, crimean = crh, /// Crimean Tatar 57 hr, croatian = hr, /// Croatian: Croatia 58 // cr, /// TODO? 59 ca, catalan = ca, valencian = catalan, cat = valencian, /// Catalan/Valencian (Spain) 60 cy, welch = cy, welsh = welch, cym = welsh, /// Welch: Wales, Heddwch, Tangnefedd 61 cs, czech = cs, ces = czech, /// Czech: Czech Republic 62 // csb, /// TODO? 63 da, danish = da, dan = danish, /// Danish: Denmark, Greenland 64 // ds, /// TODO? 65 // dsb, /// TODO? 66 nl, dutch = nl, flemish = dutch, /// Dutch (Flemish): Netherlands, Belgium 67 eo, esperanto = eo, /// Esperanto 68 et, estonian = et, /// Estonian 69 fi, finnish = fi, fin = finnish, /// Finnish: Finland, Sweden, Russia 70 fj, fijian = fj, /// Fijian: Fiji 71 fo, faroese = fo, /// Faroese (Faeroese): Faroe Islands 72 // fu, /// TODO? 73 fr, french = fr, fra = french, /// French: France, Belgium, Canada, Caribbean, West Africa, Polynesia 74 fr_ch, swiss_french, /// French (Switzerland) 75 gl, galician = gl, gallegan = galician, /// Galician (Gallegan): Spain, Portugal 76 gv, manx = gv, /// Manx: Isle of Man 77 de, german = de, deu = german, /// German: Germany, Austria, Switzerland, Liechtenstein, Italy, Belgium 78 el, greek = el, ell = greek, /// Greek: Greece, Cyprus 79 ha, hausa = ha, /// Hausa: Nigeria 80 haw, hawaiian = haw, /// Hawaiian: Hawaii 81 he, hebrew = he, /// Hebrew: Israel 82 // hs, /// TODO? 83 // hsb, /// TODO? 84 hi, hindi = hi, /// Hindi: India, Nepal, Uganda, Suriname 85 hu, hungarian = hu, /// Hungarian: Hungary, Romania, Slovakia 86 is_, icelandic = is_, /// Icelandic 87 io, ido = io, /// Ido: Nigeria 88 id, indonesian = id, /// Indonesian (Bahasa): Indonesia 89 ga, irish = ga, /// Irish: Ireland 90 it, italian = it, ita = italian, /// Italian: Italy, Switzerland 91 ja, japanese = ja, /// Japanese, 日本語: Japan 92 ka, georgian = ka, /// Georgian: Georgia 93 ku, kurdish = ku, /// Kurdish: Kurdistan (Turkey, Syria, Iran, Iraq) 94 kn, kannada = kn, /// Kannada: India 95 kk, kazakh = kk, /// Kazakh: Kazakhstan 96 km, khmer = km, /// Khmer: Cambodia 97 ko, korean = ko, /// Korean: Korea 98 ky, kirghiz = ky, kyrgyz = kirghiz, /// Kirghiz (Kyrgyz): Kirghizstan, China 99 lo, lao = lo, /// Lao: Laos 100 la, latin = la, lat = latin, /// Latin: Rome (extinct) 101 lt, lithuanian = lt, /// Lithuanian: Lithuania 102 lv, latvian = lv, /// Latvian: Latvia 103 jbo, /// lojban = jbo, /// Lojban 104 mk, macedonian = mk, /// Macedonian: Macedonia 105 nan, southern_min = nan, min_nan = southern_min, /// Min Nan: https://en.wikipedia.org/wiki/Southern_Min 106 mg, malagasy = mg, malgache = malagasy, /// Malagasy (Malgache): Madagascar 107 mn, mongolian = mn, /// Mongolian: Mongolia 108 ms, malay = ms, zsm = malay, /// Malay: Malaysia 109 mt, maltese = mt, /// Maltese: Malta 110 ne, nepali = ne, /// Nepali: Nepal 111 no, norwegian = no, nob = norwegian, /// Norwegian: Norway 112 ps, pashto = ps, /// Pashto: Afghanistan, Iran, Pakistan 113 fa, persian = fa, farsi = persian, /// Persian (Farsi): Iran, Iraq, Afghanistan, Pakistan, Azerbaijan 114 oc, occitan = oc, /// Occitan (Provençal, Languedocian): France 115 pl, polish = pl, /// Polish 116 pt, portuguese = pt, por = portuguese, /// Portuguese: Portugal, Brazil, Angola, Mozambique, Cape Verde, Guinea-Bissau 117 pt_BR, brazilian_portuguese = pt_BR, /// Brazilian Portuguese 118 ro, romanian = ro, /// Romanian: Romania, Hungary 119 ru, russian = ru, rus = russian, /// Russian 120 sa, sanskrit = sa, /// Sanskrit: India (extinct, liturgical) 121 // sc, /// TODO? 122 // scn, /// TODO? 123 si, sinhalese = si, /// Sinhalese: Sri Lanka 124 sm, samoan = sm, /// Samoan: Samoa 125 sco, scots = sco, /// Scots: Scotland 126 sq, albanian = sq, /// Albanian: Albania, Kosovo 127 // se, /// TODO? 128 // sy, /// TODO? 129 // syc, /// TODO? 130 te, telugu = te, /// Telugu: India 131 tl, tagalog = tl, pilipino = tagalog, /// Tagalog (Pilipino): Philippines 132 // tp, /// TODO? 133 // tpi, /// TODO? 134 gd, scottish_gaelic = gd, /// Scottish Gaelic: Scotland 135 sr, serbian = sr, /// Serbian: Serbia, Montenegro, Bosnia 136 sk, slovak = sk, slk = slovak, /// Slovak: Slovak Republic 137 sl, slovene = sl, slovenian = slovene, slv = slovenian, /// Slovene, Slovenian: Slovenia, Austria, Italy 138 es, spanish = es, spa = spanish, /// Spanish 139 // es_ar, spanishArgentina = es_ar, 140 // es_bo, spanishBolivia = es_bo, 141 sw, swahili = sw, swa = swahili, /// Swahili: East Africa 142 sv, swedish = sv, swe = swedish, /// Swedish 143 asv, ancientSwedish = asv, /// Ancient Swedish 144 tg, tajik = tg, /// Tajik: Tajikistan, Afghanistan 145 ta, tamil = ta, tam = tamil, /// Tamil: India 146 th, thai = th, tha = thai, /// Thai: Thailand 147 tr, turkish = tr, tur = turkish, /// Turkish: Turkey, Cyprus 148 tk, turkmen = tk, /// Turkmen: Turkmenistan, Afghanistan 149 uk, ukrainian = uk, ukr = ukrainian, /// Ukrainian 150 ur, urdu = ur, /// Urdu: Pakistan, India, Central Asia 151 uz, uzbek = uz, /// Uzbek: Uzbekistan, Central Asia, China 152 vi, vietnamese = vi, vie = vietnamese, /// Vietnamese: Viet Nam 153 vo, volapuk = vo, /// Volapük 154 wa, waloon = wa, wln = waloon, /// Waloon: Belgium 155 yi, yiddish = yi, yid = yiddish, /// Yiddish: Israel, USA, Russia 156 157 aa, afar = aa,/// Afar Ethiopia, Eritrea, Djibouti Salaamata 158 ab, abkhaz = ab,/// Abkhaz Caucasus needed! 159 afa, luganda = afa,/// Luganda Uganda Emirembe 160 akk, akkadian = akk,/// Akkadian Mesopotamia (extinct) (Salmu) 161 alg, abenaki = alg,/// Abenaki North America Okikiamgenoka, Kamignokawôgan 162 am, amharic = am,/// Amharic Ethopia, Egypt ሰላም (salām) 163 ang, /// Anglo Saxon (Old English) England (extinct) ᚠᚱᛁᚦ (friþ), Frið 164 arw, arawak = arw,/// Arawak Suriname, Guyana, Venezuela needed! 165 arc, aramaic = arc,/// Aramaic (Syriac, Assyrian) Iraq, Iran, Syria, and liturgical ܫܠܡܐ (shlamaa) 166 arn, mapundungun = arn,/// Mapundungun Chile Uvchin, Tügkülen 167 art, /// lojban = art,/// Lojban panpi 168 ast, asturian = ast,/// Asturian Spain Paz 169 at, haiti_creole = at, kreyol = haiti_creole, /// Haiti / Guiana Creole (Kreyol) Caribbean Lapè 170 aus, olkola = aus,/// Olkola Australia Erray 171 /// aus, /// Pintupi-Luritja Australia Yatanpa 172 /// aus, /// Wagiman Australia Nyimbur-ma 173 /// aus, /// Warlpiri Australia Iawa-nyinami 174 av, avar = av,/// Avar Caucasus Рекъел (reqel) 175 ay, aymara = ay,/// Aymara Bolivia Hacaña 176 bai, dschang = bai, yemba = dschang, /// Dschang (Yemba) Cameroon Mbwɛ´né 177 bas, basaa = bas,/// Basaa Cameroon SàN 178 bat, old_prussian = bat, sudovian = old_prussian, jatvingian = sudovian, /// Old Prussian, Sudovian (Jatvingian) Baltic (extinct) Pakajan 179 btk, batak = btk,/// Batak Indonesia Pardamean 180 bem, bemba = bem,/// Bemba Zambia Mutenden, Ukwikala mu 181 bh, bihari = bh,/// Bihari India needed! 182 bi, bislama = bi,/// Bislama Vanuatu Pís 183 bla, blackfoot = bla,/// Blackfoot North America Innaihtsi'iyi 184 bm, bambara = bm,/// Bambara Mali Here, Errébé 185 cai, /// Ch'ol (Tumbalá) Chiapas (Mexico) Ñʌch'chocoya 186 car, caribe = car,/// Caribe Venezuala, Suriname needed! 187 ce, chechen = ce,/// Chechen Chechnya (Caucasus) Машар (mashar) 188 ceb, cebuano = ceb,/// Cebuano Philippines Kalinaw, Kahusayan 189 ch, chamorro = ch,/// Chamorro Guam Minaggen 190 cho, choctaw = cho,/// Choctaw North America Achukma 191 chk, chuuk = chk,/// Chuuk Truk Kunammwey 192 chr, cherokee = chr,/// Cherokee (Tsalagi) North America ᏙᎯᏱ (dohiyi) 193 chy, cheyenne = chy,/// Cheyenne North America Nanomonsetôtse 194 co, corsican = co,/// Corsican Corsica (France) Pace 195 cop, coptic = cop,/// Coptic Egypt (extinct) and liturgical Ϩιρηνη (hirīnī) 196 cpe, /// Afro-Seminole North America needed! 197 cpf, cajun_french = cpf, acadian = cajun_french, /// Cajun French (Acadian, Kreyol Lwiziyen) Louisiana (USA) needed! 198 cr, cree = cr,/// Cree North America Wetaskiwin, Papayatik 199 crp, fanagolo = crp,/// Fanagolo South Africa Kutula 200 cu, /// Old Church Slavonic Eastern Europe (liturgical) Ми́ръ (mírə) 201 cv, chuvash = cv,/// Chuvash Russia needed! 202 del, lenape = del,/// Lenape (Delaware) North America Achwangundowagan 203 dua, duala = dua,/// Duala Cameroon Musango 204 dra, brahui = dra,/// Brahui Pakistan, Afghanistan, Iran (âsûdaî) 205 dv, divehi = dv,/// Divehi (Maldivian) Maldives ސުޅަ (sulha) 206 dz, dzongkha = dz,/// Dzongkha Bhutan གཞི་བདེ (gzhi-bde) 207 ee, ewe = ee,/// Ewe (Évé) West Africa Ŋutifafa 208 efi, efik = efi,/// Efik Nigeria Emem 209 enm, middle_english = enm, /// Middle English England (extinct) Pes, Pise, Pees, ... 210 ff, fula = ff, falani = fula, /// Fula (Falani) West Africa Jam 211 fiu, karelian = fiu,/// Karelian Russia, Finland Rauhu, Vienosti 212 fon, benin = fon,/// Fon Benin Fifâ 213 fro, /// Old French France Pais 214 fur, friulian = fur, frulan = friulian, /// Friulian (Frulan) Friuli (Italy) Pâs 215 fy, frisian = fy,/// Frisian Germany, Netherlands Frede 216 gez, /// Ge'ez Ethiopia, Eritrea (liturgical) ሰላም (salām) 217 gmh, /// Middle High German Central Europe (extinct) Vride 218 gn, guarani = gn,/// Guarani Bolivia, Paraguay, Brazil Apĭrĭvé, Ñerane'i, Py'aguapy 219 goh, /// Old High German Central Europe (extinct) Fridu 220 got, gothic = got,/// Gothic Central Europe (extinct) 221 grc, ancient_greek = grc,/// Ancient Greek Miditerranean (extinct) and liturgical Εἰρήνη (eirḗnē) 222 gu, gujarati = gu,/// Gujarati India, Pakistan શાંતિ (śānti) 223 hil, hiligaynon = hil,/// Hiligaynon (Ilongo) Philippines Paghidait 224 hmn, hmong = hmn,/// Hmong China, Viet Nam, Laos, Thailand Kev tiaj tus 225 ho, hiri_motu = ho,/// Hiri Motu Papua New Guinea Taim billong sikan 226 hz, herero = hz,/// Herero Southern Africa needed! 227 ia, interlingua = ia,/// Interlingua Pace 228 ie, interlingue = ie,/// Interlingue Pace 229 ig, igbo = ig,/// Igbo (Ibo) Nigeria Udo 230 ii, sichuan_yi = ii,/// Sichuan Yi China ꄮꐽ (te-njo) 231 in_, 232 ik, /// Iñupiaq Alaska Kiñuiñak, Tutqiun 233 ilo, ilocano = ilo,/// Ilocano Philippines Kappia 234 inh, ingush = inh,/// Ingush Ingutia (Caucasus) Машар (mashar) 235 iu, inuktitut = iu,/// Inuktitut Canada ᓴᐃᒻᒪᓯᒪᓂᖅ (saimmasimaniq) 236 jpr, /// Judeo-Persian (Bukharic) Mideast, Central Asia needed! 237 jrb, /// Judeo-Arabic Mideast, North Africa needed! 238 jv, javanese = jv,/// Javanese Indonesia Rukun 239 kab, kabyle = kab,/// Kabyle Algeria Lahna 240 kg, kongo = kg,/// Kongo Congo Kikœndi 241 ki, kikuyu = ki, gikuyu = kikuyu, /// Kikuyu (Gikuyu) Kenya Thayu 242 kj, kwanyama = kj, kuanyama = kwanyama, /// Kwanyama (Kuanyama) Angola, Namibia needed! 243 kl, greenlandic = kl, kalaallisut = greenlandic, /// Greenlandic (Kalaallisut) Greenland Irqigsiniq, Erĸigsineĸ 244 kos, kosraean = kos,/// Kosraean Micronesia Mihs 245 kr, kanuri = kr,/// Kanuri Niger, Nigeria needed! 246 ks, kashmiri = ks,/// Kashmiri Kashmir (India, Pakistan) امن (amn) 247 kv, komi = kv,/// Komi Russian Arctic needed! 248 kw, cornish = kw,/// Cornish Cornwall (extinct) Cres 249 lad, ladino = lad,/// Ladino (Judeo-Spanish) Turkey, Israel, North Africa Pas, פאש 250 lb, luxemburgish = lb,/// Luxemburgish (Lëtzebuergesch) Luxembourg Fridd, Fridden 251 lg, ganda = lg,/// Ganda Niger, Congo needed! 252 li, limburgan = li,/// Limburgan (Limburgish) Belgium Vreij 253 ln, lingala = ln,/// Lingala Congo Kímía 254 lol, mongo_nkundu = lol,/// Mongo-Nkundu Congo Bóoto 255 loz, lozi = loz,/// Lozi Zambia Nala 256 lu, luba_katanga = lu,/// Luba-Katanga Niger, Congo needed! 257 man, mandinka = man,/// Mandinka Senegal, Gambia, Guinea-Bissau Kayiroo 258 map, bisaya = map,/// Bisaya Brunei Kalinaw 259 mh, marshallese = mh,/// Marshallese Marshall Islands Ainemon 260 mi, maori = mi,/// Maori New Zealand Rangima'arie, Nohopuku, Rongo 261 mic, micmac = mic,/// Micmac North America Wôntôkóde 262 mis, ainu = mis,/// Ainu Japan アプンノ, あぷんの (apunno) 263 ml, malayalam = ml,/// Malayalam India സമാധാനം (samaadhaanam) 264 mno, manobo = mno,/// Manobo Philippines Linew 265 mo, moldavian = mo,/// Moldavian (Moldavan) Moldava Pace, Паче (pace) 266 mos, mossi = mos,/// Mossi (Moré) Burkina Faso Lâfí 267 mr, marathi = mr,/// Marathi India शांतता (śāntātā), शांती (śāntī) 268 mus, muskogee = mus,/// Muskogee (Creek) North America Ittimokla 269 myn, kekchi = myn,/// Kekchi Guatemala, Belize Tuktuquil usilal 270 na, nauruan = na,/// Nauruan Nauru Iow 271 nah, /// Náhuatl (Aztec) Mexico, Guatemala Tlamatcanemiliztli, Mocehuia 272 nd, north_ndebele = nd,/// North Ndebele Zimbabwe needed! 273 nds, old_saxon = nds, saxony = old_saxon, /// Old Saxon Saxony (extinct) Friðu 274 ng, ndonga = ng,/// Ndonga Angola, Namibia needed! 275 non, old_norse = non,/// Old Norse Scandinavia (extinct) ᚠᚱᛁᚦᚱ, Friðr 276 nr, south_ndebele = nr,/// South Ndebele Zimbabwe, Botswana needed! 277 nv, navajo = nv,/// Navajo (Navaho) North America K'é, Hozo 278 ny, chichewa = ny,/// Chichewa (Chewa, Nyanja) Malawi M'tendere 279 // om, oromo = om,/// Oromo Ethiopia, Kenya Nagaya, ነገየ (nagaya) 280 or, oriya = or,/// Oriya India needed! 281 // os, ossetic = os, ossetian = ossetic, /// Ossetic (Ossetian) Georgia, Russia needed! 282 oto, otomi = oto,/// Otomi Mexico Hmetho 283 pa, panjabi = pa, punjab = panjabi, /// Panjabi (Punjab) Pakistan, India ਸ਼ਾਂਤੀ (śānti) 284 // paa, /// Ekari Indonesia Muka-Muka 285 // pag, /// Pangasinan Philippines Kareenan 286 // pam, /// Pampangan (Kapampangan) Philippines Kapayapan 287 // pap, /// Papiamentu Netherlands Antilles Pas 288 // pau, /// Palauan Palau Búdech 289 // pi, /// Pali India Sāma, Santi 290 // qu, /// Quechua Peru Anka Kay, Qasikay, Aligu, Sonqo Tiaykuy 291 // rap, /// Rapanui Chile Kiba-kiba, Pava 292 // rm, /// Raeto-Romance (Romansch) Switzerland Pasch 293 // rn, /// Rundi (Kirundi, Urundi) Burundi Amahoro 294 // rom, /// Romany (Gypsy, Tsigane) Europe, South America, etc Smirom 295 // rw, /// Kinyarwanda (Rwanda, Ruanda) Rwanda Nimuhóre, Amahoro 296 // sd, /// Sindhi Pakistan, India शांति, شانت (śanti) 297 // sg, /// Sango Central African Republic needed! 298 // sn, /// Shona Zimbabwe Runyaro, Dendemaro 299 // so, /// Somali Somalia, Djibouti, Ethiopia Nabáda 300 // ss, /// Swati (Siswati) Swaziland Kuthála 301 // st, /// Southern Sotho (Sesotho, Sesuthu) South Africa Kgotso, Khotso 302 // su, /// Sundanese Indonesia needed! 303 // ti, /// Tigrinya (Tigrigna) Eritrea ሰላም (salām) 304 // tli, /// Tlingit North America Li-k'ei 305 // tn, /// Tswana (Setswana) Botswana Khotso, Kagiso 306 // to, /// Tonga Zambia Malino, Melino 307 // ts, /// Tsonga South Africa needed! 308 // tt, /// Tatar Russia Тынычлык (tınıçlık) 309 // tw, /// Twi West Africa Asomdwee 310 // ty, /// Tahitian Tahiti Hau 311 // ug, /// Uighur (Uygur) China, Central Asia تىنچلىق (tinçlik) 312 // ve, /// Venda South Africa needed! 313 // wen, /// Upper Sorbian (Wendish) Germany Pokoj 314 // wo, /// Wolof West Africa Jàmm 315 // xh, /// Xhosa South Africa, Botswana Uxolo 316 // yo, /// Yoruba Nigeria, Benin, Togo Alaáfía 317 // ypk, /// Yu'pik Alaska, Canada Kiñuiñak 318 // za, /// Chuang (Zhuang) China needed! 319 // zap, /// Zapotec Mexico Layeni, Binlo 320 // zu, /// Zulu Southern Africa Isithangami, Ukuthula 321 322 /** International Phonetic Alphabet (IPA) 323 https:///en.wikipedia.org/wiki/International_Phonetic_Alphabet */ 324 ipa, 325 326 /// Programming Languages. 327 c, firstFormal = c, 328 cxx, 329 objectiveC, 330 objectiveCxx, 331 cSharp, 332 d, 333 go, 334 java, 335 ada, 336 rust, 337 swift, 338 fortran, 339 modelica, 340 341 lastFormal = modelica, 342 343 /// Academic Languages 344 math, /// "Mathematics is the only truly universal language" 345 physics, 346 347 regularExpression, regexp = regularExpression, 348 } 349 // pragma(msg, cast(uint)Lang.regularExpression); 350 351 /** Return true if programming language $(D lang) is case-sensitive. */ 352 pragma(inline, true) 353 bool isCaseSensitive(in Lang lang) @safe pure @nogc nothrow 354 => !(lang == Lang.bg || 355 lang == Lang.ada); 356 357 /** Return true if $(D lang) is a formal (computer) language. */ 358 pragma(inline, true) 359 bool isFormal(in Lang lang) @safe pure @nogc nothrow 360 => (lang >= Lang.firstFormal && 361 lang <= Lang.lastFormal); 362 363 /** TODO: Remove when `__traits(documentation)` is merged 364 */ 365 string toSpoken(in Lang lang, in Lang spokenLang = Lang.init) @safe pure nothrow // TODO: @nogc 366 { 367 with (Lang) 368 { 369 switch (lang) 370 { 371 case unknown: return `??`; 372 case en: return `English`; // 英語 373 case en_US: return `American English`; 374 case en_GB: return `British English`; 375 case en_CA: return `Canadian English`; 376 case af: return `Afrikaans`; 377 case ar: return `Arabic`; 378 case ae: return `Avestan`; 379 case ak: return `Akan`; 380 case an: return `Aragonese`; 381 case as: return `Assamese`; 382 case az: return `Azerbaijani`; 383 case hy: return `Armenian`; 384 case eu: return `Basque`; 385 case ba: return `Baskhir`; 386 case be: return `Belarusian`; 387 case bn: return `Bengali`; 388 case br: return `Breton`; 389 case bs: return `Bosnian`; 390 case bg: return `Bulgarian`; 391 case bo: return `Tibetan`; 392 case my: return `Burmese`; 393 case zh: return `Chinese Mandarin`; 394 case crh: return `Crimean Tatar`; 395 case hr: return `Croatian`; 396 case ca: return `Catalan`; 397 case cy: return `Welch`; 398 case cs: return `Czech`; 399 case da: return `Danish`; 400 case nl: return `Dutch`; 401 case eo: return `Esperanto`; 402 case et: return `Estonian`; 403 case fi: return `Finnish`; 404 case fj: return `Fiji`; 405 case fo: return `Faroese`; 406 case fr: return `French`; 407 case fr_ch: return `French (Switzerland)`; 408 case gl: return `Galician`; 409 case gv: return `Manx`; 410 case de: return `German`; 411 case el: return `Greek`; 412 case grc: return `Ancient Greek`; 413 case ha: return `Hausa`; 414 case he: return `Hebrew`; 415 case hi: return `Hindi`; 416 case hu: return `Hungarian`; 417 case is_: return `Icelandic`; 418 case io: return `Ido`; 419 case id: return `Indonesian`; 420 case ga: return `Irish`; 421 case it: return `Italian`; 422 case ja: return `Japanese`; // 日本語 423 case ka: return `Georgian`; 424 case ku: return `Kurdish`; 425 case kn: return `Kannada`; 426 case kk: return `Kazakh`; 427 case km: return `Khmer`; 428 case ko: return `Korean`; 429 case ky: return `Kyrgyz`; 430 case lo: return `Lao`; 431 case la: return `Latin`; 432 case lt: return `Lithuanian`; 433 case lv: return `Latvian`; 434 case jbo: return `Lojban`; 435 case mk: return `Macedonian`; 436 case nan: return `Min Nan`; 437 case mg: return `Malagasy`; 438 case mn: return `Mongolian`; 439 case ms: return `Malay`; 440 case mt: return `Maltese`; 441 case ne: return `Nepali`; 442 case no: return `Norwegian`; 443 case ps: return `Pashto`; 444 case fa: return `Persian`; 445 case oc: return `Occitan`; 446 case pl: return `Polish`; 447 case pt: return `Portuguese`; 448 case pt_BR: return `Brazilian Portuguese`; 449 case ro: return `Romanian`; 450 case ru: return `Russian`; 451 case sa: return `Sanskrit`; 452 case si: return `Sinhalese`; 453 case sm: return `Samoan`; 454 case sco: return `Scots`; 455 case sq: return `Albanian`; 456 case te: return `Tegulu`; 457 case tl: return `Tagalog`; 458 case gd: return `Scottish Gaelic`; 459 case sr: return `Serbian`; 460 case sk: return `Slovak`; 461 case sl: return `Slovene`; 462 case es: return `Spanish`; 463 case sw: return `Swahili`; 464 case sv: return `Swedish`; 465 case asv: return `Ancient Swedish`; 466 case tg: return `Tajik`; 467 case ta: return `Tamil`; 468 case th: return `Thai`; 469 case tr: return `Turkish`; 470 case tk: return `Turkmen`; 471 case uk: return `Ukrainian`; 472 case ur: return `Urdu`; 473 case uz: return `Uzbek`; 474 case vi: return `Vietnamese`; 475 case vo: return `Volapük`; 476 case wa: return `Waloon`; 477 case yi: return `Yiddish`; 478 case akk: return `Akkadian`; 479 case ce: return `Chechen`; 480 case co: return `Corsican`; 481 case fur: return `Friulian`; 482 case gu: return `Gujarati`; 483 case hil: return `Hiligaynon`; 484 case haw: return `Hawaiian`; 485 486 case ipa: return `International Phonetic Alphabet`; 487 488 case c: return `C`; 489 case cxx: return `C++`; 490 case cSharp: return `C#`; 491 case objectiveC: return `Objective-C`; 492 case objectiveCxx: return `Objective-C++`; 493 case d: return `D`; 494 case go: return `Go`; 495 case java: return `Java`; 496 case ada: return `Ada`; 497 case rust: return `Rust`; 498 case swift: return `Swift`; 499 case fortran: return `Fortran`; 500 case modelica: return `Modelica`; 501 502 case math: return `mathematics`; 503 case physics: return `physics`; 504 case regularExpression: return `regular expression`; 505 506 default: 507 import nxt.enum_ex : toStringFaster; 508 return lang.toStringFaster; 509 } 510 } 511 } 512 513 Lang decodeLang(const scope const(char)[] lang) @safe pure nothrow @nogc 514 { 515 switch (lang) 516 { 517 case `is`: 518 return Lang.is_; 519 case `in`: 520 return Lang.in_; 521 default: 522 return typeof(return)(lang.toDefaulted!Lang(Lang.unknown)); 523 } 524 } 525 526 /// 527 @safe pure unittest 528 { 529 assert(`sv`.decodeLang == Lang.sv); 530 } 531 532 Lang decodeLangDefaulted(scope const(char)[] lang, 533 in Lang defaultLang) @safe pure nothrow @nogc 534 { 535 switch (lang) 536 { 537 case `is`: 538 return Lang.is_; 539 case `in`: 540 return Lang.in_; 541 default: 542 return typeof(return)(lang.toDefaulted!Lang(defaultLang)); 543 } 544 } 545 546 /// 547 @safe pure nothrow unittest 548 { 549 assert(`_`.decodeLangDefaulted(Lang.unknown) == Lang.unknown); 550 assert(`_`.decodeLangDefaulted(Lang.en) == Lang.en); 551 assert(`sv`.decodeLangDefaulted(Lang.unknown) == Lang.sv); 552 assert(`en`.decodeLangDefaulted(Lang.unknown) == Lang.en); 553 } 554 555 /// 556 @safe pure nothrow /*TODO: @nogc*/ unittest 557 { 558 assert(Lang.unknown.toSpoken == `??`); 559 assert(Lang.c.toSpoken == `C`); 560 assert(Lang.cxx.toSpoken == `C++`); 561 assert(Lang.d.toSpoken == `D`); 562 assert(Lang.java.toSpoken == `Java`); 563 } 564 565 string toHTML(in Lang lang) @safe pure nothrow /*TODO: @nogc*/ 566 => lang.toSpoken; 567 568 /// 569 string toMathML(in Lang lang) @safe pure nothrow /*TODO: @nogc*/ 570 => lang.toHTML; 571 572 /** Markup in Lang */ 573 enum MarkupLang : ubyte 574 { 575 unknown, // Unknown: ? 576 HTML, 577 MathML 578 } 579 580 /** Check if `lang` capitalize all its nouns include common nouns. 581 */ 582 bool capitalizesCommonNoun(in Lang lang) @safe pure nothrow @nogc 583 => lang == Lang.de; 584 585 /// 586 @safe pure nothrow @nogc unittest 587 { 588 assert(Lang.de.capitalizesCommonNoun); 589 assert(!Lang.en.capitalizesCommonNoun); 590 }