-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Translated B9~B12 of style guide #549
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
Conversation
src/v2/style-guide/index.md
Outdated
@@ -909,12 +909,13 @@ Unfortunately, due to HTML's case insensitivity, DOM templates must still use ke | |||
</summary> | |||
{% endraw %} | |||
|
|||
In JavaScript, PascalCase is the convention for classes and prototype constructors - essentially, anything that can have distinct instances. Vue components also have instances, so it makes sense to also use PascalCase. As an added benefit, using PascalCase within JSX (and templates) allows readers of the code to more easily distinguish between components and HTML elements. | |||
在 JavaScript 中,PascalCase 是类和原型构造函数——本质上任何可以产生多份不同实例的东西的命名规范。Vue 组件也有多份实例,所以同样使用 PascalCase 是有意义的。额外的好处是,在 JSX (和模板) 里使用 PascalCase 使得代码的读者更容易分辨 Vue 组件和 HTML 元素。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
“类和构造函数”是不是就够了?好像中文里不太说“原型构造函数”。
我可能会这么翻:
“在 JavaScript 中,PascalCase 是类和构造函数 (本质上是任何可以派生多个不同实例的东西) 的命名约定。”
src/v2/style-guide/index.md
Outdated
|
||
- It's rare that global components are ever referenced in JavaScript, so following a convention for JavaScript makes less sense. | ||
- 全局组件很少被 JavaScript 引用,所以遵守 JavaScript 的命名规范意义不大。 | ||
- These applications always include many in-DOM components, where kebab-case [**must** be used](#Component-name-casing-in-templates). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
删
src/v2/style-guide/index.md
Outdated
|
||
- It's rare that global components are ever referenced in JavaScript, so following a convention for JavaScript makes less sense. | ||
- 全局组件很少被 JavaScript 引用,所以遵守 JavaScript 的命名规范意义不大。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
convention 我建议还是翻成“约定”,其实就是惯例、约定俗成的东西,而不是一个成文的定义。ES 规范里不规定 PascalCase,就不能叫“命名规范”吧。
src/v2/style-guide/index.md
Outdated
|
||
The autocompletion in editors make the cost of writing longer names very low, while the clarity they provide is invaluable. Uncommon abbreviations, in particular, should always be avoided. | ||
编辑器中的自动补全已经让书写长命名的代价非常之低了,因此其带来的明确性是非常宝贵的。不常用的缩写尤其应该避免。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
因此 → 而……却
src/v2/style-guide/index.md
Outdated
|
||
We're simply following the conventions of each language. Within JavaScript, camelCase is more natural. Within HTML, kebab-case is. | ||
我们单纯的遵循每个语言的规约。在 JavaScript 中更自然的是 camelCase。而在 HTML 中则是 kebab-case。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
convention 同上
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK,之前还有几个地方是翻译成了“规约”,我一并改过来好了
No description provided.