Sink/i18n/i18n.ts
wudi e563d55852 feat: Add internationalization (i18n) support
Implemented multi-language support for the application:
- Added @nuxtjs/i18n plugin configuration
- Created locale files for English (en-US) and Chinese (zh-CN)
- Updated components to use translation keys
- Added language switcher in header
- Configured VSCode i18n-ally settings
- Prepared translation infrastructure for future language expansions
2025-03-03 11:21:39 +08:00

28 lines
547 B
TypeScript

import type { LocaleObject } from '@nuxtjs/i18n'
const locales: LocaleObject[] = [
{
code: 'zh-CN',
file: 'zh-CN.json',
name: '简体中文',
language: '简',
},
{
code: 'en-US',
file: 'en-US.json',
name: 'English',
language: 'En',
},
]
function buildLocales() {
const useLocales = Object.values(locales).reduce((acc, data) => {
acc.push(data)
return acc
}, <LocaleObject[]>[])
return useLocales.sort((a, b) => a.code.localeCompare(b.code))
}
export const currentLocales = buildLocales()