diff --git a/docs/components/StatsBar.vue b/docs/components/StatsBar.vue new file mode 100644 index 00000000..624e8c07 --- /dev/null +++ b/docs/components/StatsBar.vue @@ -0,0 +1,84 @@ + + + + + + + + {{ totalText }} + + {{total.valueOf() < 0 ? getText('fetching') : total.valueOf()}} + + + + + {{ onlineText }} + + {{ online.valueOf() < 0 ? getText('fetching') : online.valueOf()}} + + + + + \ No newline at end of file diff --git a/docs/en/index.md b/docs/en/index.md index 8ad4dc87..c884c8c1 100644 --- a/docs/en/index.md +++ b/docs/en/index.md @@ -59,3 +59,7 @@ features: details: The project follows the LSO LICENSE and is open to contributions link: https://github.com/LiteyukiStudio/LiteyukiStudioOpensourceLICENSE --- + + \ No newline at end of file diff --git a/docs/scripts/githubAPI.ts b/docs/scripts/githubAPI.ts new file mode 100644 index 00000000..e69de29b diff --git a/docs/scripts/i18nData.ts b/docs/scripts/i18nData.ts new file mode 100644 index 00000000..c262dcc5 --- /dev/null +++ b/docs/scripts/i18nData.ts @@ -0,0 +1,26 @@ +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]; +} \ No newline at end of file diff --git a/docs/zh/index.md b/docs/zh/index.md index 55745b15..0017920b 100644 --- a/docs/zh/index.md +++ b/docs/zh/index.md @@ -59,3 +59,8 @@ features: details: 项目遵循LSO LICENCE开源,欢迎各位的贡献 link: https://github.com/LiteyukiStudio/LiteyukiStudioOpensourceLICENSE --- + + +