How to determine user’s locale within browser?

I have a website (Flash) localized into a dozen of languages and I want to auto-define a default value depending on the user’s browser settings in order to minimize the steps to access the content.

FYI, I cannot use server scripts due to proxy restrictions, so I guess JavaScript or ActionScript would be appropriate to solve the problem.

Questions:

  1. What would be the best method to ‘guess’ the user’s locale?

  2. Are there any existing simple classes/functions that could help me out (no complex localization bundles)? Especially to reduce all possible languages to a smaller number (the translations I have) in a smart way.

  3. To which point can I trust such a solution?

  4. Any other workarounds or suggestions?

10 Answers
10

Leave a Comment