1
0
forked from zguiy/utils

工具完成

This commit is contained in:
2025-06-28 22:38:49 +08:00
parent 2c668fedd0
commit 8400dbfab9
60 changed files with 23197 additions and 144 deletions

23
src/config/i18n/index.ts Normal file
View File

@ -0,0 +1,23 @@
import zh from './zh'
import en from './en'
import type { Language } from '@/types/tools'
export const locales = {
zh,
en
}
export const getTranslation = (lang: Language = 'zh') => locales[lang]
export const t = (key: string, lang: Language = 'zh') => {
const keys = key.split('.')
let value: any = locales[lang]
for (const k of keys) {
value = value?.[k]
}
return value || key
}
export default locales