mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-12-13 17:21:14 -05:00
53d3bb94dc
This reverts commit5ce1a9f411
, reversing changes made to5be4c45f08
.
38 lines
1.2 KiB
JavaScript
38 lines
1.2 KiB
JavaScript
const jar = require('./lib/jar');
|
|
const Raven = require('raven-js');
|
|
|
|
/**
|
|
* -----------------------------------------------------------------------------
|
|
* Error handling
|
|
* -----------------------------------------------------------------------------
|
|
*/
|
|
(() => {
|
|
if (process.env.SENTRY_DSN !== '') {
|
|
Raven.config(process.env.SENTRY_DSN).install();
|
|
}
|
|
})();
|
|
|
|
/**
|
|
* -----------------------------------------------------------------------------
|
|
* L10N
|
|
* -----------------------------------------------------------------------------
|
|
*/
|
|
(() => {
|
|
/*
|
|
* Bind locale code from cookie if available. Uses navigator language API as a fallback.
|
|
*
|
|
* @return {string}
|
|
*/
|
|
const updateLocale = () => {
|
|
let obj = jar.get('scratchlanguage');
|
|
if (typeof obj === 'undefined') {
|
|
obj = window.navigator.userLanguage || window.navigator.language;
|
|
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.
|
|
}
|
|
}
|
|
return obj;
|
|
};
|
|
|
|
window._locale = updateLocale();
|
|
})();
|