mirror of
https://github.com/LiteyukiStudio/LiteyukiBot.git
synced 2024-11-15 01:34:38 +08:00
26 lines
621 B
TypeScript
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];
|
||
|
}
|