hilty Posted October 28, 2013 Share Posted October 28, 2013 Hi guys, There's one way to get the browser language in javascript? I tried navigator.language but I read in Google that it is not reliable.I read that the best is use the info in 'Accept-Language' header,but I only can access it using a server side language. Anyone here knows another way?Phaser can do it? If yes, how? Cheers, Quote Link to comment Share on other sites More sharing options...
rich Posted October 28, 2013 Share Posted October 28, 2013 It's not possible, not accurately or reliably anyway, without using something server side. Quote Link to comment Share on other sites More sharing options...
hilty Posted October 28, 2013 Author Share Posted October 28, 2013 It's not possible, not accurately or reliably anyway, without using something server side. Thanks Rich. Quote Link to comment Share on other sites More sharing options...
ooflorent Posted October 29, 2013 Share Posted October 29, 2013 It is not really accurate but you can rely on the Accept-Language browser header. Maybe you should read documentation about content negociation.There is a good JS library for that: https://github.com/garycourt/negotiate-js Quote Link to comment Share on other sites More sharing options...
Gio Posted October 29, 2013 Share Posted October 29, 2013 Although this isn't entirely accurate, I've used (navigator.userLanguage || navigator.language) to set a default language for my games, that players can then change Quote Link to comment Share on other sites More sharing options...
hilty Posted October 30, 2013 Author Share Posted October 30, 2013 Although this isn't entirely accurate, I've used (navigator.userLanguage || navigator.language) to set a default language for my games, that players can then change Gio, That works for you? Quote Link to comment Share on other sites More sharing options...
remvst Posted October 30, 2013 Share Posted October 30, 2013 Gio, That works for you? I do the same (except that I don't leave a choice ) and it has worked so far. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.