mirror of
https://github.com/SomboChea/ui
synced 2024-11-05 14:14:26 +07:00
0abe1ef41c
* feat: spanish translations to UI * chore: enable spanish
37 lines
1010 B
TypeScript
37 lines
1010 B
TypeScript
import i18n from 'i18next';
|
|
import { initReactI18next } from 'react-i18next';
|
|
|
|
import translationEN from './translations/en-US.json';
|
|
import translationPT from './translations/pt-BR.json';
|
|
import translationES from './translations/es-ES.json';
|
|
|
|
i18n
|
|
// pass the i18n instance to react-i18next.
|
|
.use(initReactI18next)
|
|
// init i18next
|
|
// for all options read: https://www.i18next.com/overview/configuration-options
|
|
.init({
|
|
// in case window.VEDACCIO_LANGUAGE is undefined,it will fall back to 'en-US'
|
|
lng: window?.__VERDACCIO_BASENAME_UI_OPTIONS?.language,
|
|
fallbackLng: 'en-US',
|
|
whitelist: ['en-US', 'pt-BR', 'es-ES'],
|
|
load: 'currentOnly',
|
|
resources: {
|
|
'en-US': {
|
|
translation: translationEN,
|
|
},
|
|
'pt-BR': {
|
|
translation: translationPT,
|
|
},
|
|
'es-ES': {
|
|
translation: translationES,
|
|
},
|
|
},
|
|
debug: false,
|
|
interpolation: {
|
|
escapeValue: false, // react already safes from xss
|
|
},
|
|
});
|
|
|
|
export default i18n;
|