Academy v0.8.3 完整代码基线:Go 后端(internal/cmd/cli/mcp-server/docreader)、 Vue 前端(frontend)、数据库迁移(migrations)、部署编排(docker/helm/deploy)与文档。 今日开发的培训推送管理改动随后单独提交。
40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
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'
|
|
import jaJP from './locales/ja-JP.ts'
|
|
import zhTW from './locales/zh-TW.ts'
|
|
import { BUILT_IN_DEFAULT, resolveDefaultLocale } from './resolveDefaultLocale.ts'
|
|
import { pluralRules } from './pluralizationRules.ts'
|
|
|
|
const messages = {
|
|
'zh-CN': zhCN,
|
|
'zh-TW': zhTW,
|
|
'en-US': enUS,
|
|
'ru-RU': ruRU,
|
|
'ko-KR': koKR,
|
|
'ja-JP': jaJP
|
|
}
|
|
|
|
// User's explicit past choice wins; otherwise use the deployment default.
|
|
const savedLocale = localStorage.getItem('locale') || resolveDefaultLocale(
|
|
window.__RUNTIME_CONFIG__?.DEFAULT_LOCALE,
|
|
import.meta.env.VITE_DEFAULT_LOCALE,
|
|
)
|
|
|
|
const i18n = createI18n({
|
|
legacy: false,
|
|
locale: savedLocale,
|
|
fallbackLocale: BUILT_IN_DEFAULT,
|
|
globalInjection: true,
|
|
pluralRules,
|
|
// Some translations intentionally embed `<strong>` markup (e.g. agent step summaries).
|
|
// We render them via v-html with our own sanitization, so silence vue-i18n's HTML warning
|
|
// to avoid flooding the console and slowing renders during history loads.
|
|
warnHtmlMessage: false,
|
|
messages
|
|
})
|
|
|
|
export default i18n
|