From 6120300d4a6366988f6989df16160f791282d5a1 Mon Sep 17 00:00:00 2001 From: Zhicheng Wang Date: Thu, 1 Mar 2018 14:07:51 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=B8=AD=E8=8B=B1=E5=AD=97=E5=85=B8?= =?UTF-8?q?=E6=94=B6=E9=9B=86=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aio/content/dict/dict-1.json | 67322 ++++++++++++++++++++ aio/content/dict/dict-2.json | 72752 ++++++++++++++++++++++ aio/content/dict/dict-3.json | 89242 +++++++++++++++++++++++++++ aio/content/dict/extractor.spec.ts | 50 + aio/content/dict/extractor.ts | 53 + aio/package.json | 2 + aio/yarn.lock | 41 + 7 files changed, 229462 insertions(+) create mode 100644 aio/content/dict/dict-1.json create mode 100644 aio/content/dict/dict-2.json create mode 100644 aio/content/dict/dict-3.json create mode 100644 aio/content/dict/extractor.spec.ts create mode 100644 aio/content/dict/extractor.ts diff --git a/aio/content/dict/dict-1.json b/aio/content/dict/dict-1.json new file mode 100644 index 0000000000..4fd1da2823 --- /dev/null +++ b/aio/content/dict/dict-1.json @@ -0,0 +1,67322 @@ +[ + { + "original": "# Forms", + "translation": "# 表单", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "Forms are the mainstay of business applications.\nYou use forms to log in, submit a help request, place an order, book a flight,\nschedule a meeting, and perform countless other data-entry tasks.", + "translation": "表单是商业应用的支柱,我们用它来执行登录、求助、下单、预订机票、安排会议,以及不计其数的其它数据录入任务。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "In developing a form, it's important to create a data-entry experience that guides the\nuser efficiently and effectively through the workflow.", + "translation": "在开发表单时,创建数据方面的体验是非常重要的,它能指引用户明细、高效的完成工作流程。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "Developing forms requires design skills (which are out of scope for this page), as well as framework support for\n*two-way data binding, change tracking, validation, and error handling*,\nwhich you'll learn about on this page.", + "translation": "开发表单需要设计能力(那超出了本章的范围),而框架支持*双向数据绑定、变更检测、验证和错误处理*,而本章我们会接触到它们。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "This page shows you how to build a simple form from scratch. Along the way you'll learn how to:", + "translation": "这个页面演示了如何从草稿构建一个简单的表单。这个过程中你将学会如何:", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "* Build an Angular form with a component and template.", + "translation": "用组件和模板构建 Angular 表单", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "* Use `ngModel` to create two-way data bindings for reading and writing input-control values.", + "translation": "用`ngModel`创建双向数据绑定,以读取和写入输入控件的值", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "* Track state changes and the validity of form controls.", + "translation": "跟踪状态的变化,并验证表单控件", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "* Provide visual feedback using special CSS classes that track the state of the controls.", + "translation": "使用特殊的CSS类来跟踪控件的状态并给出视觉反馈", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "* Display validation errors to users and enable/disable form controls.", + "translation": "向用户显示验证错误提示,以及启用/禁用表单控件", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "* Share information across HTML elements using template reference variables.", + "translation": "使用模板引用变量在 HTML 元素之间共享信息", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "You can run the in Plunker and download the code from there.", + "translation": "你可以在Plunker中运行,并且从那里下载代码。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "## Template-driven forms", + "translation": "## 模板驱动的表单", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "You can build forms by writing templates in the Angular [template syntax](guide/template-syntax) with\nthe form-specific directives and techniques described in this page.", + "translation": "通常,使用 Angular [模板语法](guide/template-syntax)编写模板,结合本章所描述的表单专用指令和技术来构建表单。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "You can also use a reactive (or model-driven) approach to build forms.\nHowever, this page focuses on template-driven forms.", + "translation": "你还可以使用响应式(也叫模型驱动)的方式来构建表单。不过本章中只介绍模板驱动表单。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "You can build almost any form with an Angular template—login forms, contact forms, and pretty much any business form.\nYou can lay out the controls creatively, bind them to data, specify validation rules and display validation errors,\nconditionally enable or disable specific controls, trigger built-in visual feedback, and much more.", + "translation": "利用 Angular 模板,可以构建几乎所有表单 — 登录表单、联系人表单…… 以及任何的商务表单。\n 可以创造性的摆放各种控件、把它们绑定到数据、指定校验规则、显示校验错误、有条件的禁用或\n 启用特定的控件、触发内置的视觉反馈等等,不胜枚举。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "Angular makes the process easy by handling many of the repetitive, boilerplate tasks you'd\notherwise wrestle with yourself.", + "translation": "它用起来很简单,这是因为 Angular 处理了大多数重复、单调的任务,这让我们可以不必亲自操刀、身陷其中。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "You'll learn to build a template-driven form that looks like this:", + "translation": "我们将学习构建如下的“模板驱动”表单:", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "The *Hero Employment Agency* uses this form to maintain personal information about heroes.\nEvery hero needs a job. It's the company mission to match the right hero with the right crisis.", + "translation": "这里是*英雄职业介绍所*,使用这个表单来维护候选英雄们的个人信息。每个英雄都需要一份工作。\n公司的使命就是让合适的英雄去应对恰当的危机!", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "Two of the three fields on this form are required. Required fields have a green bar on the left to make them easy to spot.", + "translation": "表单中的三个字段,其中两个是必填的。必填的字段在左侧有个绿色的竖条,方便用户分辨哪些是必填项。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "If you delete the hero name, the form displays a validation error in an attention-grabbing style:", + "translation": "如果删除了英雄的名字,表单就会用醒目的样式把验证错误显示出来。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "如果删除了英雄的名字,表单就会用醒目的样式把验证错误显示出来。", + "translation": "
\n \"无效!名字是必填项\"\n
", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "Note that the *Submit* button is disabled, and the \"required\" bar to the left of the input control changes from green to red.", + "translation": "注意,提交按钮被禁用了,而且输入控件左侧的“必填”条从绿色变为了红色。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "You can customize the colors and location of the \"required\" bar with standard CSS.", + "translation": "稍后,会使用标准 CSS 来定制“必填”条的颜色和位置。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "You'll build this form in small steps:", + "translation": "我们将一点点构建出此表单:", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "1. Create the `Hero` model class.", + "translation": "创建`Hero`模型类", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "1. Create the component that controls the form.", + "translation": "创建控制此表单的组件。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "1. Create a template with the initial form layout.", + "translation": "创建具有初始表单布局的模板。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "1. Bind data properties to each form control using the `ngModel` two-way data-binding syntax.", + "translation": "使用`ngModel`双向数据绑定语法把数据属性绑定到每个表单输入控件。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "1. Add a `name` attribute to each form-input control.", + "translation": "往每个表单输入控件上添加`name`属性 (attribute)。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "1. Add custom CSS to provide visual feedback.", + "translation": "添加自定义 CSS 来提供视觉反馈。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "1. Show and hide validation-error messages.", + "translation": "显示和隐藏有效性验证的错误信息。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "1. Handle form submission with *ngSubmit*.", + "translation": "使用 **ngSubmit** 处理表单提交。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "1. Disable the form’s *Submit* button until the form is valid.", + "translation": "禁用此表单的提交按钮,直到表单变为有效。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "## Setup", + "translation": "## 搭建", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "Follow the [setup](guide/setup) instructions for creating a new project\nnamed angular-forms.", + "translation": "按照[搭建本地开发环境](guide/setup)的说明,创建一个名为angular-forms的新项目。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "## Create the Hero model class", + "translation": "## 创建 Hero 模型类", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "As users enter form data, you'll capture their changes and update an instance of a model.\nYou can't lay out the form until you know what the model looks like.", + "translation": "当用户输入表单数据时,需要捕获它们的变化,并更新到模型的实例中。\n除非知道模型里有什么,否则无法设计表单的布局。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "A model can be as simple as a \"property bag\" that holds facts about a thing of application importance.\nThat describes well the `Hero` class with its three required fields (`id`, `name`, `power`)\nand one optional field (`alterEgo`).", + "translation": "最简单的模型是个“属性包”,用来存放应用中一件事物的事实。\n这里使用三个必备字段 (`id`、`name`、`power`),和一个可选字段 (`alterEgo`,译注:中文含义是第二人格,例如 X 战警中的 Jean / 黑凤凰)。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "In the `app` directory, create the following file with the given content:", + "translation": "在应用文件夹中创建下列文件:", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "It's an anemic model with few requirements and no behavior. Perfect for the demo.", + "translation": "这是一个少量需求和零行为的贫血模型。对演示来说很完美。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "The TypeScript compiler generates a public field for each `public` constructor parameter and\nautomatically assigns the parameter’s value to that field when you create heroes.", + "translation": "TypeScript 编译器为每个`public`构造函数参数生成一个公共字段,在创建新的英雄实例时,自动把参数值赋给这些公共字段。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "The `alterEgo` is optional, so the constructor lets you omit it; note the question mark (?) in `alterEgo?`.", + "translation": "`alterEgo`是可选的,调用构造函数时可省略,注意`alterEgo?`中的问号 (?)。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "You can create a new hero like this:", + "translation": "可以这样创建新英雄:", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "## Create a form component", + "translation": "## 创建表单组件", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "An Angular form has two parts: an HTML-based _template_ and a component _class_\nto handle data and user interactions programmatically.\nBegin with the class because it states, in brief, what the hero editor can do.", + "translation": "Angular 表单分为两部分:基于 HTML 的*模板*和组件*类*,用来程序处理数据和用户交互。\n先从组件类开始,是因为它可以简要说明英雄编辑器能做什么。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "Create the following file with the given content:", + "translation": "创建下列文件:", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "There’s nothing special about this component, nothing form-specific,\nnothing to distinguish it from any component you've written before.", + "translation": "这个组件没有什么特别的地方,没有表单相关的东西,与之前写过的组件没什么不同。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "Understanding this component requires only the Angular concepts covered in previous pages.", + "translation": "只需要前面章节中学过的概念,就可以完全理解这个组件:", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "* The code imports the Angular core library and the `Hero` model you just created.", + "translation": "这段代码导入了Angular核心库以及我们刚刚创建的`Hero`模型。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "* The `@Component` selector value of \"hero-form\" means you can drop this form in a parent template with a `` tag.", + "translation": "`@Component`选择器“hero-form”表示可以用``标签把这个表单放进父模板。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "* The `templateUrl` property points to a separate file for the template HTML.", + "translation": "`moduleId: module.id`属性设置了基地址,用于从相对模块路径加载`templateUrl`。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "* You defined dummy data for `model` and `powers`, as befits a demo.", + "translation": "`templateUrl`属性指向一个独立的 HTML 模板文件。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "Down the road, you can inject a data service to get and save real data\nor perhaps expose these properties as inputs and outputs\n(see [Input and output properties](guide/template-syntax#inputs-outputs) on the\n[Template Syntax](guide/template-syntax) page) for binding to a\nparent component. This is not a concern now and these future changes won't affect the form.", + "translation": "接下来,我们可以注入一个数据服务,以获取或保存真实的数据,或者把这些属性暴露为输入属性和输出属性(参见[Template Syntax](guide/template-syntax)中的[输入和输出属性](guide/template-syntax#inputs-outputs))来绑定到一个父组件。这不是现在需要关心的问题,未来的更改不会影响到这个表单。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "* You added a `diagnostic` property to return a JSON representation of the model.\nIt'll help you see what you're doing during development; you've left yourself a cleanup note to discard it later.", + "translation": "我们添加一个`diagnostic`属性,以返回这个模型的 JSON 形式。在开发过程中,它用于调试,最后清理时会丢弃它。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "### Why the separate template file?", + "translation": "### 为何分离模板文件?", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "Why don't you write the template inline in the component file as you often do elsewhere?", + "translation": "为什么不与我们在其他地方常常做的那样,以内联的方式把模板写在组件文件中呢?", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "There is no \"right\" answer for all occasions. Inline templates are useful when they are short.\nMost form templates aren't short. TypeScript and JavaScript files generally aren't the best place to\nwrite (or read) large stretches of HTML, and few editors help with files that have a mix of HTML and code.", + "translation": "没有什么答案在所有场合都总是“正确”的。当模板足够短的时候,内联形式更招人喜欢。\n但大多数的表单模板都不短。通常,TypeScript 和 JavaScript 文件不是写(读)大型 HTML 的好地方,\n而且没有几个编辑器能对混写的 HTML 和代码提供足够的帮助。\n我们还是喜欢内容清晰、目标明确的短文件,像这个一样。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "Form templates tend to be large, even when displaying a small number of fields,\nso it's usually best to put the HTML template in a separate file.\nYou'll write that template file in a moment. First,\nrevise the `app.module.ts` and `app.component.ts` to make use of the new `HeroFormComponent`.", + "translation": "就算是在仅仅显示少数表单项目时,表单模板一般都比较庞大。所以通常最好的方式是将 HTML 模板放到单独的文件中。\n一会儿将编写这个模板文件。在这之前,先退一步,再看看`app.module.ts`和`app.component.ts`,让它们使用新的`HeroFormComponent`。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "## Revise *app.module.ts*", + "translation": "## 修改 *app.module.ts*", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "`app.module.ts` defines the application's root module. In it you identify the external modules you'll use in the application\nand declare the components that belong to this module, such as the `HeroFormComponent`.", + "translation": "`app.module.ts`定义了应用的根模块。其中标识即将用到的外部模块,以及声明属于本模块中的组件,例如`HeroFormComponent`。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "Because template-driven forms are in their own module, you need to add the `FormsModule` to the array of\n`imports` for the application module before you can use forms.", + "translation": "因为模板驱动的表单位于它们自己的模块,所以在使用表单之前,需要将`FormsModule`添加到应用模块的`imports`数组中。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "Replace the contents of the \"QuickStart\" version with the following:", + "translation": "把“快速上手”版的文件替换为如下内容:", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "There are three changes:", + "translation": "有三处更改:", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "1. You import `FormsModule` and the new `HeroFormComponent`.", + "translation": "导入`FormsModule`和新组件`HeroFormComponent`。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "1. You add the `FormsModule` to the list of `imports` defined in the `@NgModule` decorator. This gives the application\naccess to all of the template-driven forms features, including `ngModel`.", + "translation": "把`FormsModule`添加到`ngModule`装饰器的`imports`列表中,这样应用就能访问模板驱动表单的所有特性,包括`ngModel`。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "1. You add the `HeroFormComponent` to the list of `declarations` defined in the `@NgModule` decorator. This makes\nthe `HeroFormComponent` component visible throughout this module.", + "translation": "把`HeroFormComponent`添加到`ngModule`装饰器的`declarations`列表中,使`HeroFormComponent`组件在整个模块中可见。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "If a component, directive, or pipe belongs to a module in the `imports` array, ​_don't_​ re-declare it in the `declarations` array.\nIf you wrote it and it should belong to this module, ​_do_​ declare it in the `declarations` array.", + "translation": "如果某个组件、指令或管道是属于`imports`中所导入的某个模块的,那就_不能再_把它再声明到本模块的`declarations`数组中。\n如果它是你自己写的,并且确实属于当前模块,*才应该*把它声明在`declarations`数组中。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "## Revise *app.component.ts*", + "translation": "## 修改 *app.component.ts*", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "`AppComponent` is the application's root component. It will host the new `HeroFormComponent`.", + "translation": "`AppComponent`是应用的根组件,`HeroFormComponent`将被放在其中。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "Replace the contents of the \"QuickStart\" version with the following:", + "translation": "把“快速上手”的版本内容替换成下列代码:", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "There are only two changes.\nThe `template` is simply the new element tag identified by the component's `selector` property.\nThis displays the hero form when the application component is loaded.\nYou've also dropped the `name` field from the class body.", + "translation": "这里只做了两处修改。\n`template`中只剩下这个新的元素标签,即组件的`selector`属性。这样当应用组件被加载时,就会显示这个英雄表单。\n另外,我们还从类中移除了`name`字段。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "## Create an initial HTML form template", + "translation": "## 创建初始 HTML 表单模板", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "Create the template file with the following contents:", + "translation": "用下列内容新建模板文件:", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "The language is simply HTML5. You're presenting two of the `Hero` fields, `name` and `alterEgo`, and\nopening them up for user input in input boxes.", + "translation": "这只是一段普通的旧式 HTML 5 代码。这里有两个`Hero`字段,`name`和`alterEgo`,供用户输入。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "The *Name* `` control has the HTML5 `required` attribute;\nthe *Alter Ego* `` control does not because `alterEgo` is optional.", + "translation": "*Name* ``控件具有 HTML5 的`required`属性;但 *Alter Ego* ``控件没有,因为`alterEgo`字段是可选的。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "You added a *Submit* button at the bottom with some classes on it for styling.", + "translation": "在底部添加个 *Submit* 按钮,它还带一些 CSS 样式类。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "*You're not using Angular yet*. There are no bindings or extra directives, just layout.", + "translation": "**我们还没有真正用到Angular**。没有绑定,没有额外的指令,只有布局。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "In template driven forms, if you've imported `FormsModule`, you don't have to do anything\nto the `
` tag in order to make use of `FormsModule`. Continue on to see how this works.", + "translation": "在模板驱动表单中,你只要导入了`FormsModule`就不用对``做任何改动来使用`FormsModule`。接下来你会看到它的原理。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "The `container`, `form-group`, `form-control`, and `btn` classes\ncome from [Twitter Bootstrap](http://getbootstrap.com/css/). These classes are purely cosmetic.\nBootstrap gives the form a little style.", + "translation": "`container`、`form-group`、`form-control`和`btn`类来自 [Twitter Bootstrap](http://getbootstrap.com/css/)。纯粹是装饰。\n我们使用 Bootstrap 来美化表单。嘿,一点样式都没有的表单算个啥!", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "
\n Angular forms don't require a style library\n
", + "translation": "
\n Angular 表单不需要任何样式库\n
", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "Angular makes no use of the `container`, `form-group`, `form-control`, and `btn` classes or\nthe styles of any external library. Angular apps can use any CSS library or none at all.", + "translation": "Angular 不需要`container`、`form-group`、`form-control`和`btn`类,\n或者外部库的任何样式。Angular 应用可以使用任何 CSS 库…… ,或者啥都不用。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "To add the stylesheet, open `index.html` and add the following link to the ``:", + "translation": "我们来添加样式表。打开`index.html`,并把下列链接添加到``中:", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "## Add powers with _*ngFor_", + "translation": "## 用 ***ngFor*** 添加超能力", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "The hero must choose one superpower from a fixed list of agency-approved powers.\nYou maintain that list internally (in `HeroFormComponent`).", + "translation": "我们的英雄必须从认证过的固定列表中选择一项超能力。\n 这个列表位于`HeroFormComponent`中。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "You'll add a `select` to the\nform and bind the options to the `powers` list using `ngFor`,\na technique seen previously in the [Displaying Data](guide/displaying-data) page.", + "translation": "在表单中添加`select`,用`ngFor`把`powers`列表绑定到列表选项。\n我们在之前的[显示数据](guide/displaying-data)一章中见过`ngFor`。", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "Add the following HTML *immediately below* the *Alter Ego* group:", + "translation": "在 *Alter Ego* 的紧下方添加如下 HTML:", + "sourceFile": "/Users/twer/private/GDE/angular-cn/aio/content/_fragments/glossary-t2.md" + }, + { + "original": "This code repeats the `