Skip to content

Commit

Permalink
Merge pull request #72 from yanni4night/master
Browse files Browse the repository at this point in the history
修正格式、排版和用词错误等问题
  • Loading branch information
towerhe committed Dec 12, 2014
2 parents 7fe19ed + 671c511 commit 108c56e
Show file tree
Hide file tree
Showing 34 changed files with 63 additions and 85 deletions.
4 changes: 2 additions & 2 deletions data/guides.yml
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ Cookbook:
- title: "使用模态对话框"
url: "cookbook/user_interface_and_interaction/using_modal_dialogs"
skip_sidebar_item: true
- title: "Resetting scroll on route changes"
- title: "路由改变时重置滚动条"
url: "cookbook/user_interface_and_interaction/resetting_scroll_on_route_changes"
skip_sidebar_item: true
# - title: "Converting Strings to Currency With Accounting.js"
Expand Down Expand Up @@ -373,7 +373,7 @@ Cookbook:
- title: "一次设置多个属性值"
url: "cookbook/working_with_objects/setting_multiple_properties_at_once"
skip_sidebar_item: true
- title: "Continuous Redrawing of Views"
- title: "持续重绘视图"
url: "cookbook/working_with_objects/continuous_redrawing_of_views"
skip_sidebar_item: true
# - title: "Continuous Redrawing of Views"
Expand Down
4 changes: 2 additions & 2 deletions source/bilingual_guides/object-model/observers.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,13 @@ person.set('lastName', 'Smith');

Observers never fire until after the initialization of an object is complete.

观察器只有直到对象完成了初始化过程才会被触发
观察器只有对象完成了初始化过程之后才会被触发

If you need an observer to fire as part of the initialization process, you
cannot rely on the side effect of set. Instead, specify that the observer
should also run after init by using `.on('init')`:

如果需要在初始化过程中就触发一个观察器,那么不能依赖于`set`的负效应。而应该在观察器上,通过使用`.on('init')`指定观察器应该在初始化后执行:
如果需要在初始化过程中就触发一个观察器,那么不能依赖于`set`的负效应。而应该在观察器上通过使用`.on('init')`指定观察器应该在初始化后执行:

```javascript
App.Person = Ember.Object.extend({
Expand Down
22 changes: 9 additions & 13 deletions source/bilingual_guides/routing/defining-your-routes.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ App.Router.map(function() {
Now, when the user visits `/about`, Ember.js will render the `about`
template. Visiting `/favs` will render the `favorites` template.

现在当用户访问'/about'时,Ember.js就会渲染`about`的模板。访问'/favs'将渲染`favorites`的模板。
现在当用户访问`/about`时,Ember.js就会渲染`about`的模板。访问`/favs`将渲染`favorites`的模板。

<aside>
**Heads up!** You get a few routes for free: the `ApplicationRoute` and
the `IndexRoute` (corresponding to the `/` path).
[See below](#toc_initial-routes) for more details.

**注意!**Ember会自动创建一些路由:`ApplicationRoute``IndexRoute`(响应`/`路径)。详细的内容[如下所示](#toc_initial-routes)
**注意!**Ember会自动创建一些路由:`ApplicationRoute``IndexRoute`(响应`/`路径)。详细的内容[如下所示](#toc_initial-routes)
</aside>

Note that you can leave off the path if it is the same as the route
Expand All @@ -47,8 +47,8 @@ Inside your templates, you can use `{{link-to}}` to navigate between
routes, using the name that you provided to the `route` method (or, in
the case of `/`, the name `index`).

在模板里面,你可以用{{link-to}}来导向路由,这需要用到你在route方法中定义的名字
(对于'/'来说,名字就是index)。
在模板里面,你可以用`{{link-to}}`来导向路由,这需要用到你在`route`方法中定义的名字
(对于`/`来说,名字就是`index`)。

```handlebars
{{#link-to 'index'}}<img class="logo">{{/link-to}}
Expand All @@ -62,14 +62,14 @@ the case of `/`, the name `index`).
The `{{link-to}}` helper will also add an `active` class to the link that
points to the currently active route.

{{link-to}}助手会在链接上面加上active的类名(class)来指出当前活跃的路由。
`{{link-to}}`助手会在链接上面加上`active`的类名(class)来指出当前活跃的路由。

You can customize the behavior of a route by creating an `Ember.Route`
subclass. For example, to customize what happens when your user visits
`/`, create an `App.IndexRoute`:

你也可以通过创建一个`Ember.Route`的子类来对路由的行为进行自定义。例如,创建
`App.IndexRoute`类来定义当用户访问'/'时会发生什么。
`App.IndexRoute`类来定义当用户访问`/`时会发生什么。

```javascript
App.IndexRoute = Ember.Route.extend({
Expand Down Expand Up @@ -208,8 +208,7 @@ This router creates three routes:
`posts` is equivalent to transitioning to `posts.index` or linking to
`posts.index`</small>

<small><sup>1</sup> 跳转到`posts`或者链接到`posts`,等效于跳转
`posts.index`或链接到`posts.index`。</small>
<small><sup>1</sup> 跳转到`posts`或者链接到`posts`,等效于跳转到`posts.index`或链接到`posts.index`。</small>

NOTE: If you define a resource using `this.resource` and **do not** supply
a function, then the implicit `resource.index` route is **not** created. In
Expand Down Expand Up @@ -264,8 +263,7 @@ into a model.
For example, if we have the resource `this.resource('posts')`, our
route handler might look like this:

例如,如果我们有一个资源`this.resource('posts')`,那么我们的路由处理器看起来
可能像这样:
例如,如果我们有一个资源`this.resource('posts')`,那么我们的路由处理器看起来可能像这样:

```js
App.PostsRoute = Ember.Route.extend({
Expand All @@ -285,9 +283,7 @@ additional information to know what to use. However, if we want a route
to represent a single post, we would not want to have to hardcode every
possible post into the router.

由于`/posts`映射到一个特定的模型上,所以我们不需要其他额外的信息就可以
运行。然而,如果我们想要路由映射到某个post上,我们可不想通过在路由器中
写死每一个可能的post来实现。
由于`/posts`映射到一个特定的模型上,所以我们不需要其他额外的信息就可以运行。然而,如果我们想要路由映射到某个post上,我们可不想通过在路由器中写死每一个可能的post来实现。

Enter _dynamic segments_.

Expand Down
3 changes: 1 addition & 2 deletions source/bilingual_guides/routing/generated-objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ Ember.js attempts to find corresponding Route, Controller, View, and Template
classes named according to naming conventions. If an implementation of any of
these objects is not found, appropriate objects will be generated in memory for you.

正如在[定义路由][1]中所说的,无论何时,只要你定义了一个新的路由,`Ember.js`都会试着根据命名惯例
寻找相对应的路由,控制器,视图还有模板类。一旦有任何一个对象找不到,那么在内存中,相对应的对象将会被生成。
正如在[定义路由][1]中所说的,无论何时,只要你定义了一个新的路由,`Ember.js`都会试着根据命名惯例寻找相对应的路由,控制器,视图还有模板类。一旦有任何一个对象找不到,那么在内存中,相对应的对象将会被生成。

[1]: /guides/routing/defining-your-routes

Expand Down
4 changes: 2 additions & 2 deletions source/bilingual_guides/routing/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ or more of the following:
3. Change the template on screen, or place a new template into an
existing outlet.

更改屏幕(浏览器窗口)上的模板,或者在已存在的出口(outlet)上替换新的模板
更改屏幕浏览器窗口)上的模板,或者在已存在的出口(outlet)上替换新的模板

###(记录追踪路由的变化)Logging Route Changes

As your application increases in complexity, it can be helpful to see exactly what is going on with the router. To have Ember write out transition events to the log, simply modify your `Ember.Application`:

当你的应用变得越来越复杂,明白路由究竟发生了什么是很有帮助的。只要简单的修改一下你的Ember.Application,就可以让ember记录路由的事件转换
当你的应用变得越来越复杂,明白路由究竟发生了什么是很有帮助的。只要简单的修改一下你的 `Ember.Application`,就可以让ember记录路由的事件转换

```javascript
App = Ember.Application.create({
Expand Down
2 changes: 1 addition & 1 deletion source/bilingual_guides/routing/redirection.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ the redirection, you should either use the `afterModel` or the `redirect` hook.
receive the resolved model as the first parameter and the transition as the second one,
and thus function as aliases. (In fact, the default implementation of `afterModel` just calls `redirect`.)

如果需要从当前模型中获取重定向的信息来决定跳转到哪里,可以使用`afterModel``redirect`这两个钩子来实现。`afterModel``redirect`的第一个参数都是路由的模型,过渡对象作为第二个参数,两个钩子本质是一样的。(`afterModel`钩子的缺省实现只是对`redirect`钩子的调用。
如果需要从当前模型中获取重定向的信息来决定跳转到哪里,可以使用`afterModel``redirect`这两个钩子来实现。`afterModel``redirect`的第一个参数都是路由的模型,过渡对象作为第二个参数,两个钩子本质是一样的。(实际上`afterModel`钩子的缺省实现只是对`redirect`钩子的调用

```javascript

Expand Down
6 changes: 3 additions & 3 deletions source/bilingual_guides/routing/specifying-a-routes-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ objects that represent eventual values. For example, if you use jQuery's
eventually returned over the network. Ember uses this promise object to
know when it has enough data to continue rendering.

如果对承诺不属性,可以姑且将其认为承诺就是代表了最终加载的数据的对象。例如,使用jQuery的`getJSON`方法,该方法就返回一个代表最终从网络加载的JSON的承诺。Ember使用这个承诺对象知道何时拥有了足够用来渲染的数据。
如果对承诺不熟悉,可以姑且将其认为承诺就是代表了最终加载的数据的对象。例如,使用jQuery的`getJSON`方法,该方法就返回一个代表最终从网络加载的JSON的承诺。Ember使用这个承诺对象知道何时拥有了足够用来渲染的数据。

For more about promises, see [A Word on
Promises](/guides/routing/asynchronous-routing/#toc_a-word-on-promises)
Expand All @@ -80,7 +80,7 @@ in the Asynchronous Routing guide.
Let's look at an example in action. Here's a route that loads the most
recent pull requests sent to Ember.js on GitHub:

下面看一个实际的例子。这里有一个从GitHub商获取最近的Ember.js的PR的路由:
下面看一个实际的例子。这里有一个从GitHub上获取最近的Ember.js的PR的路由:

```js
App.PullRequestsRoute = Ember.Route.extend({
Expand Down Expand Up @@ -115,7 +115,7 @@ the template only displayed the three most recent pull requests. We can
rely on promise chaining to modify the data returned from the JSON
request before it gets passed to the template:

例如,假设需要修改上例,让模板只显示最近三个PR。通过采用承诺链,可以在将数据传递给模板之前修改请求返回的JSON
例如,假设需要修改上例,让模板只显示最近三个PR。通过采用承诺链,可以在将数据传递给模板之前修改请求返回的JSON

```js
App.PullRequestsRoute = Ember.Route.extend({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,9 @@ ENV.EXTEND_PROTOTYPES = false;
```javascript
var islands = ['Oahu', 'Kauai'];
islands.contains('Oahu');
//=> TypeError: Object Oahu,Kauai has no method 'contains'
//=> 类型错误: Oahu,Kauai 对象没有 'contains' 方法

// Convert `islands` to an array that implements the
// Ember enumerable and array interfaces
//将`islands`转换为实现了Ember枚举以及数组接口的数组
// 将`islands`转换为实现了Ember枚举以及数组接口的数组
Ember.A(islands);

islands.contains('Oahu');
Expand All @@ -64,7 +61,6 @@ islands.contains('Oahu');

```javascript
"my_cool_class".camelize();
//=> TypeError: Object my_cool_class has no method 'camelize'
//=> 类型错误: my_cool_class 对象没有`camelize`方法

Ember.String.camelize("my_cool_class");
Expand All @@ -79,14 +75,12 @@ Ember.String.camelize("my_cool_class");
`Ember.computed()`方法来包裹函数以标记计算属性。

```javascript
// This won't work:
//这样的代码不会起作用:
fullName: function() {
return this.get('firstName') + ' ' + this.get('lastName');
}.property('firstName', 'lastName')


// Instead, do this:
//你需要这样做:
fullName: Ember.computed('firstName', 'lastName', function() {
return this.get('firstName') + ' ' + this.get('lastName');
Expand All @@ -96,14 +90,12 @@ fullName: Ember.computed('firstName', 'lastName', function() {
`Ember.observer()`来标记观察者:

```javascript
// This won't work:
//这样的代码不会起作用:
fullNameDidChange: function() {
console.log("Full name changed");
}.observes('fullName')


// Instead, do this:
//你需要这样做:
fullNameDidChange: Ember.observer('fullName', function() {
console.log("Full name changed");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
英文原文:[http://emberjs.com/guides/cookbook/event_handling_and_data_binding/binding_properties_of_an_object_to_its_own_properties](http://emberjs.com/guides/cookbook/event_handling_and_data_binding/binding_properties_of_an_object_to_its_own_properties)
英文原文:[http://emberjs.com/guides/cookbook/event\_handling\_and\_data\_binding/binding\_properties\_of\_an\_object\_to\_its\_own\_properties](http://emberjs.com/guides/cookbook/event_handling_and_data_binding/binding_properties_of_an_object_to_its_own_properties)

### 问题

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
英文原文:[http://emberjs.com/guides/cookbook/event_handling_and_data_binding/](http://emberjs.com/guides/cookbook/event_handling_and_data_binding/)
英文原文:[http://emberjs.com/guides/cookbook/event\_handling\_and\_data\_binding/](http://emberjs.com/guides/cookbook/event_handling_and_data_binding/)

下面是一些管理事件和处理绑定的技巧:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
英文原文:[http://emberjs.com/guides/cookbook/helpers_and_components/adding_google_analytics_tracking](http://emberjs.com/guides/cookbook/helpers_and_components/adding_google_analytics_tracking)
英文原文:[http://emberjs.com/guides/cookbook/helpers\_and\_components/adding\_google\_analytics\_tracking](http://emberjs.com/guides/cookbook/helpers_and_components/adding_google_analytics_tracking)

### 问题

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
英文原文:[http://emberjs.com/guides/cookbook/helpers_and_components/creating_reusable_social_share_buttons](http://emberjs.com/guides/cookbook/helpers_and_components/creating_reusable_social_share_buttons)
英文原文:[http://emberjs.com/guides/cookbook/helpers\_and\_components/creating\_reusable\_social\_share\_buttons](http://emberjs.com/guides/cookbook/helpers_and_components/creating_reusable_social_share_buttons)

### 问题

Expand Down
2 changes: 1 addition & 1 deletion source/guides/cookbook/helpers_and_components/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
英文原文:[http://emberjs.com/guides/cookbook/helpers_and_components/](http://emberjs.com/guides/cookbook/helpers_and_components/)
英文原文:[http://emberjs.com/guides/cookbook/helpers\_and\_components/](http://emberjs.com/guides/cookbook/helpers_and_components/)

下面是一些可以用于封装代码到组件和构建助手的技巧:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
英文原文:[http://emberjs.com/guides/cookbook/user_interface_and_interaction/adding_css_classes_to_your_components](http://emberjs.com/guides/cookbook/user_interface_and_interaction/adding_css_classes_to_your_components)
英文原文:[http://emberjs.com/guides/cookbook/user\_interface\_and\_interaction/adding\_css\_classes\_to\_your\_components](http://emberjs.com/guides/cookbook/user_interface_and_interaction/adding_css_classes_to_your_components)

### 问题

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
英文原文:[http://emberjs.com/guides/cookbook/user_interface_and_interaction/adding_css_classes_to_your_components_based_on_properties](http://emberjs.com/guides/cookbook/user_interface_and_interaction/adding_css_classes_to_your_components_based_on_properties)
英文原文:[http://emberjs.com/guides/cookbook/user\_interface\_and\_interaction/adding\_css\_classes\_to\_your\_components\_based\_on\_properties](http://emberjs.com/guides/cookbook/user_interface_and_interaction/adding_css_classes_to_your_components_based_on_properties)

### 问题

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
英文原文:[http://emberjs.com/guides/cookbook/user_interface_and_interaction/displaying_formatted_dates_with_moment_js](http://emberjs.com/guides/cookbook/user_interface_and_interaction/displaying_formatted_dates_with_moment_js)
英文原文:[http://emberjs.com/guides/cookbook/user\_interface\_and\_interaction/displaying\_formatted\_dates\_with\_moment\_js](http://emberjs.com/guides/cookbook/user_interface_and_interaction/displaying_formatted_dates_with_moment_js)

### 问题

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
英文原文:[http://emberjs.com/guides/cookbook/user_interface_and_interaction/focusing_a_textfield_after_its_been_inserted](http://emberjs.com/guides/cookbook/user_interface_and_interaction/focusing_a_textfield_after_its_been_inserted)
英文原文:[http://emberjs.com/guides/cookbook/user\_interface\_and\_interaction/focusing\_a\_textfield\_after\_its\_been\_inserted](http://emberjs.com/guides/cookbook/user_interface_and_interaction/focusing_a_textfield_after_its_been_inserted)

### 问题

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
英文原文:[http://emberjs.com/guides/cookbook/user_interface_and_interaction/](http://emberjs.com/guides/cookbook/user_interface_and_interaction/)
英文原文:[http://emberjs.com/guides/cookbook/user\_interface\_and\_interaction/](http://emberjs.com/guides/cookbook/user_interface_and_interaction/)

下面是一些可以帮助提供更好用户体验的技巧:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
英文原文:[http://emberjs.com/guides/cookbook/user_interface_and_interaction/resetting_scroll_on_route_changes](http://emberjs.com/guides/cookbook/user_interface_and_interaction/resetting_scroll_on_route_changes)
英文原文:[http://emberjs.com/guides/cookbook/user\_interface\_and\_interaction/resetting\_scroll\_on\_route\_changes](http://emberjs.com/guides/cookbook/user_interface_and_interaction/resetting_scroll_on_route_changes)

### 问题

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
英文原文:[http://emberjs.com/guides/cookbook/user_interface_and_interaction/specifying_data_driven_areas_of_templates_that_do_not_need_to_update](http://emberjs.com/guides/cookbook/user_interface_and_interaction/specifying_data_driven_areas_of_templates_that_do_not_need_to_update)
英文原文:[http://emberjs.com/guides/cookbook/user\_interface\_and\_interaction/specifying\_data\_driven\_areas\_of\_templates\_that\_do\_not\_need\_to\_update](http://emberjs.com/guides/cookbook/user_interface_and_interaction/specifying_data_driven_areas_of_templates_that_do_not_need_to_update)

### 问题

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
英文原文:[http://emberjs.com/guides/cookbook/user_interface_and_interaction/using_modal_dialogs](http://emberjs.com/guides/cookbook/user_interface_and_interaction/using_modal_dialogs)
英文原文:[http://emberjs.com/guides/cookbook/user\_interface\_and\_interaction/using\_modal\_dialogs](http://emberjs.com/guides/cookbook/user_interface_and_interaction/using_modal_dialogs)

### 问题

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
英文原文:[http://emberjs.com/guides/cookbook/working_with_objects/continuous_redrawing_of_views](http://emberjs.com/guides/cookbook/working_with_objects/continuous_redrawing_of_views)
英文原文:[http://emberjs.com/guides/cookbook/working\_with\_objects/continuous\_redrawing\_of\_views](http://emberjs.com/guides/cookbook/working_with_objects/continuous_redrawing_of_views)

## 问题

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
英文原文:[http://emberjs.com/guides/cookbook/working_with_objects/incrementing_or_decrementing_a_property](http://emberjs.com/guides/cookbook/working_with_objects/incrementing_or_decrementing_a_property)
英文原文:[http://emberjs.com/guides/cookbook/working\_with\_objects/incrementing\_or\_decrementing\_a\_property](http://emberjs.com/guides/cookbook/working_with_objects/incrementing_or_decrementing_a_property)

### 问题

Expand Down
2 changes: 1 addition & 1 deletion source/guides/cookbook/working_with_objects/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
英文原文:[http://emberjs.com/guides/cookbook/working_with_objects/](http://emberjs.com/guides/cookbook/working_with_objects/)
英文原文:[http://emberjs.com/guides/cookbook/working\_with\_objects/](http://emberjs.com/guides/cookbook/working_with_objects/)

下面是一些可以帮助理解如何使用Ember对象的技巧:

Expand Down
Loading

0 comments on commit 108c56e

Please sign in to comment.