Skip to content

[docs] Chinese translation #1274

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
May 15, 2018
Merged

[docs] Chinese translation #1274

merged 25 commits into from
May 15, 2018

Conversation

Jinjiang
Copy link
Member

@Jinjiang Jinjiang commented Apr 29, 2018

WIP (3 pages left).
Will be finished this week.
Finished. /ping @Justineo
Thanks.

@@ -0,0 +1,51 @@
# 处理资产路径
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我觉得还是用 “资源” 比较好,static assets -> 静态资源

@@ -0,0 +1,45 @@
# 校验
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我觉得加上英文 Linting 比较好,不然一眼都不知道是讲什么的...

@@ -0,0 +1,75 @@
# 有作用域的 CSS
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个就直接 Scoped CSS 吧...

}
```

## 服务端渲染的外置
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

外置 -> 依赖排除

Copy link
Member

@ulivz ulivz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only some small things.


:::tip 版本注明
这份文档是为 Vue Loader v15 及以上版本撰写的。如果你正在从 v14 或更早的版本往这里迁移,请查阅[迁移指南](../migrating.md)。如果你正在使用老版本,其对应的就文档[在此](https://vue-loader-v14.vuejs.org)。
:::
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

其对应的文档在此

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个应该是「旧」误写成了「就」吧

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我也发现了,因为上一句已经说过了“老”,所以这里可以不用再重复一次。

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

认同,我去掉了

@@ -0,0 +1,51 @@
# 处理资产路径

当 Vue Loader 编译单文件组件中的 `<template>` 块时,它也会将所有遇到的资产 URL URL 转换为 **webpack 模块请求**。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的URL重复了

@@ -0,0 +1,51 @@
# 处理资源路径

当 Vue Loader 编译单文件组件中的 `<template>` 块时,它也会将所有遇到的资源 URL URL 转换为 **webpack 模块请求**。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

重复的 URL


当 Vue Loader 编译单文件组件中的 `<template>` 块时,它也会将所有遇到的资源 URL URL 转换为 **webpack 模块请求**。

例如,下面的模板代码片段
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

例如,下面的模板代码片段:(少了一个冒号)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我确认了一下,英文版本身没有冒号。我两边都加一下好了

## 相关的 Loader

因为像 `.png` 这样的文件不是一个 JavaScript 模块,你需要配置 webpack 使用 [file-loader](https://github.com/webpack/file-loader) 或者 [url-loader](https://github.com/webpack/url-loader) 去合理的处理它们。通过 Vue CLI 创建的项目已经把这些预配置好了。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

合理地处理它们(的 => 地)

}
```

额外的如果想 `import 'style.scss'`,我们也可以在 Vue 组件中使用 SCSS:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

现在,除了能够 import 'style.scss' 之外,我们还可以在 VUE 组件中使用 SCSS:


拿 `<style lang="less">` 举例:在 v14 或更低版本中,它会尝试使用 `less-loader` 加载这个块,并在其后面隐式地链上 `css-loader` 和 `vue-style-loader`,这一切都使用内联的 loader 字符串。

这 v15 中,`<style lang="less">` 会完成把它当作一个真实的 `*.less` 文件来加载。因此,为了这样处理它,你需要在你的主 webpack 配置中显式地提供一条规则:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这 v15 中 => 在 v15 中,


下列选项已经被改名了:

- `transformToRequire` (现象改名为 `transformAssetUrls`)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

现象改名为 => 现在改名为

- 默认值:当 webpack 配置中包含 `target: 'node'` 且 `vue-template-compiler` 版本号大于等于 2.4.0 时为 `true`。

开启 Vue 2.4 服务端渲染的编译优化之后,渲染函数将会把返回的 vdom 树的一部分编译为字符串,以提升服务端渲染的性能。在一些情况下,你可能想要明确的将其关掉,因为该渲染函数只能用于服务端渲染,而不能用于客户端渲染或测试环境。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

明确的 => 明确地

docs/zh/spec.md Outdated
- [Emacs](https://github.com/AdamNiederer/vue-mode)
- [Brackets](https://github.com/pandao/brackets-vue)
- [JetBrains IDEs](https://plugins.jetbrains.com/plugin/8057) (WebStorm, PhpStorm, etc)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WebStorm, PhpStorm, etc => WebStorm, PhpStorm 等

@Jinjiang
Copy link
Member Author

Jinjiang commented May 9, 2018

Guys, is it approvable now? 🙂

'/': {
lang: 'en-US',
title: 'Vue Loader',
description: 'Webpack loader for single-file Vue components'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Webpack → webpack 要统一处理一下么?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

和 Chris 讨论过这个问题了 vuejs/v2.vuejs.org#1568
中文翻译的部分我们可以保留 webpack,其余的以英文版为准吧
或者中文翻译也用回 Webpack 我的角度都可以接受

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

其实不光 webpack,还有 npm 也是小写的。在中文里其实没啥歧义,那我们就在中文版里面保留最精确的拼法吧。

@@ -0,0 +1,41 @@
# 介绍

:::tip 版本注明
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

版本说明?


## Vue Loader 是什么?

Vue Loader 是一个 [webpack](https://webpack.js.org/) 的 loader,它允许你以一种名为[单文件组件 (SFCs)](./spec.md)的格式撰写 Vue 组件:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

「撰写」一般指的是文档吧?这里建议用「编写」

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

“撰写”相对书面一些,我已经在很多地方使用了撰写这个词 (loader 的文档中搜到了 7 次,其它文档可能更多)。如果不是特别必要的话,我就保留“撰写”了😅

- 允许在一个 `.vue` 文件中使用自定义块,并对其运用自定义的 loader 链;
- 使用 webpack loader 将 `<style>` 和 `<template>` 中引用的资源当作模块依赖来处理;
- 为每个组件模拟出 scoped CSS;
- 在开发过程中可以保持状态的热重载。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在开发过程中使用热重载来保持状态。

- 为每个组件模拟出 scoped CSS;
- 在开发过程中可以保持状态的热重载。

简而言之,webpack 和 Vue Loader 的结合为你提供了一个撰写 Vue.js 应用的、现代的、灵活的和极致强大的前端工作流。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

编写/开发

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

提供了一个现代、灵活且极其强大的前端工作流,来帮助编写 Vue.js 应用。


### PostCSS

Vue Loader v15 不再默认应用 PostCSS 变换。想要使用 PostCSS,请像为普通 CSS 文件一样的方式配置 `postcss-loader`。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

请像配置普通 CSS 文件那样配置 postcss-loader

- 类型:`Object`
- 默认值:`{}`

为渲染函数的生成码配置从 ES2015+ 到 ES5 的转译选项。这里的[转译器](https://github.com/vuejs/vue-template-es2015-compiler)是一份 [Buble](https://github.com/Rich-Harris/buble) 的 fork,因此你可以在[这里](https://buble.surge.sh/guide/#using-the-javascript-api)咨询可用的选项。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

生成码 → 生成代码?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

咨询 → 查阅

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generated code -> 生成码
source code -> 源代码
同撰写,也已经用在很多地方了,如果不是特别必要的话我倾向于保留


为渲染函数的生成码配置从 ES2015+ 到 ES5 的转译选项。这里的[转译器](https://github.com/vuejs/vue-template-es2015-compiler)是一份 [Buble](https://github.com/Rich-Harris/buble) 的 fork,因此你可以在[这里](https://buble.surge.sh/guide/#using-the-javascript-api)咨询可用的选项。

模板渲染函数编译支持一个特殊的变换 `stripWith` (默认启用),它删除生成的渲染函数中的 `with` 用法,使它们兼容严格模式。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

删除?

docs/zh/spec.md Outdated

### Src 导入

如果你喜欢分隔你的 `.vue` 文件到多个文件中,你可以通过 `src` 属性导入外部文件:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

喜欢把 .vue 文件分隔到多个文件中

docs/zh/spec.md Outdated

## 注释

在语言块中使用该语言块对应的注释语法 (HTML、CSS、JavaScript、Jade 等)。顶层注释使用 HTML 注释语法:`<!-- comment contents here -->`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

最后应该有个

@Justineo
Copy link
Member

@yyx990803 Approve 一下吧,不然 merge 不了。

@Justineo
Copy link
Member

原来是因为我没 write access 才不能合 - -,你们合吧 @Jinjiang

@yyx990803
Copy link
Member

@Justineo 现在应该有了

@Justineo Justineo merged commit 698a79d into vuejs:master May 15, 2018
@Jinjiang Jinjiang deleted the zh-cn branch May 15, 2018 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants