I've found supportedLocalesOf, but is there a way to get all supported locales, not just check which among a given list are supported?
The '*' tag option described in this 2012 post no longer works.
To get the user's locale in the browser, access the first element of the languages property on the navigator object, e.g. navigator. languages[0] . The property returns an array of strings that represent the user's preferred languages.
A Locale object represents a specific geographical, political, or cultural region. An operation that requires a Locale to perform its task is called locale-sensitive and uses the Locale to tailor information for the user.
In this article, we'll go through three different ways of detecting a user's locale: through the browser's navigator. language s (on the client) object, through the Accept-Language HTTP header (on the server), and through geolocation using the user's IP address (on the server).
Open the browser settings, and in the advanced section scroll down to find Languages . Open Language and Input Settings and add the language or language+region choice you want from the list available.
You may use npm ISO-639-1 to list them. It's safe to assume that all browsers use the 639-1
column shown in this table from wikipedia as their standard support.
Or use the following hardcoded list
[ ['Abkhazian', 'ab'], ['Afar', 'aa'], ['Afrikaans', 'af'], ['Akan', 'ak'], ['Albanian', 'sq'], ['Amharic', 'am'], ['Arabic', 'ar'], ['Aragonese', 'an'], ['Armenian', 'hy'], ['Assamese', 'as'], ['Avaric', 'av'], ['Avestan', 'ae'], ['Aymara', 'ay'], ['Azerbaijani', 'az'], ['Bambara', 'bm'], ['Bashkir', 'ba'], ['Basque', 'eu'], ['Belarusian', 'be'], ['Bengali (Bangla)', 'bn'], ['Bihari', 'bh'], ['Bislama', 'bi'], ['Bosnian', 'bs'], ['Breton', 'br'], ['Bulgarian', 'bg'], ['Burmese', 'my'], ['Catalan', 'ca'], ['Chamorro', 'ch'], ['Chechen', 'ce'], ['Chichewa, Chewa, Nyanja', 'ny'], ['Chinese', 'zh'], ['Chinese (Simplified)', 'zh-Hans'], ['Chinese (Traditional)', 'zh-Hant'], ['Chuvash', 'cv'], ['Cornish', 'kw'], ['Corsican', 'co'], ['Cree', 'cr'], ['Croatian', 'hr'], ['Czech', 'cs'], ['Danish', 'da'], ['Divehi, Dhivehi, Maldivian', 'dv'], ['Dutch', 'nl'], ['Dzongkha', 'dz'], ['English', 'en'], ['Esperanto', 'eo'], ['Estonian', 'et'], ['Ewe', 'ee'], ['Faroese', 'fo'], ['Fijian', 'fj'], ['Finnish', 'fi'], ['French', 'fr'], ['Fula, Fulah, Pulaar, Pular', 'ff'], ['Galician', 'gl'], ['Gaelic (Scottish)', 'gd'], ['Gaelic (Manx)', 'gv'], ['Georgian', 'ka'], ['German', 'de'], ['Greek', 'el'], ['Greenlandic', 'kl'], ['Guarani', 'gn'], ['Gujarati', 'gu'], ['Haitian Creole', 'ht'], ['Hausa', 'ha'], ['Hebrew', 'he'], ['Herero', 'hz'], ['Hindi', 'hi'], ['Hiri Motu', 'ho'], ['Hungarian', 'hu'], ['Icelandic', 'is'], ['Ido', 'io'], ['Igbo', 'ig'], ['Indonesian', 'id, in'], ['Interlingua', 'ia'], ['Interlingue', 'ie'], ['Inuktitut', 'iu'], ['Inupiak', 'ik'], ['Irish', 'ga'], ['Italian', 'it'], ['Japanese', 'ja'], ['Javanese', 'jv'], ['Kalaallisut, Greenlandic', 'kl'], ['Kannada', 'kn'], ['Kanuri', 'kr'], ['Kashmiri', 'ks'], ['Kazakh', 'kk'], ['Khmer', 'km'], ['Kikuyu', 'ki'], ['Kinyarwanda (Rwanda)', 'rw'], ['Kirundi', 'rn'], ['Kyrgyz', 'ky'], ['Komi', 'kv'], ['Kongo', 'kg'], ['Korean', 'ko'], ['Kurdish', 'ku'], ['Kwanyama', 'kj'], ['Lao', 'lo'], ['Latin', 'la'], ['Latvian (Lettish)', 'lv'], ['Limburgish ( Limburger)', 'li'], ['Lingala', 'ln'], ['Lithuanian', 'lt'], ['Luga-Katanga', 'lu'], ['Luganda, Ganda', 'lg'], ['Luxembourgish', 'lb'], ['Manx', 'gv'], ['Macedonian', 'mk'], ['Malagasy', 'mg'], ['Malay', 'ms'], ['Malayalam', 'ml'], ['Maltese', 'mt'], ['Maori', 'mi'], ['Marathi', 'mr'], ['Marshallese', 'mh'], ['Moldavian', 'mo'], ['Mongolian', 'mn'], ['Nauru', 'na'], ['Navajo', 'nv'], ['Ndonga', 'ng'], ['Northern Ndebele', 'nd'], ['Nepali', 'ne'], ['Norwegian', 'no'], ['Norwegian bokmål', 'nb'], ['Norwegian nynorsk', 'nn'], ['Nuosu', 'ii'], ['Occitan', 'oc'], ['Ojibwe', 'oj'], ['Old Church Slavonic, Old Bulgarian', 'cu'], ['Oriya', 'or'], ['Oromo (Afaan Oromo)', 'om'], ['Ossetian', 'os'], ['Pāli', 'pi'], ['Pashto, Pushto', 'ps'], ['Persian (Farsi)', 'fa'], ['Polish', 'pl'], ['Portuguese', 'pt'], ['Punjabi (Eastern)', 'pa'], ['Quechua', 'qu'], ['Romansh', 'rm'], ['Romanian', 'ro'], ['Russian', 'ru'], ['Sami', 'se'], ['Samoan', 'sm'], ['Sango', 'sg'], ['Sanskrit', 'sa'], ['Serbian', 'sr'], ['Serbo-Croatian', 'sh'], ['Sesotho', 'st'], ['Setswana', 'tn'], ['Shona', 'sn'], ['Sichuan Yi', 'ii'], ['Sindhi', 'sd'], ['Sinhalese', 'si'], ['Siswati', 'ss'], ['Slovak', 'sk'], ['Slovenian', 'sl'], ['Somali', 'so'], ['Southern Ndebele', 'nr'], ['Spanish', 'es'], ['Sundanese', 'su'], ['Swahili (Kiswahili)', 'sw'], ['Swati', 'ss'], ['Swedish', 'sv'], ['Tagalog', 'tl'], ['Tahitian', 'ty'], ['Tajik', 'tg'], ['Tamil', 'ta'], ['Tatar', 'tt'], ['Telugu', 'te'], ['Thai', 'th'], ['Tibetan', 'bo'], ['Tigrinya', 'ti'], ['Tonga', 'to'], ['Tsonga', 'ts'], ['Turkish', 'tr'], ['Turkmen', 'tk'], ['Twi', 'tw'], ['Uyghur', 'ug'], ['Ukrainian', 'uk'], ['Urdu', 'ur'], ['Uzbek', 'uz'], ['Venda', 've'], ['Vietnamese', 'vi'], ['Volapük', 'vo'], ['Wallon', 'wa'], ['Welsh', 'cy'], ['Wolof', 'wo'], ['Western Frisian', 'fy'], ['Xhosa', 'xh'], ['Yiddish', 'yi', 'ji'], ['Yoruba', 'yo'], ['Zhuang, Chuang', 'za'], ['Zulu', 'zu'], ]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With