mue/src/index.js

54 lines
1.7 KiB
JavaScript
Raw Normal View History

import { createRoot } from 'react-dom/client';
2020-10-29 16:05:28 +00:00
2019-10-21 19:04:30 +00:00
import App from './App';
2021-09-23 14:56:41 +00:00
import variables from 'modules/variables';
2019-09-29 16:46:53 +00:00
import './scss/index.scss';
// the toast css is based on default so we need to import it
import 'react-toastify/dist/ReactToastify.min.css';
2021-08-23 14:33:09 +00:00
// local stats
2021-08-28 14:34:12 +00:00
import Stats from 'modules/helpers/stats';
2021-06-21 16:42:14 +00:00
// language
import I18n from '@eartharoid/i18n';
const languagecode = localStorage.getItem('language') || 'en_GB';
// we set things to window. so we avoid passing the translation strings as props to each component
variables.languagecode = languagecode.replace('-', '_');
if (languagecode === 'en') {
variables.languagecode = 'en_GB';
}
variables.language = new I18n(variables.languagecode, {
de_DE: require('./translations/de_DE.json'),
en_GB: require('./translations/en_GB.json'),
en_US: require('./translations/en_US.json'),
es: require('./translations/es.json'),
fr: require('./translations/fr.json'),
nl: require('./translations/nl.json'),
no: require('./translations/no.json'),
ru: require('./translations/ru.json'),
zh_CN: require('./translations/zh_CN.json'),
id_ID: require('./translations/id_ID.json'),
});
// set html language tag
if (variables.languagecode !== 'en_GB' || variables.languagecode !== 'en_US') {
document.documentElement.lang = variables.languagecode.split('_')[0];
}
if (localStorage.getItem('stats') === 'true') {
variables.stats = Stats;
}
2021-11-17 22:10:07 +00:00
/*if (localStorage.getItem('keybindsEnabled') === 'true') {
variables.keybinds = JSON.parse(localStorage.getItem('keybinds') || '{}');
2021-11-17 22:10:07 +00:00
}*/
const container = document.getElementById('root');
const root = createRoot(container);
root.render(<App />);