N1CK3RS0N Posted January 16, 2009 Share Posted January 16, 2009 Greetings. I'm developing a CMS and I wanted to automatically detect browser language settings. Anyone know how to do this? Thanks Link to comment https://forums.phpfreaks.com/topic/141141-detecting-browsers-language-settings/ Share on other sites More sharing options...
premiso Posted January 16, 2009 Share Posted January 16, 2009 Greetings. I'm developing a CMS and I wanted to automatically detect browser language settings. Anyone know how to do this? Thanks Javascript is the only way I know how, since PHP is server side. Link to comment https://forums.phpfreaks.com/topic/141141-detecting-browsers-language-settings/#findComment-738743 Share on other sites More sharing options...
Mark Baker Posted January 16, 2009 Share Posted January 16, 2009 if (typeof(navigator.language) != "undefined") document.writeln(navigator.language); else if (typeof(navigator.browserLanguage) != "undefined") document.writeln(navigator.browserLanguage); if (typeof(navigator.systemLanguage) == "string") document.writeln($("<div/>").text(navigator.systemLanguage).html()); if (typeof(navigator.userLanguage) == "string") document.writeln($("<div/>").text(navigator.userLanguage).html()); if (typeof(navigator.browserLanguage) == "string") document.writeln($("<div/>").text(navigator.browserLanguage).html()); Link to comment https://forums.phpfreaks.com/topic/141141-detecting-browsers-language-settings/#findComment-738746 Share on other sites More sharing options...
corbin Posted January 16, 2009 Share Posted January 16, 2009 You could try checking the Accept-Language header. http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html It should be in $_SERVER somewhere. Link to comment https://forums.phpfreaks.com/topic/141141-detecting-browsers-language-settings/#findComment-738759 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.