Skip to content

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

Merged
merged 3 commits into from
Oct 10, 2017
Merged

Translated B9~B12 of style guide #549

merged 3 commits into from
Oct 10, 2017

Conversation

Jinjiang
Copy link
Member

No description provided.

@Jinjiang Jinjiang requested a review from Justineo October 10, 2017 05:24
@@ -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 元素。
Copy link
Member

Choose a reason for hiding this comment

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

“类和构造函数”是不是就够了?好像中文里不太说“原型构造函数”。

我可能会这么翻:

“在 JavaScript 中,PascalCase 是类和构造函数 (本质上是任何可以派生多个不同实例的东西) 的命名约定。”


- 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).
Copy link
Member

Choose a reason for hiding this comment

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


- It's rare that global components are ever referenced in JavaScript, so following a convention for JavaScript makes less sense.
- 全局组件很少被 JavaScript 引用,所以遵守 JavaScript 的命名规范意义不大。
Copy link
Member

Choose a reason for hiding this comment

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

convention 我建议还是翻成“约定”,其实就是惯例、约定俗成的东西,而不是一个成文的定义。ES 规范里不规定 PascalCase,就不能叫“命名规范”吧。


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.
编辑器中的自动补全已经让书写长命名的代价非常之低了,因此其带来的明确性是非常宝贵的。不常用的缩写尤其应该避免。
Copy link
Member

Choose a reason for hiding this comment

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

因此 → 而……却


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
Copy link
Member

Choose a reason for hiding this comment

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

convention 同上

Copy link
Member Author

Choose a reason for hiding this comment

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

OK,之前还有几个地方是翻译成了“规约”,我一并改过来好了

@Jinjiang Jinjiang merged commit 8460eb3 into master Oct 10, 2017
@Jinjiang Jinjiang deleted the style-guide-b-9-12 branch October 10, 2017 14:13
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.

2 participants