From 33382047dd34d07ad39a3e8e517d0ef3833d8939 Mon Sep 17 00:00:00 2001 From: leejooy96 Date: Fri, 6 Sep 2024 15:53:21 +0900 Subject: [PATCH] add chinese simplified translation --- CHANGELOG.md | 6 ++++ README.md | 1 + lib/index.ts | 100 +++++++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 104 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7bcafa7..a9923b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/README.md b/README.md index 0887b14..92f4ec6 100644 --- a/README.md +++ b/README.md @@ -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`. diff --git a/lib/index.ts b/lib/index.ts index 91cc57c..8a35966 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -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: { @@ -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: '切换到深色模式' } }; @@ -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' + } + } + } } }; @@ -185,7 +229,6 @@ const ALGOLIA_SEARCH_TRANSLATIONS: KeyValueItem = { } } }, - // TODO: add missing translations ko: { placeholder: '문서 검색', translations: { @@ -198,7 +241,8 @@ const ALGOLIA_SEARCH_TRANSLATIONS: KeyValueItem = { resetButtonTitle: '검색 지우기', resetButtonAriaLabel: '검색 지우기', cancelButtonText: '취소', - cancelButtonAriaLabel: '취소' + cancelButtonAriaLabel: '취소', + searchInputLabel: '검색' }, startScreen: { recentSearchesTitle: '검색 기록', @@ -214,8 +258,12 @@ const ALGOLIA_SEARCH_TRANSLATIONS: KeyValueItem = { }, footer: { selectText: '선택', + selectKeyAriaLabel: 'Enter 키', navigateText: '탐색', + navigateUpKeyAriaLabel: '방향키 위', + navigateDownKeyAriaLabel: '방향키 아래', closeText: '닫기', + closeKeyAriaLabel: 'Escape 키', searchByText: '검색 기준' }, noResultsScreen: { @@ -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: '点击反馈' + } + } + } } };