diff --git a/i18n/config.ts b/i18n/config.ts index e89c4e3..6d2bb8e 100644 --- a/i18n/config.ts +++ b/i18n/config.ts @@ -5,6 +5,7 @@ import translationEN from './translations/en-US.json'; import translationPT from './translations/pt-BR.json'; import translationES from './translations/es-ES.json'; import translationDE from './translations/de-DE.json'; +import translationCN from './translations/zh-CN.json'; i18n // pass the i18n instance to react-i18next. @@ -15,7 +16,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'], + whitelist: ['en-US', 'pt-BR', 'es-ES', 'de-DE', 'zh-CN'], load: 'currentOnly', resources: { 'en-US': { @@ -30,6 +31,9 @@ i18n 'de-DE': { translation: translationDE, }, + 'zh-CN': { + translation: translationCN, + }, }, debug: false, interpolation: { diff --git a/i18n/translations/zh-CN.json b/i18n/translations/zh-CN.json new file mode 100644 index 0000000..d2dd3d2 --- /dev/null +++ b/i18n/translations/zh-CN.json @@ -0,0 +1,138 @@ +{ + "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": "查找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": "License", + "size": "大小", + "file-count": "文件数量" + }, + "maintainers": { + "title": "维护人" + }, + "contributors": { + "title": "贡献者" + }, + "engines": { + "npm-version": "NPM Version", + "node-js": "NODE JS" + } + }, + "footer": { + "powered-by": "Powered by", + "made-with-love-on": "Made with <0>♥ on" + }, + "button": { + "close": "关闭", + "cancel": "取消", + "login": "登录", + "logout": "注销", + "go-to-the-home-page": "跳转到主页", + "learn-more": "了解更多", + "fund-this-package": "<0>Fund this package" + }, + "error": { + "unspecific": "发生错误.", + "404": { + "page-not-found": "404 - 页面不存在", + "sorry-we-could-not-find-it": "对不起, 我们没找到..." + }, + "app-context-not-correct-used": "The app context was not correct used", + "package-meta-is-required-at-detail-context": "packageMeta is required at DetailContext" + } +} \ No newline at end of file diff --git a/src/App/load-dayjs-locale.ts b/src/App/load-dayjs-locale.ts index 4eceac3..a3fb4a4 100644 --- a/src/App/load-dayjs-locale.ts +++ b/src/App/load-dayjs-locale.ts @@ -44,6 +44,12 @@ function loadDayJSLocale() { dayjs.locale('es'); } break; + case 'zh-cn': + { + require('dayjs/locale/zh-cn'); + dayjs.locale('zh-cn'); + } + break; default: break; }