Skip to content

Commit 5522477

Browse files
authored
docs(zh): add algolia search box translation (#2100)
* docs(zh): add algolia search box translation * modify
1 parent eff7ec0 commit 5522477

File tree

2 files changed

+53
-4
lines changed

2 files changed

+53
-4
lines changed

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { defineConfig, HeadConfig } from 'vitepress'
2+
import { zhSearch } from './zh'
23

34
// TODO:
45
// export const META_IMAGE = 'https://router.vuejs.org/social.png'
@@ -143,10 +144,14 @@ export const sharedConfig = defineConfig({
143144
text: 'Suggest changes',
144145
},
145146

146-
algolia: {
147-
appId: 'BTNTW3I1XP',
148-
apiKey: '771d10c8c5cc48f7922f15048b4d931c',
149-
indexName: 'next_router_vuejs',
147+
search: {
148+
provider: 'algolia',
149+
options: {
150+
appId: 'BTNTW3I1XP',
151+
apiKey: '771d10c8c5cc48f7922f15048b4d931c',
152+
indexName: 'next_router_vuejs',
153+
locales: { ...zhSearch },
154+
},
150155
},
151156

152157
carbonAds: {

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

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,3 +193,47 @@ export const zhConfig: LocaleSpecificConfig<DefaultTheme.Config> = {
193193
},
194194
},
195195
}
196+
197+
export const zhSearch: DefaultTheme.AlgoliaSearchOptions['locales'] = {
198+
zh: {
199+
placeholder: '搜索文档',
200+
translations: {
201+
button: {
202+
buttonText: '搜索文档',
203+
buttonAriaLabel: '搜索文档',
204+
},
205+
modal: {
206+
searchBox: {
207+
resetButtonTitle: '清除查询条件',
208+
resetButtonAriaLabel: '清除查询条件',
209+
cancelButtonText: '取消',
210+
cancelButtonAriaLabel: '取消',
211+
},
212+
startScreen: {
213+
recentSearchesTitle: '搜索历史',
214+
noRecentSearchesText: '没有搜索历史',
215+
saveRecentSearchButtonTitle: '保存至搜索历史',
216+
removeRecentSearchButtonTitle: '从搜索历史中移除',
217+
favoriteSearchesTitle: '收藏',
218+
removeFavoriteSearchButtonTitle: '从收藏中移除',
219+
},
220+
errorScreen: {
221+
titleText: '无法获取结果',
222+
helpText: '你可能需要检查你的网络连接',
223+
},
224+
footer: {
225+
selectText: '选择',
226+
navigateText: '切换',
227+
closeText: '关闭',
228+
searchByText: '搜索供应商',
229+
},
230+
noResultsScreen: {
231+
noResultsText: '无法找到相关结果',
232+
suggestedQueryText: '你可以尝试查询',
233+
reportMissingResultsText: '你认为该查询应该有结果?',
234+
reportMissingResultsLinkText: '点击反馈',
235+
},
236+
},
237+
},
238+
},
239+
}

0 commit comments

Comments
 (0)