I 'm building a React JS website and got stuck on an issue relater to the navigator problem. My default browser is Chrome and using English as a language. When I log navigator.language it gives me "he-IL", which I do use but not as default language. In the navigator.languages i get the following array:["he-IL", "en-US", "en", "he"].
Is there a way to set it to detect English only when using navigator.language? Or do I have to get it from the array?
I suppose the default language being used at the navigator function is user-specific, it returns an array of DOMStrings representing the user's preferred languages. You tried returning the array list of languages associated?. In the returned array they are ordered by preference with the most preferred language first.
The property can be changed easily by changing the browser settings. Currently, I think your default is he-IL, so need to change the default to English.
Mine works fine and the
navigator.languages returns ["en-US", "zh-CN", "ja-JP"]