From 8b77ced05e5af98ad1f655dc1ab0bc78eb350c2f Mon Sep 17 00:00:00 2001 From: snowykami Date: Sun, 1 Sep 2024 16:52:10 +0800 Subject: [PATCH] =?UTF-8?q?:memo:=20[docs]:=20=E6=96=B0=E5=A2=9E=E5=9C=A8?= =?UTF-8?q?=E7=BA=BF=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/components/StatsBar.vue | 84 ++++++++++++++++++++++++++++++++++++ docs/en/index.md | 4 ++ docs/scripts/githubAPI.ts | 0 docs/scripts/i18nData.ts | 26 +++++++++++ docs/zh/index.md | 5 +++ 5 files changed, 119 insertions(+) create mode 100644 docs/components/StatsBar.vue create mode 100644 docs/scripts/githubAPI.ts create mode 100644 docs/scripts/i18nData.ts 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 @@ + + + + + \ 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 --- + + +