-
Notifications
You must be signed in to change notification settings - Fork 3
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
[Feature] add raw translation of javascript coding standards #8
Conversation
|
||
**Use names that describe what the variable is:** | ||
**使用描述變數意義的命名準則** |
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.
Suggestion: 變數名稱應該描述其變數意義
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.
Suggestion accepted
|
||
Use the literal, not constructor, syntax. | ||
使用大括號建立物件,而非建構方式 |
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.
這XDDD 我看中文都看不懂在說什麼
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.
原文也是很文言...
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.
使用大括號建立物件,不要使用物件建構子
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, 加個子
恩呀,我現在都用 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. | ||
如果物件包含多組 索引/值,每一組 索引/值 都必須是一個獨立的行 |
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.
than one key/value pair 'or an array as a value' 這個沒翻到
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.
應該是缺了array 的部分QQ
看來 Joomla 的 JS Style 也還在討論 joomla#61 可以看一下討論內容 不過這個 PR 擱置很久了,我們可以先翻譯完,再訂我們自己的 |
說到自訂,有一個部分我覺得跟我們目前使用的落差比較大,是空白的部分 |
光 if else 的括號要不要換行裡面都還在討論 |
- Tabs, 4 spaces | ||
Tab 等同 4 個 spaces |
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.
這是說 Joomla 依舊用 Tab 作為 JS 縮排的意思?
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.
應該是說, 用 4 個 spaces 取代 tab
- Place space before closing quote at the end of each string. | ||
- 結束字串的引號應前綴空白字元 |
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.
我想這句的意思應該是「有需要隔斷單字的空白,需要放在每一行字串的尾部,而非下一行字串的開頭」
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
括號內空白是來自這個規範 https://github.com/asika32764/idiomatic.js 不過目前的 JS 各家規範比 php 混亂很多 |
bb363e6
to
4ba4cc4
Compare
- Tabs, 4 spaces | ||
### 縮排 | ||
請勿混用 tab 與 spaces | ||
Tab 等同 4 個 spaces |
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.
這裡應該是這樣,有清單標註
- 請勿混用 tab 與 spaces
- Tab 等同 4 個 spaces
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.
這個改完就可以 merge 了
改好囉 |
iPhone merge |
[Feature] add raw translation of javascript coding standards
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:
在下列情況使用三元運算式: