mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-14 03:41:46 +00:00
feat: add support i18n (#1468)
This commit is contained in:
18
src/i18n/index.ts
Normal file
18
src/i18n/index.ts
Normal 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);
|
||||
|
||||
Reference in New Issue
Block a user