basic i18n support
This commit is contained in:
parent
7eeb90eddc
commit
d06f2384dc
12 changed files with 115 additions and 19 deletions
|
@ -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'));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue