Skip to content
This repository was archived by the owner on Jan 16, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion i18n/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import translationCN from './translations/zh-CN.json';
import translationJP from './translations/ja-JP.json';
import translationUA from './translations/uk-UA.json';
import translationKM from './translations/km-KH.json';
import translatiobTW from './translations/zh-TW.json';

const languages = {
'en-US': {
Expand Down Expand Up @@ -39,6 +40,9 @@ const languages = {
'km-KH': {
translation: translationKM,
},
'zh-TW': {
translation: translatiobTW,
},
};

type Language = keyof typeof languages;
Expand All @@ -52,7 +56,7 @@ i18n
// in case window.VEDACCIO_LANGUAGE is undefined,it will fall back to 'en-US'
lng: window?.__VERDACCIO_BASENAME_UI_OPTIONS?.language,
fallbackLng: 'en-US',
whitelist: ['en-US', 'pt-BR', 'es-ES', 'de-DE', 'fr-FR', 'zh-CN', 'ja-JP', 'uk-UA', 'km-KH'],
whitelist: ['en-US', 'pt-BR', 'es-ES', 'de-DE', 'fr-FR', 'zh-CN', 'ja-JP', 'uk-UA', 'km-KH', 'zh-TW'],
load: 'currentOnly',
resources: languages,
debug: false,
Expand Down
3 changes: 2 additions & 1 deletion i18n/translations/de-DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@
"chinese": "Chinesisch",
"french": "Französisch",
"ukraine": "Ukrainisch",
"khmer": "Khmer"
"khmer": "Khmer",
"chineseTraditional": "Chinese Traditional"
}
}
3 changes: 2 additions & 1 deletion i18n/translations/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@
"chinese": "Chinese",
"french": "French",
"ukraine": "Ukraine",
"khmer": "Khmer"
"khmer": "Khmer",
"chineseTraditional": "Chinese Traditional"
}
}
3 changes: 2 additions & 1 deletion i18n/translations/es-ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@
"chinese": "Chino",
"french": "Francés",
"ukraine": "Ucraniano",
"khmer": "Khmer"
"khmer": "Khmer",
"chineseTraditional": "Chinese Traditional"
}
}
3 changes: 2 additions & 1 deletion i18n/translations/fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@
"chinese": "Chinois",
"french": "Français",
"ukraine": "Ukrainien",
"khmer": "Khmer"
"khmer": "Khmer",
"chineseTraditional": "Chinese Traditional"
}
}
3 changes: 2 additions & 1 deletion i18n/translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@
"chinese": "中国語",
"french": "フランス語",
"ukraine": "ウクライナ",
"khmer": "Khmer"
"khmer": "Khmer",
"chineseTraditional": "繁体字中国語"
}
}
3 changes: 2 additions & 1 deletion i18n/translations/km-KH.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@
"chinese": "ចិន",
"french": "បារាំង",
"ukraine": "អ៊ុយក្រែន",
"khmer": "ខ្មែរ"
"khmer": "ខ្មែរ",
"chineseTraditional": "Chinese Traditional"
}
}
3 changes: 2 additions & 1 deletion i18n/translations/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@
"chinese": "Chinês",
"french": "Francês",
"ukraine": "Ucraniano",
"khmer": "Khmer"
"khmer": "Khmer",
"chineseTraditional": "Chinese Traditional"
}
}
3 changes: 2 additions & 1 deletion i18n/translations/uk-UA.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@
"chinese": "Китайська",
"french": "Французька",
"ukraine": "Українська",
"khmer": "Khmer"
"khmer": "Khmer",
"chineseTraditional": "Chinese Traditional"
}
}
3 changes: 2 additions & 1 deletion i18n/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@
"chinese": "中文",
"french": "法语",
"ukraine": "乌克兰",
"khmer": "Khmer"
"khmer": "Khmer",
"chineseTraditional": "正体中文"
}
}
151 changes: 151 additions & 0 deletions i18n/translations/zh-TW.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
{
"copy-to-clipboard": "複製到剪貼簿",
"author-anonymous": "匿名",
"action-bar-action": {
"visit-home-page": "瀏覽首頁",
"open-an-issue": "提交問題",
"download-tarball": "下載 tarball"
},
"dialog": {
"registry-info": {
"title": "註冊資訊"
}
},
"header": {
"documentation": "文件",
"registry-info": "註冊資訊",
"greetings": "你好 "
},
"search": {
"packages": "搜尋套件"
},
"auto-complete": {
"loading": "載入中...",
"no-results-found": "無結果"
},
"tab": {
"uplinks": "Uplinks",
"versions": "版本",
"dependencies": "相依",
"readme": "Readme"
},
"uplinks": {
"title": "Uplinks",
"no-items": "{{name}} has no uplinks."
},
"versions": {
"current-tags": "當前標籤",
"version-history": "歷史版本",
"not-available": "無法取得"
},
"package": {
"published-on": "發布於 {{time}} •",
"version": "v{{version}}",
"visit-home-page": "瀏覽首頁",
"homepage": "首頁",
"open-an-issue": "提交問題",
"bugs": "Bugs",
"download": "下载 {{what}}",
"the-tar-file": "tar 檔案",
"tarball": "Tarball"
},
"dependencies": {
"has-no-dependencies": "{{package}} 沒有相依套件.",
"dependency-block": "{{package}}@{{version}}"
},
"form": {
"username": "使用者名稱",
"password": "密碼"
},
"form-placeholder": {
"username": "你的使用者名稱",
"password": "你的密碼"
},
"form-validation": {
"required-field": "必填欄位",
"required-min-length": "長度不可短於 {{length}}",
"unable-to-sign-in": "無法登入",
"username-or-password-cant-be-empty": "使用者名稱或密碼不可空白!"
},
"help": {
"title": "尚未發布任何 NPM 套件.",
"sub-title": "發布第一個 NPM 套件:",
"first-step": "1. 登入",
"first-step-command-line": "npm adduser --registry {{registryUrl}}",
"second-step": "2. 發布",
"second-step-command-line": "npm publish --registry {{registryUrl}}",
"third-step": "3. 重新整理頁面。"
},
"sidebar": {
"detail": {
"latest-version": "最新版本 v{{version}}",
"version": "v{{version}}"
},
"installation": {
"title": "安装",
"install-using-yarn": "使用 yarn 安装",
"install-using-yarn-command": "yarn add {{packageName}}",
"install-using-npm": "使用 npm 安装",
"install-using-npm-command": "npm install {{packageName}}",
"install-using-pnpm": "使用 pnpm 安装",
"install-using-pnpm-command": "pnpm install {{packageName}}"
},
"repository": {
"title": "儲存庫"
},
"author": {
"title": "作者"
},
"distribution": {
"title": "發布資訊",
"license": "許可",
"size": "大小",
"file-count": "檔案數量"
},
"maintainers": {
"title": "維護人員"
},
"contributors": {
"title": "貢獻人員"
},
"engines": {
"npm-version": "NPM 版本",
"node-js": "NODE JS"
}
},
"footer": {
"powered-by": "Powered by",
"made-with-love-on": "Made with <0>♥</0> on"
},
"button": {
"close": "關閉",
"cancel": "取消",
"login": "登入",
"logout": "登出",
"go-to-the-home-page": "前往首頁",
"learn-more": "了解更多",
"fund-this-package": "<0>Fund</0> this package"
},
"error": {
"unspecific": "發生錯誤。",
"404": {
"page-not-found": "404 - 頁面不存在",
"sorry-we-could-not-find-it": "不好意思, 找不到..."
},
"app-context-not-correct-used": "app context 没有被正確使用",
"theme-context-not-correct-used": "theme context 没有被正確使用",
"package-meta-is-required-at-detail-context": "packageMeta is required at DetailContext"
},
"lng": {
"english": "英文",
"japanese": "日文",
"portuguese": "葡萄牙文",
"spanish": "西班牙文",
"german": "德文",
"chinese": "簡體中文",
"french": "法文",
"ukraine": "烏克蘭文",
"khmer": "高棉文",
"chineseTraditional":"正體中文"
}
}
1 change: 1 addition & 0 deletions src/components/Footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const Footer: React.FC = () => {
<Flag name="china" size="md" />
<Flag name="austria" size="md" />
<Flag name="germany" size="md" />
<Flag name="taiwan" size="md" />
</Flags>
</ToolTip>
</Left>
Expand Down
3 changes: 3 additions & 0 deletions src/components/Icon/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import france from './img/france.svg';
import japan from './img/japan.svg';
import ukraine from './img/ukraine.svg';
import khmer from './img/khmer.svg';
import taiwan from './img/taiwan.svg';
import earth from './img/earth.svg';
import verdaccio from './img/verdaccio.svg';
import filebinary from './img/filebinary.svg';
Expand All @@ -38,6 +39,7 @@ export interface IconsMap {
japan: string;
ukraine: string;
khmer: string;
taiwan: string;
earth: string;
verdaccio: string;
license: string;
Expand Down Expand Up @@ -69,6 +71,7 @@ export const Icons: IconsMap = {
japan,
ukraine,
khmer,
taiwan,
};

export interface Props {
Expand Down
9 changes: 9 additions & 0 deletions src/components/Icon/img/taiwan.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 6 additions & 4 deletions src/components/LanguageSwitch/LanguageSwitch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ const lngDetails: Record<Language, { translation: TFunctionKeys; icon: React.Com
translation: 'lng.english',
icon: 'usa',
},
'zh-TW': {
translation: 'lng.chineseTraditional',
icon: 'taiwan',
},
};

const LanguageSwitch = () => {
Expand Down Expand Up @@ -102,10 +106,8 @@ const LanguageSwitch = () => {
),
[getCurrentLngDetails]
);

const optionLabel = useCallback(({ translation }: ReturnType<typeof getCurrentLngDetails>) => translation, [
getCurrentLngDetails,
]);
// prettier-ignore
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please why did you add 'prettier-ignore' here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can not pass lint check because of this line, but I don't know how to fix it.
So I add prettier-ignore to try but I forget removing this.
Sorry for confused you

const optionLabel = useCallback(({ translation }: ReturnType<typeof getCurrentLngDetails>) => translation, [getCurrentLngDetails]);

return (
<Wrapper>
Expand Down
6 changes: 6 additions & 0 deletions src/design-tokens/load-dayjs-locale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ function loadDayJSLocale() {
dayjs.locale('uk');
}
break;
case 'zh-tw':
{
require('dayjs/locale/zh-tw');
dayjs.locale('zh-tw');
}
break;
default:
{
require('dayjs/locale/en');
Expand Down