franceav Posted May 26, 2009 Share Posted May 26, 2009 So I have a site which has 2 languages English and Chinese, how could I direct the front page according different user language, I think this could be done by using browser language detection and window.onload to direct but can't writethe actual code, please help and any useful sources are welcomed as well, thanks in advance!! Link to comment Share on other sites More sharing options...
justsomeguy Posted May 26, 2009 Share Posted May 26, 2009 Javascript is limited in what it can do with the language, something like this should work at least for IE:http://javascript.about.com/library/bllang.htmIt would be a better solution if you could use a server-side language like PHP which will have access to the headers that the browser sent, including the accept-language header. Link to comment Share on other sites More sharing options...
franceav Posted May 27, 2009 Author Share Posted May 27, 2009 Javascript is limited in what it can do with the language, something like this should work at least for IE:http://javascript.about.com/library/bllang.htmIt would be a better solution if you could use a server-side language like PHP which will have access to the headers that the browser sent, including the accept-language header.thanks, very helpful, I think to use php is easier and my pages are running in a php server, but still i don'tknow how to do with it, can you or someone give me some of the sample code for making this happen! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.