2018-01-30 11:53:12 -05:00
|
|
|
const jar = require('./lib/jar');
|
2015-10-15 23:05:57 -04:00
|
|
|
|
2015-10-21 20:49:31 -04:00
|
|
|
/**
|
|
|
|
* -----------------------------------------------------------------------------
|
|
|
|
* L10N
|
|
|
|
* -----------------------------------------------------------------------------
|
|
|
|
*/
|
2018-01-30 11:53:12 -05:00
|
|
|
(() => {
|
|
|
|
/*
|
2015-10-15 23:05:57 -04:00
|
|
|
* Bind locale code from cookie if available. Uses navigator language API as a fallback.
|
|
|
|
*
|
|
|
|
* @return {string}
|
|
|
|
*/
|
2018-01-30 11:53:12 -05:00
|
|
|
const updateLocale = () => {
|
|
|
|
let obj = jar.get('scratchlanguage');
|
2015-10-15 23:05:57 -04:00
|
|
|
if (typeof obj === 'undefined') {
|
|
|
|
obj = window.navigator.userLanguage || window.navigator.language;
|
2018-01-30 11:53:12 -05:00
|
|
|
if (['pt', 'pt-pt', 'PT', 'PT-PT'].indexOf(obj) !== -1) {
|
2016-01-04 14:18:47 -05:00
|
|
|
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;
|
2018-01-30 11:53:12 -05:00
|
|
|
};
|
2015-10-15 23:05:57 -04:00
|
|
|
|
2016-01-06 14:09:32 -05:00
|
|
|
window._locale = updateLocale();
|
2018-08-22 13:05:49 -04:00
|
|
|
document.documentElement.lang = window._locale;
|
2015-10-15 23:05:57 -04:00
|
|
|
})();
|
2018-06-29 09:23:55 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* -----------------------------------------------------------------------------
|
|
|
|
* Console warning
|
|
|
|
* -----------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
(() => {
|
|
|
|
window.onload = function () {
|
2018-06-29 09:57:46 -04:00
|
|
|
/* eslint-disable no-console */
|
2018-06-29 09:23:55 -04:00
|
|
|
console.log('%cStop!', 'color: #F00; font-size: 30px; -webkit-text-stroke: 1px black; font-weight:bold');
|
|
|
|
console.log(
|
|
|
|
'This is part of your browser intended for developers. ' +
|
|
|
|
'If someone told you to copy-and-paste something here, ' +
|
|
|
|
'don\'t do it! It could allow them to take over your ' +
|
|
|
|
'Scratch account, delete all of your projects, or do many ' +
|
|
|
|
'other harmful things. If you don\'t understand what exactly ' +
|
|
|
|
'you are doing here, you should close this window without doing ' +
|
|
|
|
'anything.'
|
|
|
|
);
|
2018-06-29 09:57:46 -04:00
|
|
|
/* eslint-enable no-console */
|
2018-06-29 09:23:55 -04:00
|
|
|
};
|
|
|
|
})();
|