Merge pull request #425 from hotleave/fix#424

Fix #424
This commit is contained in:
Peter Cottle 2017-04-27 08:29:34 -07:00 committed by GitHub
commit fdecaa78a7

View file

@ -259,20 +259,8 @@ var initDemo = function(sandbox) {
}; };
function tryLocaleDetect() { function tryLocaleDetect() {
// lets fire off a request to get our headers which then // use navigator to get the locale setting
// can help us identify what locale the browser is in. changeLocaleFromHeaders(navigator.language || navigator.browserLanguage);
// wrap everything in a try since this is a third party service
try {
$.ajax({
url: 'http://ajaxhttpheaders.appspot.com',
dataType: 'jsonp',
success: function(headers) {
changeLocaleFromHeaders(headers['Accept-Language']);
}
});
} catch (e) {
console.warn('locale detect fail', e);
}
} }
function changeLocaleFromHeaders(langString) { function changeLocaleFromHeaders(langString) {