WeKnora/frontend/src/i18n/index.ts

26 lines
713 B
TypeScript
Executable File
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import { createI18n } from 'vue-i18n'
import zhCN from './locales/zh-CN.ts'
import ruRU from './locales/ru-RU.ts'
import enUS from './locales/en-US.ts'
import koKR from './locales/ko-KR.ts'
const messages = {
'zh-CN': zhCN,
'en-US': enUS,
'ru-RU': ruRU,
'ko-KR': koKR
}
// Получаем сохраненный язык из localStorage или используем китайский по умолчанию
const savedLocale = localStorage.getItem('locale') || 'zh-CN'
console.log('i18n инициализация с языком:', savedLocale)
const i18n = createI18n({
legacy: false,
locale: savedLocale,
fallbackLocale: 'zh-CN',
globalInjection: true,
messages
})
export default i18n