1
0
forked from bot/app
LiteyukiBot/docs/scripts/i18nData.ts
2024-09-01 16:52:10 +08:00

26 lines
621 B
TypeScript

import {useData} from "vitepress";
const i18nData = {
"zh": {
online: '当前在线',
offline: '离线',
total: '全球实例',
fetching: '获取中',
},
"en": {
online: 'Online',
offline: 'Offline',
total: 'Total',
fetching: 'Fetching',
}
}
export default function getText(key: string): string {
// 转换语言
// zh-Hans -> zh
// en-US -> en
if (useData().site.value.lang.includes('-')) {
return i18nData[useData().site.value.lang.split('-')[0]][key];
}
return i18nData[useData().site.value.lang][key];
}