localization - Browser's language and javascript
-
hello fellows, I'm facing a problem with localization. You know each time the browser create a request, it will send its language (en, en_us, ..etc) with the it where the web application can determine the language of the client and send the proper response. Now, what i want is to play around with this option on the client-side not from the server-side. And I want the language option to be displayed as a choice as a select-box on login page. My first option (as i think) is to modify the browser's language using javascript when the user select (event) a choice from the select-box. My second option is to override the value of the header "accept-language" using javascript also. Until now I couldn't know it those two options are possible or there's any other choices. I really appreciate it if you can help Regards, Faris Madi Nothing Comes Easy (N.C.E.)
-
hello fellows, I'm facing a problem with localization. You know each time the browser create a request, it will send its language (en, en_us, ..etc) with the it where the web application can determine the language of the client and send the proper response. Now, what i want is to play around with this option on the client-side not from the server-side. And I want the language option to be displayed as a choice as a select-box on login page. My first option (as i think) is to modify the browser's language using javascript when the user select (event) a choice from the select-box. My second option is to override the value of the header "accept-language" using javascript also. Until now I couldn't know it those two options are possible or there's any other choices. I really appreciate it if you can help Regards, Faris Madi Nothing Comes Easy (N.C.E.)
As far as I'm aware you can't do any of those options. The language of the browser is as determined by the user and can not be changed by javascript. Also, dont assume that the user of the browser can actually understand the lanuages it supports. Your best bet is to have the user make some language selection and store this in a cookie.
-
As far as I'm aware you can't do any of those options. The language of the browser is as determined by the user and can not be changed by javascript. Also, dont assume that the user of the browser can actually understand the lanuages it supports. Your best bet is to have the user make some language selection and store this in a cookie.
Do you know anyway to override the value of the sent parameters by the browser to the server. for example the browser sends to the server with each request a parameter called "accept-language" or "language". So, the web application will know the language of the browser. I want to change the value of "accept-language". Im not sure if that's possible? Any Ideas ?? Regards, Faris Madi Nothing Comes Easy (N.C.E.)
-
Do you know anyway to override the value of the sent parameters by the browser to the server. for example the browser sends to the server with each request a parameter called "accept-language" or "language". So, the web application will know the language of the browser. I want to change the value of "accept-language". Im not sure if that's possible? Any Ideas ?? Regards, Faris Madi Nothing Comes Easy (N.C.E.)
Why do you want to change it from JavaScript? If the user wants a different language then they will change it through the browser. You will be better off using a cookie to store the user's language selection (you can use accept-language to discover the initial setting).