2015-10-15 23:05:57 -04:00
|
|
|
var jar = require('./lib/jar');
|
2015-10-16 11:04:34 -04:00
|
|
|
|
2015-10-15 23:05:57 -04:00
|
|
|
|
2015-10-21 20:49:31 -04:00
|
|
|
/**
|
|
|
|
* -----------------------------------------------------------------------------
|
|
|
|
* L10N
|
|
|
|
* -----------------------------------------------------------------------------
|
|
|
|
*/
|
2015-10-15 23:05:57 -04:00
|
|
|
(function () {
|
|
|
|
/**
|
|
|
|
* Bind locale code from cookie if available. Uses navigator language API as a fallback.
|
|
|
|
*
|
|
|
|
* @return {string}
|
|
|
|
*/
|
|
|
|
function updateLocale () {
|
|
|
|
var obj = jar.get('scratchlanguage');
|
|
|
|
if (typeof obj === 'undefined') {
|
|
|
|
obj = window.navigator.userLanguage || window.navigator.language;
|
2016-01-04 14:18:47 -05:00
|
|
|
if (['pt','pt-pt','PT','PT-PT'].indexOf(obj) !== -1) {
|
|
|
|
obj = 'pt-br'; // default Portuguese users to Brazilian Portuguese due to our user base. Added in 2.2.5.
|
|
|
|
}
|
2015-10-15 23:05:57 -04:00
|
|
|
}
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
|
2016-01-06 14:09:32 -05:00
|
|
|
window._locale = updateLocale();
|
2015-10-15 23:05:57 -04:00
|
|
|
})();
|