0
0
Fork 0

basic i18n support

This commit is contained in:
Xeltica 2021-09-14 09:22:04 +09:00
parent 7eeb90eddc
commit d06f2384dc
12 changed files with 115 additions and 19 deletions

View file

@ -1,7 +1,11 @@
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
import { App } from './App';
import { LOCALSTORAGE_KEY_TOKEN } from './const';
import { resources } from './langs';
document.body.classList.add('dark');
@ -18,4 +22,17 @@ if (token) {
document.cookie = '';
}
console.log(resources);
i18n
.use(initReactI18next)
.init({
resources,
lng: localStorage['lang'] ?? 'ja_JP',
interpolation: {
escapeValue: false // react already safes from xss
}
});
ReactDOM.render(<App/>, document.getElementById('app'));