Best way to determine user's locale within browser

前端 未结 10 1221
旧巷少年郎
旧巷少年郎 2020-11-22 09:54

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 ste

10条回答
  •  失恋的感觉
    2020-11-22 10:19

    I did a bit of research regarding this & I have summarised my findings so far in below table

    So the recommended solution is to write a a server side script to parse the Accept-Language header & pass it to client for setting the language of the website. It's weird that why the server would be needed to detect the language preference of client but that's how it is as of now There are other various hacks available to detect the language but reading the Accept-Language header is the recommended solution as per my understanding.

提交回复
热议问题