1

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:

  1. What detection mechanism they use?

  2. Do you favor UserLanguages or would you favor location?

1 Answer 1

3

What detection mechanism they use?

IP based.

Do you favor UserLanguages or would you favor location?

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.

18
  • Could you provide more details on IP based language/culture detection (maybe a service I could use)?
    – mare
    Aug 13, 2012 at 19:46
  • 1
    Proxies can/will ruin IP based detection.
    – TheZ
    Aug 13, 2012 at 19:47
  • @TheZ, got better idea? Google doesn't. So for example if you are in France using an US proxy you get the US version of Google. Aug 13, 2012 at 19:48
  • @DarinDimitrov I don't necessarily have a better idea (except maybe: don't try) but pointing out the flaws exposes potential pitfalls from relying on the technique to be 100% accurate.
    – TheZ
    Aug 13, 2012 at 19:49
  • @TheZ, hopefully all people calling themselves web developers already know that there is no 100% bulletproof technique fro detecting where the client of a web site comes from so I really thought this was so obvious that it wasn't necessary mentioning it. Aug 13, 2012 at 19:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.