Skip to content
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

[Feature] add raw translation of javascript coding standards #8

Merged

Conversation

skylying
Copy link

for
javascript.md 翻譯 #2

英文部分都還沒刪掉, 方便 review, 沒問題後會再補 commit 上來把英文都刪除

review 可以來看這邊
https://github.com/skylying/joomla-coding-standards/blob/feature-js-coding-standards-chinese/manual/zh-TW/coding-standards/chapters/javascript.md

有問題的部分:

條件式

Use ternary syntax if:
在下列情況使用三元運算式:

  • One condition
  • 只有一個條件
  • Result of either evaluation is one operation. => 這邊
  • 看不太懂 by Tim 2014-09-24


**Use names that describe what the variable is:**
**使用描述變數意義的命名準則**

Choose a reason for hiding this comment

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

Suggestion: 變數名稱應該描述其變數意義

Copy link
Author

Choose a reason for hiding this comment

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

Suggestion accepted

@asika32764
Copy link

其實英文不保留的話,split view也可以對照
image


Use the literal, not constructor, syntax.
使用大括號建立物件,而非建構方式

Choose a reason for hiding this comment

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

這XDDD 我看中文都看不懂在說什麼

Choose a reason for hiding this comment

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

原文也是很文言...

Choose a reason for hiding this comment

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

使用大括號建立物件,不要使用物件建構子

Copy link
Author

Choose a reason for hiding this comment

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

Ok, 加個子

@bblurock
Copy link

恩呀,我現在都用 split view,相當方便! 只不過一行太長的話斷行也是很難閱讀。


```
var myObj = {};
```

If an object contains more than one key/value pair or an array as a value, each key/value pair should be on its own line.
如果物件包含多組 索引/值,每一組 索引/值 都必須是一個獨立的行

Choose a reason for hiding this comment

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

than one key/value pair 'or an array as a value' 這個沒翻到

Copy link
Author

Choose a reason for hiding this comment

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

應該是缺了array 的部分QQ

@asika32764
Copy link

看來 Joomla 的 JS Style 也還在討論 joomla#61

可以看一下討論內容

不過這個 PR 擱置很久了,我們可以先翻譯完,再訂我們自己的

@skylying
Copy link
Author

說到自訂,有一個部分我覺得跟我們目前使用的落差比較大,是空白的部分
例如要寫 [ 'abc', 'def' ] 而不是 ['abc', 'def']

@asika32764
Copy link

光 if else 的括號要不要換行裡面都還在討論

- Tabs, 4 spaces
Tab 等同 4 個 spaces

Choose a reason for hiding this comment

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

這是說 Joomla 依舊用 Tab 作為 JS 縮排的意思?

Choose a reason for hiding this comment

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

應該是說, 用 4 個 spaces 取代 tab

- Place space before closing quote at the end of each string.
- 結束字串的引號應前綴空白字元

Choose a reason for hiding this comment

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

我想這句的意思應該是「有需要隔斷單字的空白,需要放在每一行字串的尾部,而非下一行字串的開頭」

Copy link
Author

Choose a reason for hiding this comment

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

ok

@asika32764
Copy link

括號內空白是來自這個規範 https://github.com/asika32764/idiomatic.js

不過目前的 JS 各家規範比 php 混亂很多

@skylying skylying force-pushed the feature-js-coding-standards-chinese branch from bb363e6 to 4ba4cc4 Compare September 25, 2014 05:37
- Tabs, 4 spaces
### 縮排
請勿混用 tab 與 spaces
Tab 等同 4 個 spaces

Choose a reason for hiding this comment

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

這裡應該是這樣,有清單標註

- 請勿混用 tab 與 spaces
- Tab 等同 4 個 spaces

Choose a reason for hiding this comment

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

這個改完就可以 merge 了

@skylying
Copy link
Author

改好囉

@asika32764
Copy link

iPhone merge

asika32764 added a commit that referenced this pull request Sep 30, 2014
[Feature] add raw translation of javascript coding standards
@asika32764 asika32764 merged commit 90d74e7 into smstw:gh-pages Sep 30, 2014
@skylying skylying mentioned this pull request Sep 30, 2014
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