Forum Moderators: phranque

Message Too Old, No Replies

Multilingual website with MOD REWRITE and (not) HTTP ACCEPT LANGUAGE

The solution for content negotiation based on user browser language setting

         

boryn

2:24 pm on Mar 3, 2009 (gmt 0)

10+ Year Member



I found a lot of people trying to use %{HTTP_ACCEPT_LANGUAGE} in their .htaccess files for making multilingual websites - but that won't work. However there is other way to read browser setting of prefferred language in order to make a localization of the site using Apache mod rewrite.

Fortunately we can access every header sent by the browser using %{HTTP:header}, so the solution is not %{HTTP_ACCEPT_LANGUAGE} but: %{HTTP:Accept-Language}. I write more about this on my blog post: <snip> Website localization - mod rewrite and HTTP_ACCEPT_LANGUAGE problem

[edited by: jdMorgan at 3:49 pm (utc) on Mar. 3, 2009]
[edit reason] No URLs or promotion, please. See TOS. [/edit]

jdMorgan

3:54 pm on Mar 3, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It is generally a mistake to use any automatic method to determine the users' preferred language -- We have American businessmen in Japan, and Englishmen is the south of France. Countries like Canada and Belgium use multiple "official" languages, and there are many dialects in use in countries like China.

So while you can determine the language settings of the browser and the user's general location based on GeoIP, you cannot determine his/her language preference unless you ask. Therefore, you'll notice that large international sites often use a clickable world map or a "row of little flags" to allow the user to declare language preferences.

Jim

boryn

4:01 pm on Mar 3, 2009 (gmt 0)

10+ Year Member



Of course, it depends if user is aware of this language setting. If he/she uses localized version of system and of browser, usually it will be good way to serve him the website version. If one is not using his/her computer, it would be more difficult but it should be easy to switch to another language.

Nevertheless, we are talking here about technical solution not talking about if it is good or not - it depends on the target audience.

Michal