Skip to content
This repository has been archived by the owner on Oct 1, 2018. It is now read-only.

feat(i18n): setup for Chinese translation #308

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
5 changes: 5 additions & 0 deletions src/app/core/data/language.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,10 @@ export const languagesList: Lang[] = [
code: 'ru',
name: 'Russian',
nativeName: 'Русский'
},
{
code: 'zh',
name: 'Chinese',
nativeName: '中文'
}
];
2 changes: 1 addition & 1 deletion src/app/core/services/language.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 5 additions & 0 deletions src/app/core/services/operators.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
70 changes: 70 additions & 0 deletions src/assets/i18n/zh.json
Original file line number Diff line number Diff line change
@@ -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": "了解如何通过不同的源 (从 <i>npm</i> 到 <i>CDN</i>) 来安装 RxJS"
},
"LEARN": {
"TITLE": "学习",
"DESCRIPTION": "阅读 <i>Observables</i>、<i>Observer</i>、<i>Subject</i>,等一系列概念的完整文档。此外,通过查看在线示例及弹珠图来帮助你更好地理解"
}
},
"INSTALLATION": {
"TITLE": "安装指南",
"VIA": "通过",
"INTRO": "下面是安装 RxJS 的几种不同方式",
"IMPORT": "导入整个核心功能集",
"PATCHING": "通过打补丁的方式只导入所需要的 (这对于减少 bundling 的体积是十分有用的)",
"WITHBIND": "只导入需要的并且使用被提议的<a href=\"#/operators\">绑定操作符</a>:",
"NOTE": "注意:这个额外的预发需要编译器支持并且此语法可能会在没有任何通知的情况下完全从 TC39 撤回!要使用的话需要你自己来承担风险",
"ERROR": "如果使用 RxJS 时收到这样的报错信息: <code class=\"inline\">error TS2304: Cannot find name 'Promise' 或 error TS2304: Cannot find name 'Iterable'</code>,你可能需要安装额外的类型。",
"TYPINGUSERS": "对于使用 <span class=\"accent\">typings</span> 的用户:",
"NOTINTERFACE": "如果你没有使用 typings 的话,可以从 <span class=\"accent\">/es6-shim/es6-shim.d.ts.</span> 文件中拷贝定义好的接口。",
"ADDTYPE": "在 <code class=\"inline\">tsconfig.json</code> 或 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": "操作符"
}
}
1 change: 1 addition & 0 deletions src/i18n/zh/combination/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const COMBINATION_OPERATORS = [];
1 change: 1 addition & 0 deletions src/i18n/zh/conditional/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const CONDITIONAL_OPERATORS = [];
1 change: 1 addition & 0 deletions src/i18n/zh/creation/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const CREATION_OPERATORS = [];
1 change: 1 addition & 0 deletions src/i18n/zh/error-handling/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const ERROR_HANDLING_OPERATORS = [];
1 change: 1 addition & 0 deletions src/i18n/zh/filtering/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const FILTERING_OPERATORS = [];
21 changes: 21 additions & 0 deletions src/i18n/zh/index.ts
Original file line number Diff line number Diff line change
@@ -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
];
1 change: 1 addition & 0 deletions src/i18n/zh/multicasting/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const MULTICASTING_OPERATORS = [];
1 change: 1 addition & 0 deletions src/i18n/zh/transformation/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const TRANSFORMATION_OPERATORS = [];
1 change: 1 addition & 0 deletions src/i18n/zh/utility/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const UTILITY_OPERATORS = [];