Sink/i18n/i18n.ts
2025-03-31 10:59:51 +07:00

34 lines
654 B
TypeScript

import type { LocaleObject } from '@nuxtjs/i18n'
const locales: LocaleObject[] = [
{
code: 'zh-CN',
file: 'zh-CN.json',
name: '简体中文',
emoji: '🇨🇳',
},
{
code: 'en-US',
file: 'en-US.json',
name: 'English',
emoji: '🇺🇸',
},
{
code: 'vi-VN',
file: 'vi-VN.json',
name: 'Tiếng Việt',
emoji: '🇻🇳',
}
]
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()