feat: add support i18n (#1468)

This commit is contained in:
JellyBrick
2023-12-01 01:30:46 +09:00
committed by GitHub
parent 7f71c36dc0
commit 7401cf69ad
65 changed files with 1226 additions and 303 deletions

18
src/i18n/index.ts Normal file
View File

@ -0,0 +1,18 @@
import i18next, { init, t as i18t, changeLanguage } from 'i18next';
import { languageResources } from '@/i18n/resources';
export const loadI18n = async () =>
await init({
resources: languageResources,
lng: 'en',
fallbackLng: 'en',
interpolation: {
escapeValue: false
}
});
export const setLanguage = async (language: string) => await changeLanguage(language);
export const t = i18t.bind(i18next);