Skip to content

Commit a303bc9

Browse files
authored
Translated cookbook index (#685)
* synced some changes about cookbook (without translation) * translated cookbook index * cookbook -> 宝典, recipe -> 秘笈 * Update index.md
1 parent aad8088 commit a303bc9

File tree

3 files changed

+27
-26
lines changed

3 files changed

+27
-26
lines changed

src/v2/cookbook/adding-instance-properties.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,19 @@ new Vue({
2222
})
2323
```
2424

25-
Then `"My App"` will be logged to the console. It's that simple!
25+
Then `"My App"` will be logged to the console!
2626

2727
## The Importance of Scoping Instance Properties
2828

2929
You may be wondering:
3030

3131
> "Why does `appName` start with `$`? Is that important? What does it do?
3232
33-
No magic is happening here. `$` is simply a convention Vue uses for properties that are available to all instances. This avoids conflicts with any defined data, computed properties, or methods.
33+
No magic is happening here. `$` is a convention Vue uses for properties that are available to all instances. This avoids conflicts with any defined data, computed properties, or methods.
3434

3535
> "Conflicts? What do you mean?"
3636
37-
Another great question! If you just set:
37+
Another great question! If you set:
3838

3939
``` js
4040
Vue.prototype.appName = 'My App'
@@ -46,7 +46,7 @@ Then what would you expect to be logged below?
4646
new Vue({
4747
data: {
4848
// Uh oh - appName is *also* the name of the
49-
// instance property we just defined!
49+
// instance property we defined!
5050
appName: 'The name of some other app'
5151
},
5252
beforeCreate: function () {
@@ -143,7 +143,7 @@ As long as you're vigilant in scoping prototype properties, using this pattern i
143143

144144
However, it can sometimes cause confusion with other developers. They might see `this.$http`, for example, and think, "Oh, I didn't know about this Vue feature!" Then they move to a different project and are confused when `this.$http` is undefined. Or, maybe they want to Google how to do something, but can't find results because they don't realize they're actually using Axios under an alias.
145145

146-
__The convenience comes at the cost of explicitness.__ When just looking at a component, it's impossible to tell where `$http` came from. Vue itself? A plugin? A coworker?
146+
__The convenience comes at the cost of explicitness.__ When looking at a component, it's impossible to tell where `$http` came from. Vue itself? A plugin? A coworker?
147147

148148
So what are the alternatives?
149149

@@ -171,7 +171,7 @@ var App = Object.freeze({
171171

172172
<p class="tip">If you raised an eyebrow at `Object.freeze`, what it does is prevent the object from being changed in the future. This essentially makes all its properties constants, protecting you from future state bugs.</p>
173173

174-
Now the source of these shared properties is much more obvious: there's an `App` object defined somewhere in the app. To find it, developers need only run a project-wide search.
174+
Now the source of these shared properties is more obvious: there's an `App` object defined somewhere in the app. To find it, developers can run a project-wide search.
175175

176176
Another advantage is that `App` can now be used _anywhere_ in your code, whether it's Vue-related or not. That includes attaching values directly to instance options, rather than having to enter a function to access properties on `this`:
177177

@@ -188,6 +188,6 @@ new Vue({
188188

189189
### When Using a Module System
190190

191-
When you have access to a module system, you can easily organize shared code into modules, then `require`/`import` those modules wherever they're needed. This is the epitome of explicitness, because in each file you gain a list of dependencies. You know _exactly_ each one came from.
191+
When you have access to a module system, you can easily organize shared code into modules, then `require`/`import` those modules wherever they're needed. This is the epitome of explicitness, because in each file you gain a list of dependencies. You know _exactly_ where each one came from.
192192

193193
While certainly more verbose, this approach is definitely the most maintainable, especially when working with other developers and/or building a large app.

src/v2/cookbook/index.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
11
---
2-
title: Introduction
2+
title: 介绍
33
type: cookbook
44
order: 0
55
---
66

7-
## WORK IN PROGRESS
7+
## 这本 Cookbook 的仍在撰写中
88

9-
<p class="tip">This cookbook is still in its very early stages. At this point, we will not be linking to it from anywhere else. Pages may be removed or reorganized at any time. Even the goals and overall format are still in flux.</p>
9+
<p class="tip">这本 cookbook 仍然处于比较初期的阶段。所以我们暂时不会在别的地方放它的链接。页面随时有可能移除或重组。甚至目标和格式之类的东西也是在不断变化的。</p>
1010

11-
## The Cookbook vs the Guide
11+
## Cookbook vs 指南
1212

13-
How is the cookbook different from the guide? Why is this necessary?
13+
这份 cookbook 和指南的不同之处在哪里?存在的意义是什么?
1414

15-
* **Greater Focus**: In the guide, we're essentially telling a story. Each section builds on and assumes knowledge from each previous section. In the cookbook, each recipe can and should stand on its own. This means recipes can focus on one specific aspect of Vue, rather than having to give a general overview.
15+
* **更专注**:在指南里,我们实际上是在讲一个故事。每个章节都以之前章节的知识进行构建和假设。而在 cookbook 里,每个 recipe 都有各自的代表性。也就是说每个 recipe 都专注于 Vue 的某个特定方面,而不是一个概览。
1616

17-
* **Greater Depth**: To avoid making the guide too long, we try to include only the simplest possible examples to help you understand each feature. Then we move on. In the cookbook, we can include more complex examples, combining features in interesting ways. Each recipe can also be as long and detailed as it needs to be, in order to fully explore its niche.
17+
* **更有深度**:为了避免指南写得太长,我们试着只包含了尽可能简单的示例来帮助你理解每个功能,然后就奔下一个话题了。在 cookbook 里,我们以更生动的形式包含了更复杂的示例并结合特性。每个 recipe 都可以尽可能的翔实,以彻底探索这个领域。
1818

19-
* **Teaching JavaScript**: In the guide, we assume at least intermediate familiarity with ES5 JavaScript. For example, we won't explain how `Array.prototype.filter` works in a computed property that filters a list. In the cookbook however, essential JavaScript features (including ES6/2015+) can be explored and explained in the context of how they help us build better Vue applications.
19+
* **传授 JavaScript**:在指南里,我们假设你至少具有 ES5 JavaScript 的中级水平。例如,我们不会解释 `Array.prototype.filter` 在计算属性中是如何过滤一个列表的。然而在 cookbook 里,我们将对一些必要的 JavaScript 特性 (包括 ES6/2015+) 进行探索和解释,以帮助我们构建更好的 Vue 应用。
2020

21-
* **Exploring the Ecosystem**: For advanced features, we assume some ecosystem knowledge. For example, if you want to use single-file components in Webpack, we don't explain how to configure the non-Vue parts of the Webpack config. In the cookbook, we have the space to explore these ecosystem libraries in more depth - at least to the extent that is universally useful for Vue developers.
21+
* **探索生态系统**:对于高级特性,我们会假设你已经对生态系统有一定了解。例如,如果你想在 webpack 中使用单文件组件,我们不会解释如何在 webpack 中配置 Vue 以外的部分。在 cookbook 里,我们有空间去更深度探索这些生态系统中的库——至少能到对 Vue 开发者普遍使用的程度。
2222

23-
## Guidelines for Recipes
23+
## Recipe 编写指南
2424

25-
Recipes should generally:
25+
通常情况下 recipe 应该:
2626

27-
> 1. Solve a specific, common problem
27+
> 1. 解决一个具体的普遍性问题
2828
29-
> 2. Start with the simplest possible example
29+
> 2. 从尽可能简单的示例开始
3030
31-
> 3. Introduce complexities one at a time
31+
> 3. 一次只介绍一个复杂的点
3232
33-
> 4. Link to other docs, rather than re-explaining concepts
33+
> 4. 链接到其它文档,而不是在这里重新解释概念
3434
35-
> 5. Describe the problem, rather than assuming familiarity
35+
> 5. 把问题描述清楚,而不是假设大家对这个问题很熟悉
3636
37-
> 6. Explain the process, rather than just the end result
37+
> 6. 解释过程,而不是只告诉你最终结果
3838
39-
> 7. Explain the pros and cons of your strategy, including when it is and isn't appropriate
39+
> 7. 解释策略的利弊,包括它不适用于什么场景
4040
41-
> 8. Mention alternative solutions, if relevant, but leave in-depth explorations to a separate recipe
41+
> 8. 会提及相关的替代方案,但会放到一个单独的 recipe 中细讲

src/v2/cookbook/serverless-blog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,3 +286,4 @@ An alternative pattern to consider, especially if you prefer writing only in Mar
286286
## Wrap up
287287

288288
That's it! You now have a fully functional CMS-powered blog running in your app. We hope this tutorial was helpful and made your development experience with Vue.js even more enjoyable :)
289+

0 commit comments

Comments
 (0)