Getting somewhere on subuser stuff, adds i18n packages

This commit is contained in:
Dane Everitt 2019-11-16 12:46:19 -08:00
parent 2a7fc4612a
commit 01d81bd548
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
9 changed files with 215 additions and 12 deletions

32
resources/scripts/i18n.ts Normal file
View file

@ -0,0 +1,32 @@
import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
import LocalStorageBackend from 'i18next-localstorage-backend';
import XHR from 'i18next-xhr-backend';
import Backend from 'i18next-chained-backend';
i18n
.use(Backend)
.use(initReactI18next)
.init({
debug: process.env.NODE_ENV !== 'production',
lng: 'en',
fallbackLng: 'en',
keySeparator: '.',
backend: {
backends: [
LocalStorageBackend,
XHR,
],
backendOptions: [{
prefix: 'pterodactyl_lng__',
expirationTime: 7 * 24 * 60 * 60 * 1000, // 7 days, in milliseconds
store: window.localStorage,
}, {
loadPath: '/locales/{{lng}}/{{ns}}.json',
}],
},
});
// i18n.loadNamespaces(['validation']);
export default i18n;