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

Support Multi-language, added traditional chinese translation #89

Open
wants to merge 45 commits into
base: gh-pages
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
0c73c70
Add zh-TW folder
asika32764 Sep 18, 2014
f90d268
Added Immediately Invoked Function Expression for Mootools
bblurock Sep 22, 2014
c21626e
Added jQuery ver 1.11.1
bblurock Sep 22, 2014
b3860de
Added Dropdown menu for multi-languages support.
bblurock Sep 22, 2014
e17096d
Added multi-languages support to manual.js, it can now detect the sel…
bblurock Sep 22, 2014
2f31b6a
Merge pull request #7 from bblurock/gh-pages-multi-languages-support
asika32764 Sep 23, 2014
3401692
add raw translation of javascript coding standards
skylying Sep 24, 2014
4ba4cc4
translation refector
skylying Sep 25, 2014
9710c55
fix mark down format
skylying Sep 30, 2014
90d74e7
Merge pull request #8 from skylying/feature-js-coding-standards-chinese
asika32764 Sep 30, 2014
51afb0c
translate chapter "source-code-management" and "xml"
LeoOnTheEarth Oct 2, 2014
a03c89d
Translate
Oct 3, 2014
4b19f23
updated translate
LeoOnTheEarth Oct 3, 2014
8831e10
Quality fix
Oct 3, 2014
f9d8548
Merge pull request #12 from michael520/analysis-gh-pages
asika32764 Oct 3, 2014
6ead17f
Merge pull request #11 from LeoOnTheEarth/translate-20141003
asika32764 Oct 3, 2014
2c84c88
Translate menu
Oct 3, 2014
bf10705
Merge pull request #13 from michael520/menu-gh-pages
asika32764 Oct 3, 2014
945123c
Translate Introduction
asika32764 Oct 3, 2014
3e1660b
Update introduction.md
asika32764 Oct 3, 2014
4de75d2
Update introduction.md
asika32764 Oct 3, 2014
d562b51
html.md 翻譯
bblurock Sep 29, 2014
4cbd708
CSS.md 翻譯
bblurock Oct 6, 2014
2736b52
Update introduction.md
asika32764 Oct 6, 2014
9fa82d0
錯字,正確 good 錯誤 bad
bblurock Oct 6, 2014
f14bc8f
Merge pull request #10 from bblurock/translate-html-page
asika32764 Oct 6, 2014
3da6c77
Update introduction.md
asika32764 Oct 6, 2014
9e0a9ef
Merge pull request #15 from smstw/asika-intro
bblurock Oct 6, 2014
1400b99
新翻譯
takeshiwayne Oct 7, 2014
1baf391
翻譯revised2
takeshiwayne Oct 7, 2014
0a4f851
revised3
takeshiwayne Oct 7, 2014
0e7076d
改"開頭"和加逗號
takeshiwayne Oct 7, 2014
ab151df
revised 4th
takeshiwayne Oct 7, 2014
414a155
Fix php chapter
asika32764 Oct 13, 2014
59359da
Add Inline comment
asika32764 Oct 13, 2014
113bde6
Merge pull request #16 from takeshiwayne/docblock
LeoOnTheEarth Oct 13, 2014
212fe9a
Update inline-comments.md
asika32764 Oct 13, 2014
10b4642
Quality fix.
Oct 27, 2014
85f2d57
Merge pull request #18 from smstw/comment
LeoOnTheEarth Oct 27, 2014
0239e86
After language menu selected. populate menu
bblurock Oct 28, 2014
08a49ba
Merge pull request #20 from bblurock/bugfix-populate-menu
asika32764 Oct 28, 2014
3d44a04
Use language.md to track multi-lang.
bblurock Oct 28, 2014
5210398
Merge pull request #21 from bblurock/using-md-to-track-language
asika32764 Oct 28, 2014
4db3a4b
Removed outdated zh-TW translation.
bblurock Nov 3, 2014
4bbdd84
Merge pull request #22 from bblurock/remove_outdated_chinese_translation
asika32764 Nov 3, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions assets/js/jquery-1.11.1.min.js

Large diffs are not rendered by default.

216 changes: 124 additions & 92 deletions assets/js/manual.js
Original file line number Diff line number Diff line change
@@ -1,101 +1,133 @@
var populateWindow = function(link) {
var markdownRequest = new Request({
"url": here + 'manual/en-US/' + link,
"method": "get",
"onSuccess": function(response) {
$('docwin').set('html', marked(response));
}
}).send();
;(function($) {
var populateWindow = function(link) {
var markdownRequest = new Request({
"url": here + 'manual/' + locale + '/' + link,
"method": "get",
"onSuccess": function(response) {
$('docwin').set('html', marked(response));
}
}).send();

$$('.nav-list li').each(
function(item) {
if (item.getElements('a').length == 0) {
item.addClass('nav-header');
}
}
);
$$('.nav-list li').each(
function(item) {
if (item.getElements('a').length == 0) {
item.addClass('nav-header');
}
}
);

$$('.nav-list a').each(
function(item, index)
{
if (link == item.get('href'))
{
item.getParent('li').addClass('active');
}
else
{
item.getParent('li').removeClass('active');
}
}.bind(this)
);
}
$$('.nav-list a').each(
function(item, index)
{
if (link == item.get('href'))
{
item.getParent('li').addClass('active');
}
else
{
item.getParent('li').removeClass('active');
}
}.bind(this)
);
}

var populateMenu = function() {
var markdownRequest = new Request({
"url": here + 'manual/en-US/menu.md',
"method": "get",
"onSuccess": function (response) {
$('doc-menu').set('html', marked(response));
$$('#doc-menu ul').each(function(el) {
el.addClass('nav');
el.addClass('nav-list');
});
var populateMenu = function() {
var markdownRequest = new Request({
"url": here + 'manual/' + locale + '/menu.md',
"method": "get",
"onSuccess": function (response) {
$('doc-menu').set('html', marked(response));
$$('#doc-menu ul').each(function(el) {
el.addClass('nav');
el.addClass('nav-list');
});

$$('.nav-list li').each(
function(item) {
if (item.getElements('a').length == 0) {
item.addClass('nav-header');
}
}
);
}
}).send();
}
$$('.nav-list li').each(
function(item) {
if (item.getElements('a').length == 0) {
item.addClass('nav-header');
}
}
);
}
}).send();
}

var populateVersion = function() {
var versionRequest = new Request({
"url": here + 'manual/en-US/version.md',
"method": "get",
"onSuccess": function(response) {
$('version').set('html', marked(response));
}
}).send();
}
var populateLanguage = function() {
var markdownRequest = new Request({
"url": here + 'manual/' + locale + '/language.md',
"method": "get",
"onSuccess": function (response) {
var parser = new DOMParser(),
list = parser.parseFromString(marked(response), 'text/xml');

window.addEvent('domready', function() {
var urlParts = document.URL.split('?', 2);
state = {};
here = urlParts[0];
$$(list.getElementsByTagName('li')).each(
function(item) {
$('language-items').grab(item);
});
}
}).send();
}

if (urlParts.length > 1)
{
var currentDoc = urlParts[1];
}
else
{
var currentDoc = "coding-standards/introduction.md";
}
var populateVersion = function() {
var versionRequest = new Request({
"url": here + 'manual/' + locale + '/version.md',
"method": "get",
"onSuccess": function(response) {
$('version').set('html', marked(response));
}
}).send();
}

marked.setOptions({
gfm: true,
pedantic: false,
sanitize: false,
highlight: function(code, lang) {
var that;
Rainbow.color(code, lang, function(hl_code) { that = hl_code; });
return that;
}
})
populateMenu();
populateWindow(currentDoc);
populateVersion();
window.addEvent('domready', function() {
var urlParts = document.URL.split('?', 2);
state = {};
here = urlParts[0];
locale = 'en-US';

document.id('main').addEvent('click:relay(a)', function (event, target) {
if (target.get('href').substring(0, 4) != 'http' && target.get('href').substring(0, 1) != '#')
{
populateWindow(target.get('href'));
event.preventDefault();
history.pushState(state, target.get('href'), "?" + target.get('href'));
}
});
});
if (urlParts.length > 1)
{
var currentDoc = urlParts[1];
}
else
{
var currentDoc = "coding-standards/introduction.md";
}

marked.setOptions({
gfm: true,
pedantic: false,
sanitize: false,
highlight: function(code, lang) {
var that;
Rainbow.color(code, lang, function(hl_code) { that = hl_code; });
return that;
}
})
populateMenu();
populateLanguage();
populateWindow(currentDoc);
populateVersion();

document.id('language-items').addEvent('click:relay(a)', function (event, target) {
locale = target.get('href');
populateMenu();
populateWindow(currentDoc);
event.preventDefault();

// Update display text on dropdown menu
var currentLang = target.get('html');
$('language-select').set('html', currentLang);
});

document.id('main').addEvent('click:relay(a)', function (event, target) {
if (target.get('href').substring(0, 4) != 'http' && target.get('href').substring(0, 1) != '#')
{
populateMenu();
populateWindow(target.get('href'));
event.preventDefault();
history.pushState(state, target.get('href'), "?" + target.get('href'));
}
});
});
})(document.id)
16 changes: 14 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,18 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="/coding-standards/">Joomla! Coding Standards Manual</a>
<a class="brand" href="">Joomla! Coding Standards Manual</a>
<ul class="nav pull-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
Language:
<span id="language-select">English</span>
<b class="caret"></b>
</a>
<ul id="language-items" class="dropdown-menu">
</ul>
</li>
</ul>
</div>
</div>
</div>
Expand Down Expand Up @@ -74,6 +85,7 @@ <h4>License</h4>
<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="assets/js/jquery-1.11.1.min.js"></script>
<script src="assets/js/mootools.js"></script>
<script src="assets/js/marked.js"></script>
<script src="assets/js/rainbow.js"></script>
Expand All @@ -83,6 +95,6 @@ <h4>License</h4>
<script src="assets/js/language/javascript.js"></script>
<script src="assets/js/language/php.js"></script>
<script src="assets/js/manual.js"></script>

<script src="assets/js/bootstrap.js"></script>
</body>
</html>
2 changes: 2 additions & 0 deletions manual/en-US/language.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- [English](en-US)
- [中文 (繁體)](zh-TW)
2 changes: 2 additions & 0 deletions manual/language.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- [English](en-US)
- [中文 (繁體)](zh-TW)
33 changes: 33 additions & 0 deletions manual/zh-TW/appendices/analysis.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
## 代碼標準分析

對於接受所貢獻出新的程式碼時,我們將會執行代碼標準,以確保源程式碼的風格是一致的。也能確保你的代碼能符合此標準以順暢的進行程式碼的貢獻。

## 配置代碼分析工具

為了提高源程式碼的一致性和可讀性,Joomla 會使用代碼分析工具,CodeSniffer,並為了保持最新狀態,會把重要的變更與變化都會更新上 Joomla 專案的程式庫。

### 執行 CodeSniffer

Joomla 的代碼標準規則都會交由名為 PHP CodeSniffer 的工具來寫入。若要安裝 PHP CodeSniffer 至您的系統,請到這個連結: [PHP CodeSniffer Pear Page](http://pear.php.net/package/PHP_CodeSniffer)查詢相關資訊。

你可以透過 CMS (內容管理系統),Framework (框架),或 Issue Tracker (問題追蹤) 這些型態的系統,並置於這些程式軟體的根目錄下執行這個工具。

```
phpcs --report=checkstyle --report-file=build/logs/checkstyle.xml --standard=/path/to/<your root>/build/phpcs/Joomla /path/to/<your root>
```

此外,如果在你的系統安裝了 Ant,你必須在它所配置的中的 `<root directory>` 裡的 Joomla 根目錄下執行 CodeSniffer 來測試與運行程式碼的分析。

```
ant phpcs
```

#### 已知的問題

- 在 Simplepie 的函式庫上執行 Code Sniffer 會產生一些問題,可將目標指向 libraries/joomla 即可避免。

## 其它工具

這裡有些其它可用的工具讓開發者能計畫發送源程式碼至現在的專案。

### PhpStorm 代碼樣式表
1 change: 1 addition & 0 deletions manual/zh-TW/appendices/examples.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
## Code Examples
33 changes: 33 additions & 0 deletions manual/zh-TW/coding-standards/chapters/basic-guidelines.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
## 基礎大綱

本章節旨在說明基礎的檔案規則

## 檔案格式

所有針對 Joomla 開發的檔案格式都必須存為 ASCII text、使用 UTF-8 編碼字型並且經過 Unix 格式化。以行為單位的程式碼必須使用換行字元(LF)作為結尾。換行字元的表示法為:10(序數)、012(八進位)、0A(十六進位)。不要使用純CR回車符(例如蘋果電腦)或是CRLF組合(例如windows電腦)。

## 拼字

所有使用在程式碼註解、類別、函式、變數、常數的命名原則都必須根據英式英文(en_GB)原則。但有些例外是可允許的,例如某些已內建在 PHP API 中常見的程式用語,或其他慣例用語如 "color" 這樣已制定的用法便可沿用美式英文

## 縮排

縮排一律使用 Tab 鈕(根據國際 PEAR 準則)。編碼時使用的 IDE 如 Eclipse 需設定 Tab 為4個空白字元長度。

## 行寬

原則上每行程式碼並沒有最大長度限制,但根據國際標準值,150字元能夠在不需要水平滾動的狀況下達到最好的可讀性。若遇到換行會影響輸出結果的情況(例如 PHP/HTML 混合的結構檔案),更長的程式碼也是被允許的。

## 優良範例

以下提供一些外部資源,讓大家可以參考這些資源以及相關寫法:

* [Joomla 開發者網路](http://developer.joomla.org/) - 所有開發相關資源都可由此尋找
* [Joomla 開發教學文件](http://docs.joomla.org/Developers) - 官方完整的開發教學 Wiki
* [PEAR 編碼標準](http://pear.php.net/manual/en/standards.php)
* [Allman 縮排風格 (Wiki)](http://en.wikipedia.org/wiki/Indent_style#Allman_style)
* [Joomla Coding Standards Github](https://github.com/joomla/coding-standards) - 儲存 PHP Codesniffer 設定檔等等
* [Joomla CodeSniffer](http://docs.joomla.org/Joomla_CodeSniffer) - Joomla 開發過程與 IDE 的整合
* [Secure coding guidelines](http://docs.joomla.org/Secure_coding_guidelines) - 安全性編碼導覽

本清單將隨時補充~~~
Loading