23 lines
531 B
TypeScript
23 lines
531 B
TypeScript
import i18n from 'i18next';
|
|
import { initReactI18next } from 'react-i18next';
|
|
import ko from '../locales/ko.json';
|
|
import en from '../locales/en.json';
|
|
|
|
const LANGUAGE_KEY = 'castad_language';
|
|
|
|
i18n.use(initReactI18next).init({
|
|
resources: {
|
|
ko: { translation: ko },
|
|
en: { translation: en },
|
|
},
|
|
lng: localStorage.getItem(LANGUAGE_KEY) || 'ko',
|
|
fallbackLng: 'ko',
|
|
interpolation: { escapeValue: false },
|
|
});
|
|
|
|
i18n.on('languageChanged', (lng) => {
|
|
localStorage.setItem(LANGUAGE_KEY, lng);
|
|
});
|
|
|
|
export default i18n;
|