123456789101112131415161718192021222324252627 |
- "use strict";
- //使用自执行函数,避免污染同名变量
- (function () {
- var languageList = ['zh-CN'];
- var LOCAL_LANGUAGE = navigator.language;
- var getLanguage = function getLanguage() {
- var language = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : localStorage.handPyLanguage || LOCAL_LANGUAGE;
- if (!languageList.includes(language) || !languageList.includes(language.split("-")[0])) language = 'zh-CN';
- var val = location.search.match(new RegExp('[?&]lang=([^&]+)'));
- language = val ? decodeURIComponent(val[1].replace(/\+/g, '%20')) : '';
- if (['en', 'zh-hant', 'zh-hans'].indexOf(language) < 0) {
- language = 'zh-hant';
- }
- localStorage.handPyLanguage = language;
- document.write('<script src="/blockly/msg/' + language + '/blockly_messages.js"><\/script>');
- document.write('<script src="/blockly/msg/' + language + '/blocks_messages.js"><\/script>');
- document.write('<script src="/blockly/msg/' + language + '/microbit_messages.js"><\/script>');
- document.write('<script src="/blockly/msg/' + language + '/other_messages.js"><\/script>');
- document.write('<script src="/blockly/msg/js/' + language + '.js"><\/script>');
- };
- getLanguage();
- })();
|