Monday, May 20, 2024
58
rated 0 times [  60] [ 2]  / answers: 1 / hits: 13374  / 10 Years ago, tue, august 5, 2014, 12:00:00

I'm getting the browser's language code using:



var lang = window.navigator.language;


This returns the code (i.e. en-US). How do I convert this to the language name (i.e. English)?


More From » internationalization

 Answers
2

There is a JS library which you can use: language-tags



It's a little bit heavy, you can use a pre-defined list like this.


[#43343] Monday, August 4, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jesseh

Total Points: 579
Total Questions: 98
Total Answers: 99

Location: Reunion
Member since Mon, Dec 28, 2020
3 Years ago
;