feat(i18n): 국제화 인프라 도입 및 Vuetify 동기화, SideMenu 기본 텍스트 1차 치환

This commit is contained in:
Yu Sung
2026-05-08 13:59:46 +09:00
parent f1785a337e
commit c2663a1e9d
9 changed files with 193 additions and 18 deletions

43
src/i18n/index.js Normal file
View File

@@ -0,0 +1,43 @@
import Vue from 'vue'
import VueI18n from 'vue-i18n'
import ko from '@/locales/ko.json'
import en from '@/locales/en.json'
import ja from '@/locales/ja.json'
Vue.use(VueI18n)
function detectLocale() {
try {
const saved = localStorage.getItem('locale')
if (saved) return saved
} catch (e) {
// ignore
}
const list = (navigator.languages && navigator.languages.length
? navigator.languages
: [navigator.language || 'en'])
.map(l => String(l).toLowerCase())
for (const l of list) {
if (l.startsWith('ko')) return 'ko'
if (l.startsWith('ja')) return 'ja'
if (l.startsWith('en')) return 'en'
}
return 'en' // 매칭 실패 시 기본값
}
const i18n = new VueI18n({
locale: detectLocale(),
fallbackLocale: 'en',
messages: { ko, en, ja },
silentTranslationWarn: process.env.NODE_ENV === 'production',
missing(locale, key) {
if (process.env.NODE_ENV !== 'production') {
// eslint-disable-next-line no-console
console.warn(`[i18n missing] ${locale}: ${key}`)
}
}
})
export default i18n