I am trying to detect the users prefered language in ASP.NET MVC and I am aware of the Request.UserLanguages property. The thing is, it seems that the most popular sites on the internet for instance Google.com do not use these settings but rather use some location based settings. That’s why by default I always see the Slovenian version of Google.com even if we removed all the traces of Slovenian language from Languages in our browsers (be it IE, Chrome, etc.)
Going abroad and connecting to the networks there will also result in showing, for instance, German Google.com when traveling to Germany.
My questions are:
-
What detection mechanism they use?
-
Do you favor UserLanguages or would you favor location?
IP based.
Depends on your requirements. As you’ve already noticed if you use UserLanguages, you could have an user in China having configured his browser for en-EU and you get English whereas if you use IP based detection you will get China. So it will really depend whether you want to privilege user location or user browser settings.