browser - I18n of a web site: how do I detect language? -


I am working on a web site that needs some small internationalization (English, French and German), and I want to know where the user is coming from, so I know what to display. I think the correct way to do this is to check the "HTTP_ACCEPT_LANGUAGE" header for the # 1 language detection user who is requesting the user (and it is safe to believe that all German users can ask for a DR Are the default browser).

Is that correct? Or I'm doing something else (hopefully no one is ridiculous, like trying to get their country out of their IP) ...

thanks - Eric

If you currently go for the most popular choice - GOIP - without further consideration, then you do not have a good favor for your users

languages ​​and countries do not overlap you with the Swiss IP address as users What are you going? Belgium? Canada? If you go for a majority of languages ​​in each case, you will disturb the repeat visitors, who become part of the larger linguistic minorities: they will be welcomed every and every time in the "wrong" language, even if the site is available Yes, their favorite language is the same for the excitement - and with experience, Sweden is very rude to go to Sweden, because I want to travel to Sweden Ta said. (And even bigger sites are wrong. The second day I arrived at London airport from London and Google turned me into Frank-A.) Do not forget that a large number of people speak multilingual languages Or non-native speakers.

  1. First check how the user is saying about the possibility of their liking . The easiest ways are:
    • Parsing language / culture information from HTTP User Agent string () It tells you something about the OS version that they are running, and preference There is a very good signal that they can definitely deceive user agents, but if they are doing so, they may be surprised that they are getting the wrong pre-set.
    • Acceptable-language HTTP headers (lower priority, because you can see more "N" than actual users with English as OS preference).
    • Second, save user's priority if they log in, ask them and save it as an option. If not, set the cookie (with the proper end setting), in such a way, when they come back, they will be pleasantly surprised.
    • Use GOIP only as the last resort

Comments