From f7cd171fdb11b6ab66c4b04ac5fcc203552bbc32 Mon Sep 17 00:00:00 2001 From: "SangKa.Z" Date: Wed, 11 Apr 2018 09:48:14 +0800 Subject: [PATCH] feat(i18n): setup for Chinese translation --- src/app/core/data/language.data.ts | 5 ++ src/app/core/services/language.service.ts | 2 +- src/app/core/services/operators.service.ts | 5 ++ src/assets/i18n/zh.json | 70 ++++++++++++++++++++++ src/i18n/zh/combination/index.ts | 1 + src/i18n/zh/conditional/index.ts | 1 + src/i18n/zh/creation/index.ts | 1 + src/i18n/zh/error-handling/index.ts | 1 + src/i18n/zh/filtering/index.ts | 1 + src/i18n/zh/index.ts | 21 +++++++ src/i18n/zh/multicasting/index.ts | 1 + src/i18n/zh/transformation/index.ts | 1 + src/i18n/zh/utility/index.ts | 1 + 13 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 src/assets/i18n/zh.json create mode 100644 src/i18n/zh/combination/index.ts create mode 100644 src/i18n/zh/conditional/index.ts create mode 100644 src/i18n/zh/creation/index.ts create mode 100644 src/i18n/zh/error-handling/index.ts create mode 100644 src/i18n/zh/filtering/index.ts create mode 100644 src/i18n/zh/index.ts create mode 100644 src/i18n/zh/multicasting/index.ts create mode 100644 src/i18n/zh/transformation/index.ts create mode 100644 src/i18n/zh/utility/index.ts diff --git a/src/app/core/data/language.data.ts b/src/app/core/data/language.data.ts index 6a761522..88e0d972 100644 --- a/src/app/core/data/language.data.ts +++ b/src/app/core/data/language.data.ts @@ -10,5 +10,10 @@ export const languagesList: Lang[] = [ code: 'ru', name: 'Russian', nativeName: 'Русский' + }, + { + code: 'zh', + name: 'Chinese', + nativeName: '中文' } ]; diff --git a/src/app/core/services/language.service.ts b/src/app/core/services/language.service.ts index 58b8bf71..83bd087f 100644 --- a/src/app/core/services/language.service.ts +++ b/src/app/core/services/language.service.ts @@ -11,7 +11,7 @@ export class LanguageService { constructor(private translate: TranslateService) { this.fullLangList = languagesList; - this.init(['en', 'ru']); + this.init(['en', 'ru', 'zh']); } init(languages: string[]): void { diff --git a/src/app/core/services/operators.service.ts b/src/app/core/services/operators.service.ts index 38b39710..7e49b455 100644 --- a/src/app/core/services/operators.service.ts +++ b/src/app/core/services/operators.service.ts @@ -27,6 +27,11 @@ export class OperatorsService { this._operators.next(module.ALL_OPERATORS_RU); }); break; + case 'zh': + import('../../../i18n/zh').then(module => { + this._operators.next(module.ALL_OPERATORS_ZH); + }); + break; default: import('../../../operator-docs').then(module => { this._operators.next(module.ALL_OPERATORS_EN); diff --git a/src/assets/i18n/zh.json b/src/assets/i18n/zh.json new file mode 100644 index 00000000..73bb62b2 --- /dev/null +++ b/src/assets/i18n/zh.json @@ -0,0 +1,70 @@ +{ + "MENU": { + "HOME": "主页", + "INSTALLATION": "安装", + "OPERATORS": "操作符", + "COMPANIES": "公司", + "TEAM": "团队" + }, + "OPERATOR": { + "PARAMETER": { + "TITLE": "参数", + "NAME": "名称", + "TYPE": "类型", + "ATTRIBUTE": "属性", + "DESCRIPTION": "描述" + }, + "ADDITIONAL_RESOURCES": { + "TITLE": "其他资源", + "SOURCE": "源码", + "SPECS": "测试代码" + }, + "EXAMPLES": { + "TITLE": "示例" + }, + "RELATED_OPERATORS": { + "TITLE": "相关操作符" + }, + "WALKTHROUGH": { + "TITLE": "详解" + }, + "NO_TRANSLATION": "翻译仍在进行中。请参阅英文描述。" + }, + "HOME": { + "TITLE": "JavaScript 的响应式编程库", + "GETSTARTED": "开始使用", + "DESCRIPTION": "RxJS 是使用 Observables 的响应式编程库,它使编写异步或基于回调的代码更加容易。这个项目是 Reactive-Extensions/RxJS (RxJS 4) 的重写,具有更好的性能、更好的模块性、更好的可调试调用堆栈,同时保持大部分向后兼容,只有一些破坏性的变更 (breaking changes) 是为了减少外层的 API 。", + "INSTALL": { + "TITLE": "安装", + "DESCRIPTION": "了解如何通过不同的源 (从 npmCDN) 来安装 RxJS" + }, + "LEARN": { + "TITLE": "学习", + "DESCRIPTION": "阅读 ObservablesObserverSubject,等一系列概念的完整文档。此外,通过查看在线示例及弹珠图来帮助你更好地理解" + } + }, + "INSTALLATION": { + "TITLE": "安装指南", + "VIA": "通过", + "INTRO": "下面是安装 RxJS 的几种不同方式", + "IMPORT": "导入整个核心功能集", + "PATCHING": "通过打补丁的方式只导入所需要的 (这对于减少 bundling 的体积是十分有用的)", + "WITHBIND": "只导入需要的并且使用被提议的绑定操作符:", + "NOTE": "注意:这个额外的预发需要编译器支持并且此语法可能会在没有任何通知的情况下完全从 TC39 撤回!要使用的话需要你自己来承担风险", + "ERROR": "如果使用 RxJS 时收到这样的报错信息: error TS2304: Cannot find name 'Promise' 或 error TS2304: Cannot find name 'Iterable',你可能需要安装额外的类型。", + "TYPINGUSERS": "对于使用 typings 的用户:", + "NOTINTERFACE": "如果你没有使用 typings 的话,可以从 /es6-shim/es6-shim.d.ts. 文件中拷贝定义好的接口。", + "ADDTYPE": "在 tsconfig.json 或 CLI 参数中添加类型定义文件。", + "ALLMODULETYPES": "全模块类型", + "VIAV3": "要安装这个库需要 npm 3及以上版本,使用下面的命令行", + "VIAV2": "如果你使用的还是 npm 2的话,那么在这个库升级至稳定版之前,需要明确地指定库的版本号", + "FORCDN": { + "PART1": "对于 CDN,可以使用", + "PART2": "只需要用当前的版本号来替换下面链接中的 version." + }, + "FORBETA1": "对于 RxJS 5.0.0-beta.1 到 beta.11", + "FORBETA12": "对于 RxJS 5.0.0-beta.12 及以上版本", + "ADDITIONALRESOURCES": "其他资源", + "OPERATORS": "操作符" + } +} diff --git a/src/i18n/zh/combination/index.ts b/src/i18n/zh/combination/index.ts new file mode 100644 index 00000000..ad3a62f8 --- /dev/null +++ b/src/i18n/zh/combination/index.ts @@ -0,0 +1 @@ +export const COMBINATION_OPERATORS = []; diff --git a/src/i18n/zh/conditional/index.ts b/src/i18n/zh/conditional/index.ts new file mode 100644 index 00000000..980da7dc --- /dev/null +++ b/src/i18n/zh/conditional/index.ts @@ -0,0 +1 @@ +export const CONDITIONAL_OPERATORS = []; diff --git a/src/i18n/zh/creation/index.ts b/src/i18n/zh/creation/index.ts new file mode 100644 index 00000000..f3fc19d7 --- /dev/null +++ b/src/i18n/zh/creation/index.ts @@ -0,0 +1 @@ +export const CREATION_OPERATORS = []; diff --git a/src/i18n/zh/error-handling/index.ts b/src/i18n/zh/error-handling/index.ts new file mode 100644 index 00000000..6bcd7bf3 --- /dev/null +++ b/src/i18n/zh/error-handling/index.ts @@ -0,0 +1 @@ +export const ERROR_HANDLING_OPERATORS = []; diff --git a/src/i18n/zh/filtering/index.ts b/src/i18n/zh/filtering/index.ts new file mode 100644 index 00000000..df9bbdce --- /dev/null +++ b/src/i18n/zh/filtering/index.ts @@ -0,0 +1 @@ +export const FILTERING_OPERATORS = []; diff --git a/src/i18n/zh/index.ts b/src/i18n/zh/index.ts new file mode 100644 index 00000000..c1ab0aeb --- /dev/null +++ b/src/i18n/zh/index.ts @@ -0,0 +1,21 @@ +import { OperatorDoc } from '../../operator-docs'; + +import { COMBINATION_OPERATORS } from './combination'; +import { CONDITIONAL_OPERATORS } from './conditional'; +import { CREATION_OPERATORS } from './creation'; +import { ERROR_HANDLING_OPERATORS } from './error-handling'; +import { FILTERING_OPERATORS } from './filtering'; +import { MULTICASTING_OPERATORS } from './multicasting'; +import { TRANSFORMATION_OPERATORS } from './transformation'; +import { UTILITY_OPERATORS } from './utility'; + +export const ALL_OPERATORS_ZH: OperatorDoc[] = [ + ...COMBINATION_OPERATORS, + ...CONDITIONAL_OPERATORS, + ...CREATION_OPERATORS, + ...ERROR_HANDLING_OPERATORS, + ...FILTERING_OPERATORS, + ...MULTICASTING_OPERATORS, + ...TRANSFORMATION_OPERATORS, + ...UTILITY_OPERATORS +]; diff --git a/src/i18n/zh/multicasting/index.ts b/src/i18n/zh/multicasting/index.ts new file mode 100644 index 00000000..37a7ee6f --- /dev/null +++ b/src/i18n/zh/multicasting/index.ts @@ -0,0 +1 @@ +export const MULTICASTING_OPERATORS = []; diff --git a/src/i18n/zh/transformation/index.ts b/src/i18n/zh/transformation/index.ts new file mode 100644 index 00000000..cb0f97b9 --- /dev/null +++ b/src/i18n/zh/transformation/index.ts @@ -0,0 +1 @@ +export const TRANSFORMATION_OPERATORS = []; diff --git a/src/i18n/zh/utility/index.ts b/src/i18n/zh/utility/index.ts new file mode 100644 index 00000000..adc91fb4 --- /dev/null +++ b/src/i18n/zh/utility/index.ts @@ -0,0 +1 @@ +export const UTILITY_OPERATORS = [];