I'm building a website where people can associate a language information to content.
The website uses Javascript heavily and the language information associated to various elements is treated internally as an ISO 639-1 code.
How to show a list of language names - in the language of the user ?
Language matters That's why, since 1947, we have had three official languages: English, French and Russian. It helps involve greater numbers of people in the process by making information about what we're working on, and why standardization matters, available in three widely-spoken languages.
Go to command line and run bundle install (must be in your application's directory). Then run linguist app/test. tpl (more generally linguist <path-to-code-snippet-file> ). It will tell you the type, mime type, and language.
There are 58 languages in ISO 639-2 which are considered, for the purposes of the standard, to be "macrolanguages" in ISO 639-3.
There are some similar questions on stackoverflow. I needed a javascript function for getting English names and Native names for different languages. I found a nice json formatted list of ISO 693-1 language codes on stackoverflow (based on wikipedia) and created a gist with two functions getLanguageName and getLanguageNativeName. Here is how to use it:
getLanguageNativeName("cv"); // --> "чӑваш чӗлхи"
getLanguageName("cv"); // --> "Chuvash"
getLanguageNativeName("cv-RU"); // --> "чӑваш чӗлхи"
getLanguageName("cv-RU"); // --> "Chuvash"
I used it to answer another similar question: generate a list of localized language names with links to google translate
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