fix: 支持拆分标题行 "# xxx"
This commit is contained in:
parent
e6ede6bded
commit
a9132302fd
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/env ts-node
|
||||
import { dirs } from '../dirs';
|
||||
import { translateDirectory } from '../translate';
|
||||
|
||||
translateDirectory(__dirname + '/../../../../../content-en/', dirs.content);
|
|
@ -0,0 +1,6 @@
|
|||
#!/usr/bin/env ts-node
|
||||
|
||||
import { dirs } from '../dirs';
|
||||
import { translateFile } from '../translate';
|
||||
|
||||
translateFile(__dirname + '/../../../../../content-en/' + 'guide/http.md', dirs.content + 'guide/http.md');
|
|
@ -295,7 +295,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/ajs-quick-reference.md"
|
||||
},
|
||||
{
|
||||
"original": "### ng-hide\n In AngularJS, the `ng-hide` directive shows or hides the associated HTML element based on\n an expression. For more information, see [ng-show](guide/ajs-quick-reference#ng-show).",
|
||||
"original": "In AngularJS, the `ng-hide` directive shows or hides the associated HTML element based on\n an expression. For more information, see [ng-show](guide/ajs-quick-reference#ng-show).",
|
||||
"translation": "在AngularJS中,`ng-hide`指令会基于一个表达式显示或隐藏相关的HTML元素。\n 参见[ng-show](guide/ajs-quick-reference#ng-show)了解更多。",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/ajs-quick-reference.md"
|
||||
},
|
||||
|
@ -569,6 +569,11 @@
|
|||
"translation": "基于过滤条件从指定的集合中选取出一个子集。",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/ajs-quick-reference.md"
|
||||
},
|
||||
{
|
||||
"original": "### none",
|
||||
"translation": "### 没了\n For performance reasons, no comparable pipe exists in Angular. Do all your filtering in the component. If you need the same filtering code in several templates, consider building a custom pipe.",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/ajs-quick-reference.md"
|
||||
},
|
||||
{
|
||||
"original": "Converts a JavaScript object into a JSON string. This is useful for debugging.",
|
||||
"translation": "把一个JavaScript对象转换成一个JSON字符串。这对调试很有用。",
|
||||
|
@ -619,6 +624,11 @@
|
|||
"translation": "使用表达式中所指定的方式对集合进行排序。\n 在这个例子中,`movieList`被根据movie的title排序了。",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/ajs-quick-reference.md"
|
||||
},
|
||||
{
|
||||
"original": "### none",
|
||||
"translation": "### 没了\n For performance reasons, no comparable pipe exists in Angular.\n Instead, use component code to order or sort results. If you need the same ordering or sorting code in several templates, consider building a custom pipe.",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/ajs-quick-reference.md"
|
||||
},
|
||||
{
|
||||
"original": "## Modules/controllers/components",
|
||||
"translation": "## 模块/控制器/组件",
|
||||
|
@ -689,6 +699,11 @@
|
|||
"translation": "要了解关于模块的更多知识,参见[NgModules](guide/ngmodule)。",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/ajs-quick-reference.md"
|
||||
},
|
||||
{
|
||||
"original": "### Controller registration",
|
||||
"translation": "### 控制器注册",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/ajs-quick-reference.md"
|
||||
},
|
||||
{
|
||||
"original": "AngularJS has code in each controller that looks up an appropriate Angular module\n and registers the controller with that module.",
|
||||
"translation": "在AngularJS中,在每个控制器中都有一些代码,用于找到合适的Angular模块并把该控制器注册进去。",
|
||||
|
@ -805,7 +820,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/ajs-quick-reference.md"
|
||||
},
|
||||
{
|
||||
"original": "### StyleUrls\n In Angular, you can use the `styles` or `styleUrls` property of the `@Component` metadata to define\n a style sheet for a particular component.",
|
||||
"original": "In Angular, you can use the `styles` or `styleUrls` property of the `@Component` metadata to define\n a style sheet for a particular component.",
|
||||
"translation": "在Angular中,我们可以在`@Component`的元数据中使用`styles`或`styleUrls`属性来为一个特定的组件定义样式表。",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/ajs-quick-reference.md"
|
||||
},
|
||||
|
@ -824,6 +839,11 @@
|
|||
"translation": "动画是现代Web应用设计中一个很重要的方面。我们希望用户界面能在不同的状态之间更平滑的转场。如果需要,还可以用适当的动画来吸引注意力。\n设计良好的动画不但会让UI更有趣,还会让它更容易使用。",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/animations.md"
|
||||
},
|
||||
{
|
||||
"original": "## Overview",
|
||||
"translation": "## 概述",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/animations.md"
|
||||
},
|
||||
{
|
||||
"original": "Angular's animation system lets you build animations that run with the same kind of native\nperformance found in pure CSS animations. You can also tightly integrate your\nanimation logic with the rest of your application code, for ease of control.",
|
||||
"translation": "Angular的动画系统赋予了制作各种动画效果的能力,以构建出与原生CSS动画性能相同的动画。\n我们也获得了额外的让动画逻辑与其它应用代码紧紧集成在一起的能力,这让动画可以被更容易的触发与控制。",
|
||||
|
@ -1219,6 +1239,11 @@
|
|||
"translation": "其中一个动画组对元素的`transform`和`width`做动画,另一个组则对`opacity`做动画。",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/animations.md"
|
||||
},
|
||||
{
|
||||
"original": "## Animation callbacks",
|
||||
"translation": "## 动画回调",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/animations.md"
|
||||
},
|
||||
{
|
||||
"original": "A callback is fired when an animation is started and also when it is done.",
|
||||
"translation": "当动画开始和结束时,会触发一个回调。",
|
||||
|
@ -1280,8 +1305,8 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/aot-compiler.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a aot-jit}",
|
||||
"translation": "## _Ahead-of-time_ (AOT) vs _just-in-time_ (JIT)\n## 预编译(AOT) vs 即时编译(JIT)",
|
||||
"original": "## _Ahead-of-time_ (AOT) vs _just-in-time_ (JIT)",
|
||||
"translation": "## 预编译(AOT) vs 即时编译(JIT)",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/aot-compiler.md"
|
||||
},
|
||||
{
|
||||
|
@ -3384,6 +3409,11 @@
|
|||
"translation": "Angular 在持续集成过程中,对每一个提交都会使用 <a href=\"https://saucelabs.com/\" target=\"_blank\">SauceLabs</a> 和\n<a href=\"https://www.browserstack.com\" target=\"_blank\">Browserstack</a> 在上述所有浏览器上执行单元测试。",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/browser-support.md"
|
||||
},
|
||||
{
|
||||
"original": "## Polyfills #",
|
||||
"translation": "## 填充库 (polyfill) #\nAngular is built on the latest standards of the web platform.\nTargeting such a wide range of browsers is challenging because they do not support all features of modern browsers.",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/browser-support.md"
|
||||
},
|
||||
{
|
||||
"original": "You can compensate by loading polyfill scripts (\"polyfills\") on the host web page (`index.html`)\nthat implement missing features in JavaScript.",
|
||||
"translation": "你可以通过在宿主页面 (`index.html`) 中加载填充脚本 (“polyfills”) 来加以弥补,这些脚本实现了浏览器缺失的 JavaScript 特性。",
|
||||
|
@ -3404,6 +3434,11 @@
|
|||
"translation": "这些建议的填充库是运行完整 Angular 应用所需的。\n你可能还会需要另一些的填充库来支持没有出现在此列表中的哪些特性。\n注意,这些填充库并没有神奇的魔力来把老旧、慢速的浏览器变成现代、快速的浏览器,它只是填充了 API。",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/browser-support.md"
|
||||
},
|
||||
{
|
||||
"original": "### Mandatory polyfills ##",
|
||||
"translation": "### 强制性填充库 ##\nThese are the polyfills required to run an Angular application on each supported browser:",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/browser-support.md"
|
||||
},
|
||||
{
|
||||
"original": "Browsers (Desktop & Mobile)",
|
||||
"translation": "浏览器(桌面和移动)",
|
||||
|
@ -3414,6 +3449,11 @@
|
|||
"translation": "需要的填充库",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/browser-support.md"
|
||||
},
|
||||
{
|
||||
"original": "### Optional browser features to polyfill ##",
|
||||
"translation": "### 可选浏览器特性的填充库 ##\nSome features of Angular may require additional polyfills.",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/browser-support.md"
|
||||
},
|
||||
{
|
||||
"original": "For example, the animations library relies on the standard web animation API, which is only available in Chrome and Firefox today.\nYou'll need a polyfill to use animations in other browsers.",
|
||||
"translation": "例如,动画库依赖于标准的 web 动画 API,目前它只在 Chrome 和 Firefox 上可用。你可能需要一个填充库来在其它浏览器上使用动画功能。",
|
||||
|
@ -3474,6 +3514,11 @@
|
|||
"translation": "用 [Http](guide/http) 发送和接收二进制数据",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/browser-support.md"
|
||||
},
|
||||
{
|
||||
"original": "### Suggested polyfills ##",
|
||||
"translation": "### 建议的填充库 ##\nBelow are the polyfills which are used to test the framework itself. They are a good starting point for an application.",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/browser-support.md"
|
||||
},
|
||||
{
|
||||
"original": "Polyfill",
|
||||
"translation": "填充库",
|
||||
|
@ -3521,7 +3566,12 @@
|
|||
},
|
||||
{
|
||||
"original": "## All mention of moduleId removed. \"Component relative paths\" guide deleted (2017-03-13)",
|
||||
"translation": "## 移除了所有的moduleId引用。移除了“组件相对路径” 的烹饪书。(2017-03-13)\nWe added a new SystemJS plugin (systemjs-angular-loader.js) to our recommended SystemJS configuration.\nThis plugin dynamically converts \"component-relative\" paths in templateUrl and styleUrls to \"absolute paths\" for you.",
|
||||
"translation": "## 移除了所有的moduleId引用。移除了“组件相对路径” 的烹饪书。(2017-03-13)",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/change-log.md"
|
||||
},
|
||||
{
|
||||
"original": "We added a new SystemJS plugin (systemjs-angular-loader.js) to our recommended SystemJS configuration.\nThis plugin dynamically converts \"component-relative\" paths in templateUrl and styleUrls to \"absolute paths\" for you.",
|
||||
"translation": "我们往建议的SystemJS配置中新增了一个SystemJS插件 (systemjs-angular-loader.js) 。\n这个插件可以帮你把templateUrl和styleUrls中的组件相对路径动态转换为绝对路径。",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/change-log.md"
|
||||
},
|
||||
{
|
||||
|
@ -3626,7 +3676,7 @@
|
|||
},
|
||||
{
|
||||
"original": "## Miscellaneous (2017-01-05)",
|
||||
"translation": "## 杂项 (2017-01-05)* [Setup](guide/setup) guide: \nadded (optional) instructions on how to remove _non-essential_ files. [环境搭建](guide/setup)指南:\n 添加了(可选的)步骤说明,告诉你如何移除*非核心*文件。",
|
||||
"translation": "## 杂项 (2017-01-05)* [Setup](guide/setup) guide:",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/change-log.md"
|
||||
},
|
||||
{
|
||||
|
@ -6060,8 +6110,8 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a why-di }",
|
||||
"translation": "## Why dependency injection?\n## 为什么需要依赖注入?",
|
||||
"original": "## Why dependency injection?",
|
||||
"translation": "## 为什么需要依赖注入?",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection.md"
|
||||
},
|
||||
{
|
||||
|
@ -6220,8 +6270,8 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a angular-di}",
|
||||
"translation": "## Angular dependency injection\n## Angular 依赖注入",
|
||||
"original": "## Angular dependency injection",
|
||||
"translation": "## Angular 依赖注入",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection.md"
|
||||
},
|
||||
{
|
||||
|
@ -6280,8 +6330,8 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a injector-config}",
|
||||
"translation": "### Configuring the injector\n### 配置注入器",
|
||||
"original": "### Configuring the injector",
|
||||
"translation": "### 配置注入器",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection.md"
|
||||
},
|
||||
{
|
||||
|
@ -6350,8 +6400,8 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a prep-for-injection}",
|
||||
"translation": "### Preparing the _HeroListComponent_ for injection\n### 为注入准备`HeroListComponent`",
|
||||
"original": "### Preparing the _HeroListComponent_ for injection",
|
||||
"translation": "### 为注入准备`HeroListComponent`",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection.md"
|
||||
},
|
||||
{
|
||||
|
@ -6359,6 +6409,11 @@
|
|||
"translation": "`HeroListComponent`应该从注入的`HeroService`获取英雄数据。\n遵照依赖注入模式的要求,组件必须在它的构造函数中请求这些服务,[就像以前解释过的那样](guide/dependency-injection#ctor-injection)。\n只是个小改动:",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection.md"
|
||||
},
|
||||
{
|
||||
"original": "#### Focus on the constructor",
|
||||
"translation": "#### 来看看构造函数",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection.md"
|
||||
},
|
||||
{
|
||||
"original": "Adding a parameter to the constructor isn't all that's happening here.",
|
||||
"translation": "往构造函数中添加参数并不是这里所发生的一切。",
|
||||
|
@ -6390,8 +6445,8 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a singleton-services}",
|
||||
"translation": "### Singleton services\n### 单例服务",
|
||||
"original": "### Singleton services",
|
||||
"translation": "### 单例服务",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection.md"
|
||||
},
|
||||
{
|
||||
|
@ -6405,8 +6460,8 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a testing-the-component}",
|
||||
"translation": "### Testing the component\n### 测试组件",
|
||||
"original": "### Testing the component",
|
||||
"translation": "### 测试组件",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection.md"
|
||||
},
|
||||
{
|
||||
|
@ -6425,8 +6480,8 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a service-needs-service}",
|
||||
"translation": "### When the service needs a service\n### 当服务需要别的服务时",
|
||||
"original": "### When the service needs a service",
|
||||
"translation": "### 当服务需要别的服务时",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection.md"
|
||||
},
|
||||
{
|
||||
|
@ -6560,8 +6615,8 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a providers}",
|
||||
"translation": "## Injector providers\n## 注入器的提供商们",
|
||||
"original": "## Injector providers",
|
||||
"translation": "## 注入器的提供商们",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection.md"
|
||||
},
|
||||
{
|
||||
|
@ -6775,8 +6830,8 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a token}",
|
||||
"translation": "## Dependency injection tokens\n## 依赖注入令牌",
|
||||
"original": "## Dependency injection tokens",
|
||||
"translation": "## 依赖注入令牌",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection.md"
|
||||
},
|
||||
{
|
||||
|
@ -6879,6 +6934,11 @@
|
|||
"translation": "或者在 ngModule 中提供并注入这个配置对象,如`AppModule`。",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection.md"
|
||||
},
|
||||
{
|
||||
"original": "## Optional dependencies",
|
||||
"translation": "## 可选依赖",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection.md"
|
||||
},
|
||||
{
|
||||
"original": "The `HeroService` *requires* a `Logger`, but what if it could get by without\na `logger`?\nYou can tell Angular that the dependency is optional by annotating the\nconstructor argument with `@Optional()`:",
|
||||
"translation": "`HeroService`*需要*一个`Logger`,但是如果想不提供 Logger 也能得到它,该怎么办呢?\n可以把构造函数的参数标记为`@Optional()`,告诉 Angular 该依赖是可选的:",
|
||||
|
@ -6889,6 +6949,11 @@
|
|||
"translation": "当使用`@Optional()`时,代码必须准备好如何处理空值。\n如果其它的代码没有注册一个 `logger`,注入器会设置该`logger`的值为空 null。",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection.md"
|
||||
},
|
||||
{
|
||||
"original": "## Summary",
|
||||
"translation": "## 总结",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection.md"
|
||||
},
|
||||
{
|
||||
"original": "You learned the basics of Angular dependency injection in this page.\nYou can register various kinds of providers,\nand you know how to ask for an injected object (such as a service) by\nadding a parameter to a constructor.",
|
||||
"translation": "本章,我们学习了 Angular 依赖注入的基础知识。\n我们可以注册很多种类的提供商,知道如何通过添加构造函数的参数来请求一个注入对象(例如一个服务)。",
|
||||
|
@ -6900,8 +6965,8 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a explicit-injector}",
|
||||
"translation": "## Appendix: Working with injectors directly\n## 附录:直接使用注入器",
|
||||
"original": "## Appendix: Working with injectors directly",
|
||||
"translation": "## 附录:直接使用注入器",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/dependency-injection.md"
|
||||
},
|
||||
{
|
||||
|
@ -15899,6 +15964,11 @@
|
|||
"translation": "回到根模块`AppModule`,把这个`AppRoutingModule`添加到根模块的`imports`列表中,该应用就可以正常导航了。",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md"
|
||||
},
|
||||
{
|
||||
"original": "### Routing to a feature module",
|
||||
"translation": "### 路由到特性模块",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/ngmodule.md"
|
||||
},
|
||||
{
|
||||
"original": "The `src/app/contact` folder holds a new file, `contact-routing.module.ts`.\nIt defines the `contact` route mentioned earlier and provides a `ContactRoutingModule` as follows:",
|
||||
"translation": "`src/app/contact`目录中也有一个新文件`contact-routing.module.ts`。\n它定义了我们前面提到过的`联系人`路由,并提供了`ContactRoutingModule`,就像这样:",
|
||||
|
@ -16859,6 +16929,11 @@
|
|||
"translation": "要了解更多`DatePipes`的格式选项,请参阅[API文档](api/common/DatePipe)。",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/pipes.md"
|
||||
},
|
||||
{
|
||||
"original": "## Chaining pipes",
|
||||
"translation": "## 链式管道",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/pipes.md"
|
||||
},
|
||||
{
|
||||
"original": "You can chain pipes together in potentially useful combinations.\nIn the following example, to display the birthday in uppercase,\nthe birthday is chained to the `DatePipe` and on to the `UpperCasePipe`.\nThe birthday displays as **<samp>APR 15, 1988</samp>**.",
|
||||
"translation": "我们可以把管道链在一起,以组合出一些潜在的有用功能。\n下面这个例子中,我们把`birthday`链到`DatePipe`管道,然后又链到`UpperCasePipe`,这样我们就可以把生日显示成大写形式了。\n比如下面的代码就会把生日显示成**<samp>APR 15, 1988</samp>**:",
|
||||
|
@ -20535,8 +20610,8 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a optional-route-parameters}",
|
||||
"translation": "### Route Parameters: Required or optional?\n### 路由参数:必须还是可选?",
|
||||
"original": "### Route Parameters: Required or optional?",
|
||||
"translation": "### 路由参数:必须还是可选?",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/router.md"
|
||||
},
|
||||
{
|
||||
|
@ -22799,6 +22874,11 @@
|
|||
"translation": "为了防范XSS攻击,我们必须阻止恶意代码进入DOM。比如,如果某个攻击者能骗我们把`<script>`标签插入到DOM,就可以在我们的网站上运行任何代码。\n除了`<script>`,攻击者还可以使用很多DOM元素和属性来执行代码,比如`<img onerror=\"...\">`、`<a href=\"javascript:...\">`。\n如果攻击者所控制的数据混进了DOM,就会导致安全漏洞。",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/security.md"
|
||||
},
|
||||
{
|
||||
"original": "### Angular’s cross-site scripting security model",
|
||||
"translation": "### Angular的“跨站脚本安全模型”",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/security.md"
|
||||
},
|
||||
{
|
||||
"original": "To systematically block XSS bugs, Angular treats all values as untrusted by default. When a value\nis inserted into the DOM from a template, via property, attribute, style, class binding, or interpolation,\nAngular sanitizes and escapes untrusted values.",
|
||||
"translation": "为了系统性的防范XSS问题,Angular默认把所有值都当做不可信任的。\n当值从模板中以属性(Property)、DOM元素属性(Attribte)、CSS类绑定或插值表达式等途径插入到DOM中的时候,\nAngular将对这些值进行无害化处理(Sanitize),对不可信的值进行编码。",
|
||||
|
@ -26149,6 +26229,11 @@
|
|||
"translation": "回到顶部",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
|
||||
},
|
||||
{
|
||||
"original": "## Directives",
|
||||
"translation": "## 指令",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/styleguide.md"
|
||||
},
|
||||
{
|
||||
"original": "### Use directives to enhance an element",
|
||||
"translation": "### 使用指令来增强已有元素",
|
||||
|
@ -26545,7 +26630,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/template-syntax.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a html}\n## HTML in templates",
|
||||
"original": "## HTML in templates",
|
||||
"translation": "## 模板中的HTML",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/template-syntax.md"
|
||||
},
|
||||
|
@ -27595,8 +27680,8 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/template-syntax.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a event-binding}",
|
||||
"translation": "## Event binding ( <span class=\"syntax\">(event)</span> )\n## 事件绑定 ( <span class=\"syntax\">(事件名)</span> )",
|
||||
"original": "## Event binding ( <span class=\"syntax\">(event)</span> )",
|
||||
"translation": "## 事件绑定 ( <span class=\"syntax\">(事件名)</span> )",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/template-syntax.md"
|
||||
},
|
||||
{
|
||||
|
@ -29521,7 +29606,12 @@
|
|||
},
|
||||
{
|
||||
"original": "### Get injected services",
|
||||
"translation": "### 获取注入的服务\nThe tests need access to the (stub) `UserService` injected into the `WelcomeComponent`.",
|
||||
"translation": "### 获取注入的服务",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/testing.md"
|
||||
},
|
||||
{
|
||||
"original": "The tests need access to the (stub) `UserService` injected into the `WelcomeComponent`.",
|
||||
"translation": "测试程序需要访问被注入到`WelcomeComponent`中的`UserService`(stub类)。",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/testing.md"
|
||||
},
|
||||
{
|
||||
|
@ -30175,8 +30265,8 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/testing.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a routed-component-w-param}",
|
||||
"translation": "### Test a routed component with parameters\n### 测试带有路由和路由参数的组件\nClicking a _Dashboard_ hero triggers navigation to `heroes/:id`, where `:id`\nis a route parameter whose value is the `id` of the hero to edit. \nThat URL matches a route to the `HeroDetailComponent`.",
|
||||
"original": "### Test a routed component with parameters",
|
||||
"translation": "### 测试带有路由和路由参数的组件\nClicking a _Dashboard_ hero triggers navigation to `heroes/:id`, where `:id`\nis a route parameter whose value is the `id` of the hero to edit. \nThat URL matches a route to the `HeroDetailComponent`.",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/testing.md"
|
||||
},
|
||||
{
|
||||
|
@ -30976,7 +31066,12 @@
|
|||
},
|
||||
{
|
||||
"original": "### Pipes",
|
||||
"translation": "### 管道\nPipes are easy to test without the Angular testing utilities.",
|
||||
"translation": "### 管道",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/testing.md"
|
||||
},
|
||||
{
|
||||
"original": "Pipes are easy to test without the Angular testing utilities.",
|
||||
"translation": "管道很容易测试,无需Angular测试工具。",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/testing.md"
|
||||
},
|
||||
{
|
||||
|
@ -32584,6 +32679,11 @@
|
|||
"translation": "当AngularJS的内容被投影到Angular组件中时,它仍然留在“AngularJS王国”中,并被AngularJS框架管理着。",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/upgrade.md"
|
||||
},
|
||||
{
|
||||
"original": "### Transcluding Angular Content into AngularJS Component Directives",
|
||||
"translation": "### 把Angular的内容透传进AngularJS的组件型指令",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/upgrade.md"
|
||||
},
|
||||
{
|
||||
"original": "Just as you can project AngularJS content into Angular components,\nyou can *transclude* Angular content into AngularJS components, whenever\nyou are using upgraded versions from them.",
|
||||
"translation": "就像我们能把AngularJS的内容投影进Angular组件一样,我们也能把Angular的内容*透传*进AngularJS的组件,\n但不管怎样,我们都要使用它们升级过的版本。",
|
||||
|
@ -32599,6 +32699,11 @@
|
|||
"translation": "如果我们升级这个组件,并把它用在Angular中,我们就能把准备透传的内容放进这个组件的标签中。",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/upgrade.md"
|
||||
},
|
||||
{
|
||||
"original": "### Making AngularJS Dependencies Injectable to Angular",
|
||||
"translation": "### 让AngularJS中的依赖可被注入到Angular",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/upgrade.md"
|
||||
},
|
||||
{
|
||||
"original": "When running a hybrid app, you may encounter situations where you need to inject\nsome AngularJS dependencies into your Angular code.\nMaybe you have some business logic still in AngularJS services.\nMaybe you want access to AngularJS's built-in services like `$location` or `$timeout`.",
|
||||
"translation": "当运行一个混合式应用时,我们可能会遇到这种情况:我们需要把某些AngularJS的依赖注入到Angular代码中。\n这可能是因为某些业务逻辑仍然在AngularJS服务中,或者需要某些AngularJS的内置服务,比如`$location`或`$timeout`。",
|
||||
|
@ -32864,6 +32969,11 @@
|
|||
"translation": "如果项目中有任何AngularJS的服务,它们也是转换成类的优秀候选人,像控制器一样,它们也是构造函数。\n但是在本项目中,我们只有一个`Phone`工厂,这有点特别,因为它是一个`ngResource`工厂。\n所以我们不会在准备阶段中处理它,而是在下一节中直接把它转换成Angular服务。",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/upgrade.md"
|
||||
},
|
||||
{
|
||||
"original": "### Installing Angular",
|
||||
"translation": "### 安装Angular",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/upgrade.md"
|
||||
},
|
||||
{
|
||||
"original": "Having completed the preparation work, get going with the Angular\nupgrade of PhoneCat. You'll do this incrementally with the help of\n[ngUpgrade](#upgrading-with-ngupgrade) that comes with Angular.\nBy the time you're done, you'll be able to remove AngularJS from the project\ncompletely, but the key is to do this piece by piece without breaking the application.",
|
||||
"translation": "我们已经完成了准备工作,接下来就开始把PhoneCat升级到Angular。\n我们将在Angular[升级模块](guide/upgrade#upgrading-with-ngupgrade)的帮助下增量式的完成此项工作。\n等我们完成的那一刻,就能把AngularJS从项目中完全移除了,但其中的关键是在不破坏此程序的前提下一小块一小块的完成它。",
|
||||
|
@ -33329,6 +33439,11 @@
|
|||
"translation": "把这个`<phonecat-app>`元素插入到`index.html`中。\n用它来代替AngularJS中的`ng-view`指令:",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/upgrade.md"
|
||||
},
|
||||
{
|
||||
"original": "#### Create the _Routing Module_",
|
||||
"translation": "#### 创建*路由模块*\nA router needs configuration whether it's the AngularJS or Angular or any other router.",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/upgrade.md"
|
||||
},
|
||||
{
|
||||
"original": "The details of Angular router configuration are best left to the [Routing documentation](guide/router)\nwhich recommends that you create a `NgModule` dedicated to router configuration\n(called a _Routing Module_).",
|
||||
"translation": "Angular路由器配置的详情最好去查阅下[路由与导航](guide/router)文档。\n它建议你创建一个专们用于路由器配置的`NgModule`(名叫*路由模块*)。",
|
||||
|
@ -33619,6 +33734,11 @@
|
|||
"translation": "运行",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/user-input.md"
|
||||
},
|
||||
{
|
||||
"original": "## Binding to user input events",
|
||||
"translation": "## 绑定到用户输入事件",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/user-input.md"
|
||||
},
|
||||
{
|
||||
"original": "You can use [Angular event bindings](guide/template-syntax#event-binding)\nto respond to any [DOM event](https://developer.mozilla.org/en-US/docs/Web/Events).\nMany DOM events are triggered by user input. Binding to these events provides a way to\nget input from the user.",
|
||||
"translation": "你可以使用 [Angular 事件绑定](guide/template-syntax#event-binding)机制来响应任何 [DOM 事件](https://developer.mozilla.org/en-US/docs/Web/Events)。\n许多 DOM 事件是由用户输入触发的。绑定这些事件可以获取用户输入。",
|
||||
|
@ -33649,6 +33769,11 @@
|
|||
"translation": "当用户点击按钮时,Angular 调用`ClickMeComponent`的`onClickMe`方法。",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/user-input.md"
|
||||
},
|
||||
{
|
||||
"original": "## Get user input from the $event object",
|
||||
"translation": "## 通过 $event 对象取得用户输入",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/user-input.md"
|
||||
},
|
||||
{
|
||||
"original": "DOM events carry a payload of information that may be useful to the component.\nThis section shows how to bind to the `keyup` event of an input box to get the user's input after each keystroke.",
|
||||
"translation": "DOM 事件可以携带可能对组件有用的信息。\n本节将展示如何绑定输入框的`keyup`事件,在每个敲击键盘时获取用户输入。",
|
||||
|
@ -33814,6 +33939,11 @@
|
|||
"translation": "下面通过同时监听输入框的回车键和失去焦点事件来修正这个问题。",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/user-input.md"
|
||||
},
|
||||
{
|
||||
"original": "## Put it all together",
|
||||
"translation": "## 把它们放在一起",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/user-input.md"
|
||||
},
|
||||
{
|
||||
"original": "The previous page showed how to [display data](guide/displaying-data).\nThis page demonstrated event binding techniques.",
|
||||
"translation": "上一章介绍了如何[显示数据](guide/displaying-data)。\n本章展示了事件绑定技术。",
|
||||
|
@ -33829,6 +33959,11 @@
|
|||
"translation": "下面就是“简版英雄指南”组件。",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/user-input.md"
|
||||
},
|
||||
{
|
||||
"original": "### Observations",
|
||||
"translation": "### 小结",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-1/guide/user-input.md"
|
||||
},
|
||||
{
|
||||
"original": "* **Use template variables to refer to elements** —\nThe `newHero` template variable refers to the `<input>` element.\nYou can reference `newHero` from any sibling or child of the `<input>` element.",
|
||||
"translation": "**使用模板变量来引用元素** — `newHero`模板变量引用了`<input>`元素。\n你可以在`<input>`的任何兄弟或子级元素中引用`newHero`。",
|
||||
|
|
|
@ -290,7 +290,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/ajs-quick-reference.md"
|
||||
},
|
||||
{
|
||||
"original": "### ng-hide\n In AngularJS, the `ng-hide` directive shows or hides the associated HTML element based on\n an expression. For more information, see [ng-show](guide/ajs-quick-reference#ng-show).",
|
||||
"original": "In AngularJS, the `ng-hide` directive shows or hides the associated HTML element based on\n an expression. For more information, see [ng-show](guide/ajs-quick-reference#ng-show).",
|
||||
"translation": "在AngularJS中,`ng-hide`指令会基于一个表达式显示或隐藏相关的HTML元素。\n 参见[ng-show](guide/ajs-quick-reference#ng-show)了解更多。",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/ajs-quick-reference.md"
|
||||
},
|
||||
|
@ -564,6 +564,11 @@
|
|||
"translation": "基于过滤条件从指定的集合中选取出一个子集。",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/ajs-quick-reference.md"
|
||||
},
|
||||
{
|
||||
"original": "### none",
|
||||
"translation": "### 没了\n For performance reasons, no comparable pipe exists in Angular. Do all your filtering in the component. If you need the same filtering code in several templates, consider building a custom pipe.",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/ajs-quick-reference.md"
|
||||
},
|
||||
{
|
||||
"original": "Converts a JavaScript object into a JSON string. This is useful for debugging.",
|
||||
"translation": "把一个JavaScript对象转换成一个JSON字符串。这对调试很有用。",
|
||||
|
@ -614,6 +619,11 @@
|
|||
"translation": "使用表达式中所指定的方式对集合进行排序。\n 在这个例子中,`movieList`被根据movie的title排序了。",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/ajs-quick-reference.md"
|
||||
},
|
||||
{
|
||||
"original": "### none",
|
||||
"translation": "### 没了\n For performance reasons, no comparable pipe exists in Angular.\n Instead, use component code to order or sort results. If you need the same ordering or sorting code in several templates, consider building a custom pipe.",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/ajs-quick-reference.md"
|
||||
},
|
||||
{
|
||||
"original": "## Modules/controllers/components",
|
||||
"translation": "## 模块/控制器/组件",
|
||||
|
@ -824,6 +834,11 @@
|
|||
"translation": "动画是现代Web应用设计中一个很重要的方面。我们希望用户界面能在不同的状态之间更平滑的转场。如果需要,还可以用适当的动画来吸引注意力。\n设计良好的动画不但会让UI更有趣,还会让它更容易使用。",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/animations.md"
|
||||
},
|
||||
{
|
||||
"original": "## Overview",
|
||||
"translation": "## 概述",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/animations.md"
|
||||
},
|
||||
{
|
||||
"original": "Angular's animation system lets you build animations that run with the same kind of native\nperformance found in pure CSS animations. You can also tightly integrate your\nanimation logic with the rest of your application code, for ease of control.",
|
||||
"translation": "Angular的动画系统赋予了制作各种动画效果的能力,以构建出与原生CSS动画性能相同的动画。\n我们也获得了额外的让动画逻辑与其它应用代码紧紧集成在一起的能力,这让动画可以被更容易的触发与控制。",
|
||||
|
@ -1219,6 +1234,11 @@
|
|||
"translation": "其中一个动画组对元素的`transform`和`width`做动画,另一个组则对`opacity`做动画。",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/animations.md"
|
||||
},
|
||||
{
|
||||
"original": "## Animation callbacks",
|
||||
"translation": "## 动画回调",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/animations.md"
|
||||
},
|
||||
{
|
||||
"original": "A callback is fired when an animation is started and also when it is done.",
|
||||
"translation": "当动画开始和结束时,会触发一个回调。",
|
||||
|
@ -3124,6 +3144,11 @@
|
|||
"translation": "用 [Http](guide/http) 发送和接收二进制数据",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/browser-support.md"
|
||||
},
|
||||
{
|
||||
"original": "### Suggested polyfills ##",
|
||||
"translation": "### 建议的填充库 ##\nBelow are the polyfills which are used to test the framework itself. They are a good starting point for an application.",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/browser-support.md"
|
||||
},
|
||||
{
|
||||
"original": "Polyfill",
|
||||
"translation": "填充库",
|
||||
|
@ -3145,7 +3170,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/browser-support.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a non-cli}\n## Polyfills for non-CLI users",
|
||||
"original": "## Polyfills for non-CLI users",
|
||||
"translation": "## 不使用 CLI 的用户的填充库",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/browser-support.md"
|
||||
},
|
||||
|
@ -3171,7 +3196,12 @@
|
|||
},
|
||||
{
|
||||
"original": "## All mention of moduleId removed. \"Component relative paths\" guide deleted (2017-03-13)",
|
||||
"translation": "## 移除了所有的moduleId引用。移除了“组件相对路径” 的烹饪书。(2017-03-13)\nWe added a new SystemJS plugin (systemjs-angular-loader.js) to our recommended SystemJS configuration.\nThis plugin dynamically converts \"component-relative\" paths in templateUrl and styleUrls to \"absolute paths\" for you.",
|
||||
"translation": "## 移除了所有的moduleId引用。移除了“组件相对路径” 的烹饪书。(2017-03-13)",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/change-log.md"
|
||||
},
|
||||
{
|
||||
"original": "We added a new SystemJS plugin (systemjs-angular-loader.js) to our recommended SystemJS configuration.\nThis plugin dynamically converts \"component-relative\" paths in templateUrl and styleUrls to \"absolute paths\" for you.",
|
||||
"translation": "我们往建议的SystemJS配置中新增了一个SystemJS插件 (systemjs-angular-loader.js) 。\n这个插件可以帮你把templateUrl和styleUrls中的组件相对路径动态转换为绝对路径。",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/change-log.md"
|
||||
},
|
||||
{
|
||||
|
@ -3276,7 +3306,7 @@
|
|||
},
|
||||
{
|
||||
"original": "## Miscellaneous (2017-01-05)",
|
||||
"translation": "## 杂项 (2017-01-05)* [Setup](guide/setup) guide: \nadded (optional) instructions on how to remove _non-essential_ files. [环境搭建](guide/setup)指南:\n 添加了(可选的)步骤说明,告诉你如何移除*非核心*文件。",
|
||||
"translation": "## 杂项 (2017-01-05)* [Setup](guide/setup) guide:",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/change-log.md"
|
||||
},
|
||||
{
|
||||
|
@ -5525,8 +5555,8 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/dependency-injection.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a testing-the-component}",
|
||||
"translation": "## Testing the component\n## 测试组件",
|
||||
"original": "## Testing the component",
|
||||
"translation": "## 测试组件",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/dependency-injection.md"
|
||||
},
|
||||
{
|
||||
|
@ -5880,8 +5910,8 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/dependency-injection.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a optional}",
|
||||
"translation": "## Optional dependencies\n## 可选依赖",
|
||||
"original": "## Optional dependencies",
|
||||
"translation": "## 可选依赖",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/dependency-injection.md"
|
||||
},
|
||||
{
|
||||
|
@ -7691,7 +7721,12 @@
|
|||
},
|
||||
{
|
||||
"original": "### The _NgForm_ directive",
|
||||
"translation": "### `NgForm`指令What `NgForm` directive?\nYou didn't add an [NgForm](api/forms/NgForm) directive.",
|
||||
"translation": "### `NgForm`指令What `NgForm` directive?",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/forms.md"
|
||||
},
|
||||
{
|
||||
"original": "You didn't add an [NgForm](api/forms/NgForm) directive.",
|
||||
"translation": "什么是`NgForm`指令?\n但我们明明没有添加过[NgForm](api/forms/NgForm)指令啊!Angular did. Angular automatically creates and attaches an `NgForm` directive to the `<form>` tag.",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/forms.md"
|
||||
},
|
||||
{
|
||||
|
@ -10030,7 +10065,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/i18n.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a custom-id}\n### Set a custom id for persistence and maintenance",
|
||||
"original": "### Set a custom id for persistence and maintenance",
|
||||
"translation": "### 设置一个自定义的`id`来提升可搜索性和可维护性",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/i18n.md"
|
||||
},
|
||||
|
@ -10060,7 +10095,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/i18n.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a no-element}\n### Translate text without creating an element",
|
||||
"original": "### Translate text without creating an element",
|
||||
"translation": "### 翻译文本,而不必创建元素",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/i18n.md"
|
||||
},
|
||||
|
@ -10070,7 +10105,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/i18n.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a translate-attributes}\n## Add i18n translation attributes",
|
||||
"original": "## Add i18n translation attributes",
|
||||
"translation": "## 添加 *i18n* 翻译属性",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/i18n.md"
|
||||
},
|
||||
|
@ -10090,7 +10125,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/i18n.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a plural-ICU}\n## Translate singular and plural",
|
||||
"original": "## Translate singular and plural",
|
||||
"translation": "## 处理单数与复数",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/i18n.md"
|
||||
},
|
||||
|
@ -10160,7 +10195,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/i18n.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a select-ICU}\n## Select among alternative text messages",
|
||||
"original": "## Select among alternative text messages",
|
||||
"translation": "## 在候选文本中选择",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/i18n.md"
|
||||
},
|
||||
|
@ -10170,7 +10205,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/i18n.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a nesting-ICUS}\n## Nesting plural and select ICU expressions",
|
||||
"original": "## Nesting plural and select ICU expressions",
|
||||
"translation": "## 把\"复数\"与\"选择\"表达式嵌套在一起",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/i18n.md"
|
||||
},
|
||||
|
@ -10180,7 +10215,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/i18n.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a ng-xi18n}\n## Create a translation source file with _ng xi18n_",
|
||||
"original": "## Create a translation source file with _ng xi18n_",
|
||||
"translation": "## 使用_ng-xi18n_工具创建翻译源文件",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/i18n.md"
|
||||
},
|
||||
|
@ -10195,7 +10230,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/i18n.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a other-formats}\n### Other translation formats",
|
||||
"original": "### Other translation formats",
|
||||
"translation": "### 其它翻译格式",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/i18n.md"
|
||||
},
|
||||
|
@ -10205,7 +10240,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/i18n.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a ng-xi18n-options}\n### Other options",
|
||||
"original": "### Other options",
|
||||
"translation": "### 其它选项",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/i18n.md"
|
||||
},
|
||||
|
@ -10215,7 +10250,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/i18n.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a translate}\n## Translate text messages",
|
||||
"original": "## Translate text messages",
|
||||
"translation": "## 翻译文本信息",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/i18n.md"
|
||||
},
|
||||
|
@ -10230,7 +10265,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/i18n.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a localization-folder}\n### Create a localization folder",
|
||||
"original": "### Create a localization folder",
|
||||
"translation": "### 新建一个本土化目录",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/i18n.md"
|
||||
},
|
||||
|
@ -10250,7 +10285,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/i18n.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a translate-text-nodes}\n### Translate text nodes",
|
||||
"original": "### Translate text nodes",
|
||||
"translation": "### 翻译文本节点",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/i18n.md"
|
||||
},
|
||||
|
@ -10270,7 +10305,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/i18n.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a translate-select}\n### Translate _select_",
|
||||
"original": "### Translate _select_",
|
||||
"translation": "### 翻译*选择*(select)",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/i18n.md"
|
||||
},
|
||||
|
@ -10295,7 +10330,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/i18n.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a translate-nested}\n### Translate a nested expression",
|
||||
"original": "### Translate a nested expression",
|
||||
"translation": "### 翻译嵌套的表达式",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/i18n.md"
|
||||
},
|
||||
|
@ -10315,7 +10350,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/i18n.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a app-pre-translation}\n### The app and its translation file",
|
||||
"original": "### The app and its translation file",
|
||||
"translation": "### 应用及其翻译文件",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/i18n.md"
|
||||
},
|
||||
|
@ -10325,7 +10360,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/i18n.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a merge}\n## Merge the completed translation file into the app",
|
||||
"original": "## Merge the completed translation file into the app",
|
||||
"translation": "## 合并已经翻译的文件",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/i18n.md"
|
||||
},
|
||||
|
@ -10340,7 +10375,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/i18n.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a merge-jit}\n### Merge with the JIT compiler",
|
||||
"original": "### Merge with the JIT compiler",
|
||||
"translation": "### 用JiT编译器合并",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/i18n.md"
|
||||
},
|
||||
|
@ -13180,7 +13215,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/ngmodule.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a refactor-appmodule}\n### Refactor the _AppModule_",
|
||||
"original": "### Refactor the _AppModule_",
|
||||
"translation": "### 重构 *AppModule*",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/ngmodule.md"
|
||||
},
|
||||
|
@ -14074,6 +14109,11 @@
|
|||
"translation": "要了解更多`DatePipes`的格式选项,请参阅[API文档](api/common/DatePipe)。",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/pipes.md"
|
||||
},
|
||||
{
|
||||
"original": "## Chaining pipes",
|
||||
"translation": "## 链式管道",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/pipes.md"
|
||||
},
|
||||
{
|
||||
"original": "You can chain pipes together in potentially useful combinations.\nIn the following example, to display the birthday in uppercase,\nthe birthday is chained to the `DatePipe` and on to the `UpperCasePipe`.\nThe birthday displays as **<samp>APR 15, 1988</samp>**.",
|
||||
"translation": "我们可以把管道链在一起,以组合出一些潜在的有用功能。\n下面这个例子中,我们把`birthday`链到`DatePipe`管道,然后又链到`UpperCasePipe`,这样我们就可以把生日显示成大写形式了。\n比如下面的代码就会把生日显示成**<samp>APR 15, 1988</samp>**:",
|
||||
|
@ -17750,8 +17790,8 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/router.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a optional-route-parameters}",
|
||||
"translation": "### Route Parameters: Required or optional?\n### 路由参数:必须还是可选?",
|
||||
"original": "### Route Parameters: Required or optional?",
|
||||
"translation": "### 路由参数:必须还是可选?",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/router.md"
|
||||
},
|
||||
{
|
||||
|
@ -20014,6 +20054,11 @@
|
|||
"translation": "为了防范XSS攻击,我们必须阻止恶意代码进入DOM。比如,如果某个攻击者能骗我们把`<script>`标签插入到DOM,就可以在我们的网站上运行任何代码。\n除了`<script>`,攻击者还可以使用很多DOM元素和属性来执行代码,比如`<img onerror=\"...\">`、`<a href=\"javascript:...\">`。\n如果攻击者所控制的数据混进了DOM,就会导致安全漏洞。",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/security.md"
|
||||
},
|
||||
{
|
||||
"original": "### Angular’s cross-site scripting security model",
|
||||
"translation": "### Angular的“跨站脚本安全模型”",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/security.md"
|
||||
},
|
||||
{
|
||||
"original": "To systematically block XSS bugs, Angular treats all values as untrusted by default. When a value\nis inserted into the DOM from a template, via property, attribute, style, class binding, or interpolation,\nAngular sanitizes and escapes untrusted values.",
|
||||
"translation": "为了系统性的防范XSS问题,Angular默认把所有值都当做不可信任的。\n当值从模板中以属性(Property)、DOM元素属性(Attribte)、CSS类绑定或插值表达式等途径插入到DOM中的时候,\nAngular将对这些值进行无害化处理(Sanitize),对不可信的值进行编码。",
|
||||
|
@ -23364,6 +23409,11 @@
|
|||
"translation": "回到顶部",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/styleguide.md"
|
||||
},
|
||||
{
|
||||
"original": "## Directives",
|
||||
"translation": "## 指令",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/styleguide.md"
|
||||
},
|
||||
{
|
||||
"original": "### Use directives to enhance an element",
|
||||
"translation": "### 使用指令来增强已有元素",
|
||||
|
@ -23760,7 +23810,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/template-syntax.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a html}\n## HTML in templates",
|
||||
"original": "## HTML in templates",
|
||||
"translation": "## 模板中的HTML",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/template-syntax.md"
|
||||
},
|
||||
|
@ -24810,8 +24860,8 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/template-syntax.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a event-binding}",
|
||||
"translation": "## Event binding ( <span class=\"syntax\">(event)</span> )\n## 事件绑定 ( <span class=\"syntax\">(事件名)</span> )",
|
||||
"original": "## Event binding ( <span class=\"syntax\">(event)</span> )",
|
||||
"translation": "## 事件绑定 ( <span class=\"syntax\">(事件名)</span> )",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/template-syntax.md"
|
||||
},
|
||||
{
|
||||
|
@ -26686,7 +26736,12 @@
|
|||
},
|
||||
{
|
||||
"original": "### Get injected services",
|
||||
"translation": "### 获取注入的服务\nThe tests need access to the (stub) `UserService` injected into the `WelcomeComponent`.",
|
||||
"translation": "### 获取注入的服务",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/testing.md"
|
||||
},
|
||||
{
|
||||
"original": "The tests need access to the (stub) `UserService` injected into the `WelcomeComponent`.",
|
||||
"translation": "测试程序需要访问被注入到`WelcomeComponent`中的`UserService`(stub类)。",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/testing.md"
|
||||
},
|
||||
{
|
||||
|
@ -27340,8 +27395,8 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/testing.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a routed-component-w-param}",
|
||||
"translation": "### Test a routed component with parameters\n### 测试带有路由和路由参数的组件\nClicking a _Dashboard_ hero triggers navigation to `heroes/:id`, where `:id`\nis a route parameter whose value is the `id` of the hero to edit. \nThat URL matches a route to the `HeroDetailComponent`.",
|
||||
"original": "### Test a routed component with parameters",
|
||||
"translation": "### 测试带有路由和路由参数的组件\nClicking a _Dashboard_ hero triggers navigation to `heroes/:id`, where `:id`\nis a route parameter whose value is the `id` of the hero to edit. \nThat URL matches a route to the `HeroDetailComponent`.",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/testing.md"
|
||||
},
|
||||
{
|
||||
|
@ -28146,7 +28201,12 @@
|
|||
},
|
||||
{
|
||||
"original": "### Pipes",
|
||||
"translation": "### 管道\nPipes are easy to test without the Angular testing utilities.",
|
||||
"translation": "### 管道",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/testing.md"
|
||||
},
|
||||
{
|
||||
"original": "Pipes are easy to test without the Angular testing utilities.",
|
||||
"translation": "管道很容易测试,无需Angular测试工具。",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/testing.md"
|
||||
},
|
||||
{
|
||||
|
@ -29754,6 +29814,11 @@
|
|||
"translation": "当AngularJS的内容被投影到Angular组件中时,它仍然留在“AngularJS王国”中,并被AngularJS框架管理着。",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/upgrade.md"
|
||||
},
|
||||
{
|
||||
"original": "### Transcluding Angular Content into AngularJS Component Directives",
|
||||
"translation": "### 把Angular的内容透传进AngularJS的组件型指令",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/upgrade.md"
|
||||
},
|
||||
{
|
||||
"original": "Just as you can project AngularJS content into Angular components,\nyou can *transclude* Angular content into AngularJS components, whenever\nyou are using upgraded versions from them.",
|
||||
"translation": "就像我们能把AngularJS的内容投影进Angular组件一样,我们也能把Angular的内容*透传*进AngularJS的组件,\n但不管怎样,我们都要使用它们升级过的版本。",
|
||||
|
@ -29769,6 +29834,11 @@
|
|||
"translation": "如果我们升级这个组件,并把它用在Angular中,我们就能把准备透传的内容放进这个组件的标签中。",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/upgrade.md"
|
||||
},
|
||||
{
|
||||
"original": "### Making AngularJS Dependencies Injectable to Angular",
|
||||
"translation": "### 让AngularJS中的依赖可被注入到Angular",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/upgrade.md"
|
||||
},
|
||||
{
|
||||
"original": "When running a hybrid app, you may encounter situations where you need to inject\nsome AngularJS dependencies into your Angular code.\nMaybe you have some business logic still in AngularJS services.\nMaybe you want access to AngularJS's built-in services like `$location` or `$timeout`.",
|
||||
"translation": "当运行一个混合式应用时,我们可能会遇到这种情况:我们需要把某些AngularJS的依赖注入到Angular代码中。\n这可能是因为某些业务逻辑仍然在AngularJS服务中,或者需要某些AngularJS的内置服务,比如`$location`或`$timeout`。",
|
||||
|
@ -30034,6 +30104,11 @@
|
|||
"translation": "如果项目中有任何AngularJS的服务,它们也是转换成类的优秀候选人,像控制器一样,它们也是构造函数。\n但是在本项目中,我们只有一个`Phone`工厂,这有点特别,因为它是一个`ngResource`工厂。\n所以我们不会在准备阶段中处理它,而是在下一节中直接把它转换成Angular服务。",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/upgrade.md"
|
||||
},
|
||||
{
|
||||
"original": "### Installing Angular",
|
||||
"translation": "### 安装Angular",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/upgrade.md"
|
||||
},
|
||||
{
|
||||
"original": "Having completed the preparation work, get going with the Angular\nupgrade of PhoneCat. You'll do this incrementally with the help of\n[ngUpgrade](#upgrading-with-ngupgrade) that comes with Angular.\nBy the time you're done, you'll be able to remove AngularJS from the project\ncompletely, but the key is to do this piece by piece without breaking the application.",
|
||||
"translation": "我们已经完成了准备工作,接下来就开始把PhoneCat升级到Angular。\n我们将在Angular[升级模块](guide/upgrade#upgrading-with-ngupgrade)的帮助下增量式的完成此项工作。\n等我们完成的那一刻,就能把AngularJS从项目中完全移除了,但其中的关键是在不破坏此程序的前提下一小块一小块的完成它。",
|
||||
|
@ -30499,6 +30574,11 @@
|
|||
"translation": "把这个`<phonecat-app>`元素插入到`index.html`中。\n用它来代替AngularJS中的`ng-view`指令:",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/upgrade.md"
|
||||
},
|
||||
{
|
||||
"original": "#### Create the _Routing Module_",
|
||||
"translation": "#### 创建*路由模块*\nA router needs configuration whether it's the AngularJS or Angular or any other router.",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/upgrade.md"
|
||||
},
|
||||
{
|
||||
"original": "The details of Angular router configuration are best left to the [Routing documentation](guide/router)\nwhich recommends that you create a `NgModule` dedicated to router configuration\n(called a _Routing Module_).",
|
||||
"translation": "Angular路由器配置的详情最好去查阅下[路由与导航](guide/router)文档。\n它建议你创建一个专们用于路由器配置的`NgModule`(名叫*路由模块*)。",
|
||||
|
@ -30789,6 +30869,11 @@
|
|||
"translation": "运行",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/user-input.md"
|
||||
},
|
||||
{
|
||||
"original": "## Binding to user input events",
|
||||
"translation": "## 绑定到用户输入事件",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/user-input.md"
|
||||
},
|
||||
{
|
||||
"original": "You can use [Angular event bindings](guide/template-syntax#event-binding)\nto respond to any [DOM event](https://developer.mozilla.org/en-US/docs/Web/Events).\nMany DOM events are triggered by user input. Binding to these events provides a way to\nget input from the user.",
|
||||
"translation": "你可以使用 [Angular 事件绑定](guide/template-syntax#event-binding)机制来响应任何 [DOM 事件](https://developer.mozilla.org/en-US/docs/Web/Events)。\n许多 DOM 事件是由用户输入触发的。绑定这些事件可以获取用户输入。",
|
||||
|
@ -30819,6 +30904,11 @@
|
|||
"translation": "当用户点击按钮时,Angular 调用`ClickMeComponent`的`onClickMe`方法。",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/user-input.md"
|
||||
},
|
||||
{
|
||||
"original": "## Get user input from the $event object",
|
||||
"translation": "## 通过 $event 对象取得用户输入",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/user-input.md"
|
||||
},
|
||||
{
|
||||
"original": "DOM events carry a payload of information that may be useful to the component.\nThis section shows how to bind to the `keyup` event of an input box to get the user's input after each keystroke.",
|
||||
"translation": "DOM 事件可以携带可能对组件有用的信息。\n本节将展示如何绑定输入框的`keyup`事件,在每个敲击键盘时获取用户输入。",
|
||||
|
@ -30984,6 +31074,11 @@
|
|||
"translation": "下面通过同时监听输入框的回车键和失去焦点事件来修正这个问题。",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/user-input.md"
|
||||
},
|
||||
{
|
||||
"original": "## Put it all together",
|
||||
"translation": "## 把它们放在一起",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/user-input.md"
|
||||
},
|
||||
{
|
||||
"original": "The previous page showed how to [display data](guide/displaying-data).\nThis page demonstrated event binding techniques.",
|
||||
"translation": "上一章介绍了如何[显示数据](guide/displaying-data)。\n本章展示了事件绑定技术。",
|
||||
|
@ -30999,6 +31094,11 @@
|
|||
"translation": "下面就是“简版英雄指南”组件。",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/user-input.md"
|
||||
},
|
||||
{
|
||||
"original": "### Observations",
|
||||
"translation": "### 小结",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-2/guide/user-input.md"
|
||||
},
|
||||
{
|
||||
"original": "* **Use template variables to refer to elements** —\nThe `newHero` template variable refers to the `<input>` element.\nYou can reference `newHero` from any sibling or child of the `<input>` element.",
|
||||
"translation": "**使用模板变量来引用元素** — `newHero`模板变量引用了`<input>`元素。\n你可以在`<input>`的任何兄弟或子级元素中引用`newHero`。",
|
||||
|
|
|
@ -290,7 +290,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/ajs-quick-reference.md"
|
||||
},
|
||||
{
|
||||
"original": "### ng-hide\n In AngularJS, the `ng-hide` directive shows or hides the associated HTML element based on\n an expression. For more information, see [ng-show](guide/ajs-quick-reference#ng-show).",
|
||||
"original": "In AngularJS, the `ng-hide` directive shows or hides the associated HTML element based on\n an expression. For more information, see [ng-show](guide/ajs-quick-reference#ng-show).",
|
||||
"translation": "在AngularJS中,`ng-hide`指令会基于一个表达式显示或隐藏相关的HTML元素。\n 参见[ng-show](guide/ajs-quick-reference#ng-show)了解更多。",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/ajs-quick-reference.md"
|
||||
},
|
||||
|
@ -2955,7 +2955,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/browser-support.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a non-cli}\n## Polyfills for non-CLI users",
|
||||
"original": "## Polyfills for non-CLI users",
|
||||
"translation": "## 不使用 CLI 的用户的腻子脚本",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/browser-support.md"
|
||||
},
|
||||
|
@ -9330,7 +9330,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/http.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a error-details}\n### Getting error details",
|
||||
"original": "### Getting error details",
|
||||
"translation": "### 获取错误详情",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/http.md"
|
||||
},
|
||||
|
@ -9535,7 +9535,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a custom-id}\n### Set a custom id for persistence and maintenance",
|
||||
"original": "### Set a custom id for persistence and maintenance",
|
||||
"translation": "### 设置一个自定义的`id`来提升可搜索性和可维护性",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
|
||||
},
|
||||
|
@ -9565,7 +9565,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a no-element}\n### Translate text without creating an element",
|
||||
"original": "### Translate text without creating an element",
|
||||
"translation": "### 翻译文本,而不必创建元素",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
|
||||
},
|
||||
|
@ -9575,7 +9575,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a translate-attributes}\n## Add i18n translation attributes",
|
||||
"original": "## Add i18n translation attributes",
|
||||
"translation": "## 添加 *i18n* 翻译属性",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
|
||||
},
|
||||
|
@ -9595,7 +9595,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a plural-ICU}\n## Translate singular and plural",
|
||||
"original": "## Translate singular and plural",
|
||||
"translation": "## 处理单数与复数",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
|
||||
},
|
||||
|
@ -9665,7 +9665,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a select-ICU}\n## Select among alternative text messages",
|
||||
"original": "## Select among alternative text messages",
|
||||
"translation": "## 在候选文本中选择",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
|
||||
},
|
||||
|
@ -9675,7 +9675,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a nesting-ICUS}\n## Nesting plural and select ICU expressions",
|
||||
"original": "## Nesting plural and select ICU expressions",
|
||||
"translation": "## 把\"复数\"与\"选择\"表达式嵌套在一起",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
|
||||
},
|
||||
|
@ -9685,7 +9685,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a ng-xi18n}\n## Create a translation source file with _ng xi18n_",
|
||||
"original": "## Create a translation source file with _ng xi18n_",
|
||||
"translation": "## 使用_ng-xi18n_工具创建翻译源文件",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
|
||||
},
|
||||
|
@ -9700,7 +9700,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a other-formats}\n### Other translation formats",
|
||||
"original": "### Other translation formats",
|
||||
"translation": "### 其它翻译格式",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
|
||||
},
|
||||
|
@ -9710,7 +9710,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a ng-xi18n-options}\n### Other options",
|
||||
"original": "### Other options",
|
||||
"translation": "### 其它选项",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
|
||||
},
|
||||
|
@ -9720,7 +9720,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a translate}\n## Translate text messages",
|
||||
"original": "## Translate text messages",
|
||||
"translation": "## 翻译文本信息",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
|
||||
},
|
||||
|
@ -9735,7 +9735,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a localization-folder}\n### Create a localization folder",
|
||||
"original": "### Create a localization folder",
|
||||
"translation": "### 新建一个本土化目录",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
|
||||
},
|
||||
|
@ -9755,7 +9755,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a translate-text-nodes}\n### Translate text nodes",
|
||||
"original": "### Translate text nodes",
|
||||
"translation": "### 翻译文本节点",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
|
||||
},
|
||||
|
@ -9775,7 +9775,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a translate-select}\n### Translate _select_",
|
||||
"original": "### Translate _select_",
|
||||
"translation": "### 翻译*选择*(select)",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
|
||||
},
|
||||
|
@ -9800,7 +9800,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a translate-nested}\n### Translate a nested expression",
|
||||
"original": "### Translate a nested expression",
|
||||
"translation": "### 翻译嵌套的表达式",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
|
||||
},
|
||||
|
@ -9820,7 +9820,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a app-pre-translation}\n### The app and its translation file",
|
||||
"original": "### The app and its translation file",
|
||||
"translation": "### 应用及其翻译文件",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
|
||||
},
|
||||
|
@ -9830,7 +9830,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a merge}\n## Merge the completed translation file into the app",
|
||||
"original": "## Merge the completed translation file into the app",
|
||||
"translation": "## 合并已经翻译的文件",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
|
||||
},
|
||||
|
@ -9845,7 +9845,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a merge-jit}\n### Merge with the JIT compiler",
|
||||
"original": "### Merge with the JIT compiler",
|
||||
"translation": "### 用JiT编译器合并",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/i18n.md"
|
||||
},
|
||||
|
@ -11520,7 +11520,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/ngmodule-faq.md"
|
||||
},
|
||||
{
|
||||
"original": "### `SharedModule`\n`SharedModule` is a conventional name for an `NgModule` with the components, directives, and pipes that you use\neverywhere in your app. This module should consist entirely of `declarations`,\nmost of them exported.",
|
||||
"original": "`SharedModule` is a conventional name for an `NgModule` with the components, directives, and pipes that you use\neverywhere in your app. This module should consist entirely of `declarations`,\nmost of them exported.",
|
||||
"translation": "为那些可能会在应用中到处使用的组件、指令和管道创建`SharedModule`。\n 这种模块应该只包含`declarations`,并且应该导出几乎所有`declarations`里面的声明。",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/ngmodule-faq.md"
|
||||
},
|
||||
|
@ -11540,7 +11540,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/ngmodule-faq.md"
|
||||
},
|
||||
{
|
||||
"original": "### `CoreModule`\n`CoreModule` is a conventional name for an `NgModule` with `providers` for\nthe singleton services you load when the application starts.",
|
||||
"original": "`CoreModule` is a conventional name for an `NgModule` with `providers` for\nthe singleton services you load when the application starts.",
|
||||
"translation": "为你要在应用启动时加载的那些服务创建一个带`providers`的`CoreModule`。",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/ngmodule-faq.md"
|
||||
},
|
||||
|
@ -21765,7 +21765,7 @@
|
|||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/template-syntax.md"
|
||||
},
|
||||
{
|
||||
"original": "{@a html}\n## HTML in templates",
|
||||
"original": "## HTML in templates",
|
||||
"translation": "## 模板中的HTML",
|
||||
"sourceFile": "/Users/twer/private/GDE/content-3/guide/template-syntax.md"
|
||||
},
|
||||
|
|
|
@ -11,12 +11,4 @@ describe('根据字典进行翻译', () => {
|
|||
it('查字典', () => {
|
||||
expect(lookup('# Forms')[0].translation).eql('# 表单');
|
||||
});
|
||||
|
||||
it('自动根据字典翻译单个文件(测试)', function () {
|
||||
translateFile(__dirname + '/../../../../content-en/' + 'guide/forms.md', dirs.content + 'guide/forms.md');
|
||||
});
|
||||
|
||||
it('自动根据字典翻译所有文件(非测试)', function () {
|
||||
translateDirectory(__dirname + '/../../../../content-en/', dirs.content);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -26,7 +26,7 @@ export function translate(content: string): string[] {
|
|||
if (!line.trim()) {
|
||||
return line;
|
||||
}
|
||||
const translations = lookup(line, /forms.md$/);
|
||||
const translations = lookup(line);
|
||||
const indent = indentOf(line);
|
||||
const padding = repeat(indent);
|
||||
if (translations.length === 0) {
|
||||
|
@ -48,6 +48,8 @@ export function translateFile(sourceFile: string, targetFile: string): void {
|
|||
export function translateDirectory(sourceDir: string, targetDir: string): void {
|
||||
const files = listMarkdownFiles(sourceDir);
|
||||
files.forEach(fileName => {
|
||||
console.log('translating ...', fileName);
|
||||
translateFile(fileName, fileName.replace(/^.*content-en\//, dirs.content));
|
||||
console.log('translated ', fileName);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -2,11 +2,27 @@ import { expect } from 'chai';
|
|||
import { normalizeLines } from './utils';
|
||||
|
||||
describe(' 工具函数', () => {
|
||||
it('把“- * 1. #”等处理成空行分隔的格式,以便处理', function () {
|
||||
it('把“1. ”列表处理成空行分隔的格式,以便处理', function () {
|
||||
const lines = normalizeLines('1. abc\n11. def\n');
|
||||
expect(lines).eql('1. abc\n\n11. def\n');
|
||||
});
|
||||
|
||||
it('把“- ”列表处理成空行分隔的格式,以便处理', function () {
|
||||
const lines = normalizeLines('- abc\n- def\n');
|
||||
expect(lines).eql('- abc\n\n- def\n');
|
||||
});
|
||||
|
||||
it('把“* ”列表处理成空行分隔的格式,以便处理', function () {
|
||||
const lines = normalizeLines('* abc\n* def\n');
|
||||
expect(lines).eql('* abc\n\n* def\n');
|
||||
});
|
||||
|
||||
it('把“# ”标题处理成空行分隔的格式,以便处理', function () {
|
||||
const lines = normalizeLines(`\n# abc
|
||||
def`);
|
||||
expect(lines).eql('\n\n# abc\n\ndef');
|
||||
});
|
||||
|
||||
it('把 html tag 拆解开', function () {
|
||||
const lines = normalizeLines(`
|
||||
<header>
|
||||
|
@ -19,11 +35,15 @@ describe(' 工具函数', () => {
|
|||
|
||||
Angular forms don't require a style library
|
||||
|
||||
|
||||
</header>
|
||||
|
||||
`);
|
||||
});
|
||||
|
||||
it('不要拆解行内的 html tag', function () {
|
||||
expect(normalizeLines(`\na <b> c\n\n`)).eql('\na <b> c\n\n');
|
||||
});
|
||||
it('把连续的三行及以上空行简化为两个空行', function () {
|
||||
const lines = normalizeLines(`\n a \n\n\n b `);
|
||||
expect(lines).eql(`\n a \n\n b `);
|
||||
|
|
|
@ -47,9 +47,13 @@ export function isHead(line: string): boolean {
|
|||
|
||||
export function normalizeLines(text: string): string {
|
||||
// 列表、标题等自带换行含义的markdown
|
||||
const blockElementPattern = /(?=\n *(\d+\.|-|\*|#|<) )\n/g;
|
||||
const htmlTagPattern = /(\s*<.*?>\s*?)\n/g;
|
||||
const blockElementPattern = /(?=\n *(\d+\.|-|\*) )\n/g;
|
||||
text = text.replace(blockElementPattern, '\n\n');
|
||||
const hxPattern = /(\n *#.*)\n/g;
|
||||
text = text.replace(hxPattern, '\n$1\n\n');
|
||||
const leadHxPattern = /^( *#.*)\n/g;
|
||||
text = text.replace(leadHxPattern, '$1\n\n');
|
||||
const htmlTagPattern = /(\s*<.*?>\s*?)\n/g;
|
||||
text = text.replace(htmlTagPattern, '\n\n$1\n\n');
|
||||
text = text.replace(/\n\n+/, '\n\n');
|
||||
return text;
|
||||
|
|
Loading…
Reference in New Issue