Skip to content

Commit

Permalink
add chinese simplified translation
Browse files Browse the repository at this point in the history
  • Loading branch information
jooy2 committed Sep 6, 2024
1 parent b30e581 commit 3338204
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 1.0.2 (2024-09-06)

Alpha build. Do not use major production.

- Add chinese simplified

## 1.0.1 (2024-09-04)

Alpha build. Do not use major production.
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ The currently supported translation languages and `translateLocale` matching val

- English: `en`
- Korean: `ko`
- Simplified Chinese: `zhHans`

If a `rootLocale` value is specified, set the language key to `root` if the label language and the `rootLocale` value are the same. In the remaining areas, it does not need to be specified as `root`.

Expand Down
100 changes: 97 additions & 3 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export declare interface VitePressI18nSearchOptions {
}

const FALLBACK_LOCALE = 'en';
const PLUGIN_SUPPORT_LOCALES: string[] = [FALLBACK_LOCALE, 'ko'];
const PLUGIN_SUPPORT_LOCALES: string[] = [FALLBACK_LOCALE, 'ko', 'zhHans'];

const LOCALES_TRANSLATIONS: KeyValueItem = {
en: {
Expand Down Expand Up @@ -86,6 +86,27 @@ const LOCALES_TRANSLATIONS: KeyValueItem = {
darkModeSwitchLabel: '다크 모드',
lightModeSwitchTitle: '라이트 모드로 변경',
darkModeSwitchTitle: '다크 모드로 변경'
},
zhHans: {
editLink: {
text: '在 GitHub 上编辑此页面'
},
docFooter: {
prev: '上一页',
next: '下一页'
},
outline: {
label: '页面导航'
},
lastUpdated: {
text: '最后更新于'
},
langMenuLabel: '多语言',
returnToTopLabel: '回到顶部',
sidebarMenuLabel: '菜单',
darkModeSwitchLabel: '主题',
lightModeSwitchTitle: '切换到浅色模式',
darkModeSwitchTitle: '切换到深色模式'
}
};

Expand Down Expand Up @@ -135,6 +156,29 @@ const LOCAL_SEARCH_TRANSLATIONS: KeyValueItem = {
}
}
}
},
zhHans: {
translations: {
button: {
buttonText: '搜索文档',
buttonAriaLabel: '搜索文档'
},
modal: {
displayDetails: '显示详细列表',
resetButtonTitle: '清除查询条件',
backButtonTitle: '关闭搜索',
noResultsText: '无法找到相关结果',
footer: {
selectText: '选择',
selectKeyAriaLabel: '进行选择',
navigateText: '切换',
navigateUpKeyAriaLabel: '向上',
navigateDownKeyAriaLabel: '下降',
closeText: '關閉',
closeKeyAriaLabel: 'esc'
}
}
}
}
};

Expand Down Expand Up @@ -185,7 +229,6 @@ const ALGOLIA_SEARCH_TRANSLATIONS: KeyValueItem = {
}
}
},
// TODO: add missing translations
ko: {
placeholder: '문서 검색',
translations: {
Expand All @@ -198,7 +241,8 @@ const ALGOLIA_SEARCH_TRANSLATIONS: KeyValueItem = {
resetButtonTitle: '검색 지우기',
resetButtonAriaLabel: '검색 지우기',
cancelButtonText: '취소',
cancelButtonAriaLabel: '취소'
cancelButtonAriaLabel: '취소',
searchInputLabel: '검색'
},
startScreen: {
recentSearchesTitle: '검색 기록',
Expand All @@ -214,8 +258,12 @@ const ALGOLIA_SEARCH_TRANSLATIONS: KeyValueItem = {
},
footer: {
selectText: '선택',
selectKeyAriaLabel: 'Enter 키',
navigateText: '탐색',
navigateUpKeyAriaLabel: '방향키 위',
navigateDownKeyAriaLabel: '방향키 아래',
closeText: '닫기',
closeKeyAriaLabel: 'Escape 키',
searchByText: '검색 기준'
},
noResultsScreen: {
Expand All @@ -226,6 +274,52 @@ const ALGOLIA_SEARCH_TRANSLATIONS: KeyValueItem = {
}
}
}
},
zhHans: {
placeholder: '搜索文档',
translations: {
button: {
buttonText: '搜索文档',
buttonAriaLabel: '搜索文档'
},
modal: {
searchBox: {
resetButtonTitle: '清除查询条件',
resetButtonAriaLabel: '清除查询条件',
cancelButtonText: '取消',
cancelButtonAriaLabel: '取消',
searchInputLabel: '搜索文档'
},
startScreen: {
recentSearchesTitle: '搜索历史',
noRecentSearchesText: '没有搜索历史',
saveRecentSearchButtonTitle: '保存至搜索历史',
removeRecentSearchButtonTitle: '从搜索历史中移除',
favoriteSearchesTitle: '收藏',
removeFavoriteSearchButtonTitle: '从收藏中移除'
},
errorScreen: {
titleText: '无法获取结果',
helpText: '你可能需要检查你的网络连接'
},
footer: {
selectText: '选择',
selectKeyAriaLabel: 'Enter键',
navigateText: '切换',
navigateUpKeyAriaLabel: '向上箭头键',
navigateDownKeyAriaLabel: '向下箭头键',
closeText: '关闭',
closeKeyAriaLabel: 'Escape键',
searchByText: '搜索提供者'
},
noResultsScreen: {
noResultsText: '无法找到相关结果',
suggestedQueryText: '你可以尝试查询',
reportMissingResultsText: '你认为该查询应该有结果?',
reportMissingResultsLinkText: '点击反馈'
}
}
}
}
};

Expand Down

0 comments on commit 3338204

Please sign in to comment.