]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
docs(zh): add algolia search box translation (#2542)
author烽宁 <miqilin18@gmail.com>
Thu, 4 Jan 2024 08:36:40 +0000 (16:36 +0800)
committerGitHub <noreply@github.com>
Thu, 4 Jan 2024 08:36:40 +0000 (09:36 +0100)
* docs(zh): add algolia search box translation

* docs(zh): add algolia search box translation

packages/docs/.vitepress/config/shared.ts
packages/docs/.vitepress/config/zh.ts

index 576d6271896dabe519d9a01aba200a978d319085..37cbfc71e0528a9e58ecd1dacda0f63d472674dd 100644 (file)
@@ -1,4 +1,5 @@
 import { defineConfig, HeadConfig } from 'vitepress'
+import { zhSearch } from './zh'
 
 export const META_IMAGE = 'https://pinia.vuejs.org/social.png'
 export const isProduction =
@@ -131,10 +132,14 @@ export const sharedConfig = defineConfig({
       text: 'Suggest changes',
     },
 
-    algolia: {
-      appId: '69Y3N7LHI2',
-      apiKey: '45441f4b65a2f80329fd45c7cb371fea',
-      indexName: 'pinia',
+    search: {
+      provider: 'algolia',
+      options: {
+        appId: '69Y3N7LHI2',
+        apiKey: '45441f4b65a2f80329fd45c7cb371fea',
+        indexName: 'pinia',
+        locales: { ...zhSearch },
+      },
     },
 
     carbonAds: {
index e456e2ef764bfb18dfa2a5250c7e3549f9f71e70..4527330450cf64a50510040452f0594e1db377cb 100644 (file)
@@ -152,3 +152,47 @@ export const zhConfig: LocaleSpecificConfig<DefaultTheme.Config> = {
     },
   },
 }
+
+export const zhSearch: DefaultTheme.AlgoliaSearchOptions['locales'] = {
+  zh: {
+    placeholder: '搜索文档',
+    translations: {
+      button: {
+        buttonText: '搜索文档',
+        buttonAriaLabel: '搜索文档',
+      },
+      modal: {
+        searchBox: {
+          resetButtonTitle: '清除查询条件',
+          resetButtonAriaLabel: '清除查询条件',
+          cancelButtonText: '取消',
+          cancelButtonAriaLabel: '取消',
+        },
+        startScreen: {
+          recentSearchesTitle: '搜索历史',
+          noRecentSearchesText: '没有搜索历史',
+          saveRecentSearchButtonTitle: '保存至搜索历史',
+          removeRecentSearchButtonTitle: '从搜索历史中移除',
+          favoriteSearchesTitle: '收藏',
+          removeFavoriteSearchButtonTitle: '从收藏中移除',
+        },
+        errorScreen: {
+          titleText: '无法获取结果',
+          helpText: '你可能需要检查你的网络连接',
+        },
+        footer: {
+          selectText: '选择',
+          navigateText: '切换',
+          closeText: '关闭',
+          searchByText: '搜索供应商',
+        },
+        noResultsScreen: {
+          noResultsText: '无法找到相关结果',
+          suggestedQueryText: '你可以尝试查询',
+          reportMissingResultsText: '你认为该查询应该有结果?',
+          reportMissingResultsLinkText: '点击反馈',
+        },
+      },
+    },
+  },
+}