├── Project.png
├── Diffusion.png
├── Diffusion2.png
├── Maniphest.png
├── screenshot.png
├── Differential.png
├── transToJson.sh
├── extract.sh
├── parseI18nStrings.sh
├── parseI18nStringsGroupByApp.sh
└── README.md
/Project.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cwlin0416/phabricator-zh_hant/HEAD/Project.png
--------------------------------------------------------------------------------
/Diffusion.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cwlin0416/phabricator-zh_hant/HEAD/Diffusion.png
--------------------------------------------------------------------------------
/Diffusion2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cwlin0416/phabricator-zh_hant/HEAD/Diffusion2.png
--------------------------------------------------------------------------------
/Maniphest.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cwlin0416/phabricator-zh_hant/HEAD/Maniphest.png
--------------------------------------------------------------------------------
/screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cwlin0416/phabricator-zh_hant/HEAD/screenshot.png
--------------------------------------------------------------------------------
/Differential.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cwlin0416/phabricator-zh_hant/HEAD/Differential.png
--------------------------------------------------------------------------------
/transToJson.sh:
--------------------------------------------------------------------------------
1 | #!/usr/local/bin/php
2 | getTranslations();
6 | }
7 | }
8 |
9 | require_once "PhabricatorTradChineseTranslation.php";
10 |
11 | $trans = new PhabricatorTradChineseTranslation();
12 | $transStrings = $trans->dumpTranslations();
13 | $transStrings = array_filter($transStrings);
14 | echo json_encode($transStrings);
15 |
--------------------------------------------------------------------------------
/extract.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | I18N_STRING_FILE=/usr/local/lib/php/phabricator/src/.cache/i18n_strings.json
3 | TEMP_PATH=$PWD
4 | cd /usr/local/lib/php/ && phabricator/bin/i18n extract
5 | cd $TEMP_PATH
6 | php -f parseI18nStringsGroupByApp.sh $I18N_STRING_FILE > PhabricatorTradChineseTranslation.php.new
7 | mv PhabricatorTradChineseTranslation.php PhabricatorTradChineseTranslation.php.old
8 | mv PhabricatorTradChineseTranslation.php.new PhabricatorTradChineseTranslation.php
9 |
10 |
--------------------------------------------------------------------------------
/parseI18nStrings.sh:
--------------------------------------------------------------------------------
1 | #!/usr/local/bin/php
2 |
10 | final class PhabricatorTradChineseTranslation
11 | extends PhutilTranslation {
12 |
13 | public function getLocaleCode() {
14 | return 'zh_Hant';
15 | }
16 | protected function getTranslations() {
17 | return getTranslations();
21 | }
22 | }
23 |
24 | require_once "PhabricatorTradChineseTranslation.php";
25 |
26 | $trans = new PhabricatorTradChineseTranslation();
27 | $transStrings = $trans->dumpTranslations();
28 | $transStrings = array_filter($transStrings);
29 |
30 | // Load new stromgs from JSON file
31 | $json = file_get_contents($jsonFile);
32 | $strings = json_decode($json);
33 | $results = array();
34 |
35 | // Merge new translations and old translations
36 | foreach($strings as $string => $uses) {
37 | $results[$string] = null;
38 | if( !empty($transStrings[$string]) ) {
39 | $results[$string] = $transStrings[$string];
40 | unset($transStrings[$string]);
41 | }
42 | }
43 | $results = array_merge($results, $transStrings);
44 |
45 | // Export as PHP var
46 | var_export($results);
47 | ?>
48 | ;
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/parseI18nStringsGroupByApp.sh:
--------------------------------------------------------------------------------
1 | #!/usr/local/bin/php
2 |
9 | final class PhabricatorTradChineseTranslation
10 | extends PhutilTranslation {
11 |
12 | public function getLocaleCode() {
13 | return 'zh_Hant';
14 | }
15 | protected function getTranslations() {
16 | return getTranslations();
20 | }
21 | }
22 |
23 | require_once "PhabricatorTradChineseTranslation.php";
24 |
25 | $trans = new PhabricatorTradChineseTranslation();
26 | $transStrings = $trans->dumpTranslations();
27 | $transStrings = array_filter($transStrings);
28 |
29 | $json = file_get_contents($jsonFile);
30 | $strings = (array)json_decode($json);
31 |
32 | function getBelongApp($uses) {
33 | $appNames = array();
34 | foreach($uses as $use) {
35 | $ex = explode("/", $use->file);
36 | if( $ex[1] == 'applications' ) {
37 | $app = $ex[2];
38 | } else {
39 | $app = $ex[1];
40 | }
41 | $appNames[] = $app;
42 | }
43 | // Count occuries and get most
44 | $appStat = array_count_values($appNames);
45 | arsort($appStat);
46 | $mostApp = array_keys($appStat)[0];
47 |
48 | if( count($appStat) > 2) {
49 | $mostApp = 'common';
50 | }
51 | return $mostApp;
52 | }
53 | $categoryStrings = array();
54 | $categoryStrings['common'] = array();
55 | foreach($strings as $string => $uses) {
56 | $category = null;
57 | $category = getBelongApp($uses->uses);
58 | $categoryStrings[$category][$string] = null;
59 | if( !empty($transStrings[$string])) {
60 | $categoryStrings[$category][$string] = $transStrings[$string];
61 | unset($transStrings[$string]);
62 | }
63 | ksort($categoryStrings[$category]);
64 | }
65 | $categoryStrings['unused'] = $transStrings;
66 | ksort($categoryStrings);
67 | echo "array (\n";
68 | foreach($categoryStrings as $category => $strings) {
69 | $lineWidth = 75;
70 | $categoryName = ucfirst($category);
71 | echo " // ". str_repeat("-", $lineWidth). "\n";
72 | echo " // ". str_pad($categoryName, $lineWidth, " ", STR_PAD_BOTH). "\n";
73 | echo " // ". str_repeat("-", $lineWidth). "\n";
74 | echo substr(var_export($strings, true), 7, -1). "\n";
75 | }
76 | echo ")";
77 | ?>
78 | ;
79 | }
80 |
81 | }
82 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Phabricator 繁體中文語系
2 |
3 | Phabricator 官方網站 http://phabricator.org/
4 |
5 | 
6 | 
7 | 
8 | 
9 | 
10 | 
11 |
12 | ##安裝 Phabricator
13 | https://secure.phabricator.com/book/phabricator/article/installation_guide/
14 |
15 | ### 安裝需求
16 | * 作業系統
17 | * Linux
18 | * FreeBSD
19 | * Mac OS X
20 | * Solaris
21 | * 網頁伺服器
22 | * Apache: 安裝使用 Apache + mod_php.
23 | * nginx: 安裝使用 nginx + php-fpm.
24 | * MySQL: 建議 MySQL 5.5 或更新版本
25 | * PHP: 需要 PHP 5.2 或更新版本
26 | * 網域名稱 (如 `phabricator.mycompany.com`)
27 |
28 | ### FreeBSD ###
29 | ###### 使用 Ports 安裝
30 | `cd /usr/ports/devel/phabricator/ && make install clean`
31 |
32 | ###### 安裝並啟動 Phabricator Daemon 服務
33 | ```
34 | echo phd_enable="YES" >> /etc/rc.conf
35 | service phd start
36 | ```
37 |
38 | ###### 安裝完的程式分別有 arcanist, libphutil, phabricator 位於
39 | * `/usr/local/lib/php/arcanist/`
40 | * `/usr/local/lib/php/libphutil/`
41 | * `/usr/local/lib/php/phabricator/`
42 |
43 | ### Ubuntu ###
44 | ###### 使用 Shell Script 安裝
45 | 下載官方提供的 [install_ubuntu.sh](https://secure.phabricator.com/diffusion/P/browse/master/scripts/install/install_ubuntu.sh) 到欲安裝的目錄 (例: `/usr/share/php/``) 並執行
46 | ```
47 | cd /usr/share/php/ && wget https://secure.phabricator.com/diffusion/P/browse/master/scripts/install/install_ubuntu.sh
48 | chmod 755 install_ubuntu.sh
49 | ./install_ubuntu.sh
50 | ```
51 |
52 | ###### 啟動 Phabricator Daemon 服務
53 | `/usr/share/php/phabricator/bin/phd start`
54 |
55 | #### 安裝完的程式分別有 arcanist, libphutil, phabricator 位於
56 | * `/usr/share/php/arcanist/`
57 | * `/usr/share/php/libphutil/`
58 | * `/usr/share/php/phabricator/`
59 |
60 |
61 | ### 設定服務
62 | https://secure.phabricator.com/book/phabricator/article/configuration_guide/
63 | #### Apache
64 | ###### 加入設定檔
65 | 以 FreeBSD 為例,可加入 `/usr/local/etc/apache24/Includes/phabricator.conf` 檔案如下:
66 | ```
67 |
68 | # Change this to the domain which points to your host.
69 | ServerName phabricator.mycompany.com
70 |
71 | # Change this to the path where you put 'phabricator' when you checked it
72 | # out from GitHub when following the Installation Guide.
73 | #
74 | # Make sure you include "/webroot" at the end!
75 | DocumentRoot /usr/local/lib/php/phabricator/webroot
76 |
77 | Require all granted
78 |
79 |
80 | RewriteEngine on
81 | RewriteRule ^/rsrc/(.*) - [L,QSA]
82 | RewriteRule ^/favicon.ico - [L,QSA]
83 | RewriteRule ^(.*)$ /index.php?__path__=$1 [B,L,QSA]
84 |
85 | ```
86 | ###### 重啟 Apache
87 | 於 FreeBSD
88 |
89 | `service apache24 restart`
90 |
91 | 於 Ubuntu
92 |
93 | `service apache2 restart`
94 |
95 | 接下來便可進入 `phabricator.mycompany.com` 依提示完成剩下的安裝作業
96 |
97 | ##安裝 Phabricator 語系
98 |
99 | ###### 安裝語系檔
100 | 將 phabricator-zh_hant 資料夾放置於 `./phabricator/src/extensions/` 目錄底下,以 FreeBSD 為例:
101 | ```
102 | cd /usr/local/lib/php/phabricator/src/extensions/
103 | git clone https://github.com/cwlin0416/phabricator-zh_hant.git
104 | ```
105 |
106 | ###### 修正語系支援
107 | 目前 github 上的最新版本已無須再套用這個修補
108 | 切換語系後若出現錯誤訊息可以有兩種選擇: 1. 自行修改, 2. 更新到最新版
109 |
110 | 舊版 Phabricator 需額外修改
111 |
112 | `/usr/local/lib/php/libphutil/src/internationalization/PhutilTranslator.php`
113 |
114 | 加入繁體中文的語系方可正常使用
115 |
116 | ```
117 | @@ -190,6 +190,7 @@ final class PhutilTranslator extends Phobject {
118 | return $plural;
119 |
120 | case 'ko_KR':
121 | + case 'zh_Hant':
122 | list($singular, $plural) = $translations;
123 | if ($variant == 1) {
124 | return $singular;
125 | ```
126 |
127 | ## 升級 Phabricator
128 | https://secure.phabricator.com/book/phabricator/article/upgrading/
129 |
130 | 升級 Phabricator 必須使用 Github 上的檔案庫, 因此 FreeBSD 採用 Ports 安裝的使用者需自行將安裝的 phabricator/, arcanist/, libphutil/ 三個目錄替換為 git 的版本。
131 |
132 | * 停止網頁伺服器 (`service apache24 stop`)
133 | * 停止 Daemon (`phabricator/bin/phd stop`)
134 | * 更新原始碼
135 | * `phabricator/ $ git checkout stable`
136 | * `phabricator/ $ git pull`
137 | * `arcanist/ $ git checkout stable`
138 | * `arcanist/ $ git pull`
139 | * `libphutil/ $ git checkout stable`
140 | * `libphutil/ $ git pull`
141 | * 升級資料庫 (`phabricator/bin/storage upgrade`)
142 | * 重啟 Daemon (`phabricator/bin/phd start`)
143 | * 重啟網頁伺服器 (`service apache24 start`)
144 |
145 | ### 範例升級 Shell Script
146 |
147 | ```
148 | #!/bin/sh
149 |
150 | set -e
151 | set -x
152 |
153 | # This is an example script for updating Phabricator, similar to the one used to
154 | # update . It might not work perfectly on your
155 | # system, but hopefully it should be easy to adapt. This script is not intended
156 | # to work without modifications.
157 |
158 | # NOTE: This script assumes you are running it from a directory which contains
159 | # arcanist/, libphutil/, and phabricator/.
160 |
161 | ROOT='/usr/local/lib/php' # 請修改此行為 Phabricator 所在路徑, 此處以 FreeBSD 的路徑為例
162 |
163 | ### UPDATE WORKING COPIES ######################################################
164 |
165 | cd $ROOT/libphutil
166 | git pull
167 |
168 | cd $ROOT/arcanist
169 | git pull
170 |
171 | cd $ROOT/phabricator
172 | git pull
173 |
174 |
175 | ### CYCLE WEB SERVER AND DAEMONS ###############################################
176 |
177 | # Stop daemons.
178 | service phd stop
179 |
180 | # If running the notification server, stop it.
181 | # $ROOT/phabricator/bin/aphlict stop
182 |
183 | # Stop the webserver (apache, nginx, lighttpd, etc). This command will differ
184 | # depending on which system and webserver you are running: replace it with an
185 | # appropriate command for your system.
186 | # NOTE: If you're running php-fpm, you should stop it here too.
187 |
188 | service apache24 stop
189 |
190 |
191 | # Upgrade the database schema. You may want to add the "--force" flag to allow
192 | # this script to run noninteractively.
193 | $ROOT/phabricator/bin/storage upgrade --force
194 |
195 | # Restart the webserver. As above, this depends on your system and webserver.
196 | # NOTE: If you're running php-fpm, restart it here too.
197 | service apache24 start
198 |
199 | # Restart daemons.
200 | service phd start
201 |
202 | # If running the notification server, start it.
203 | # $ROOT/phabricator/bin/aphlict start
204 | ```
205 |
206 | ## 製作 Phabricator 語系
207 |
208 | ### 產生語系資源
209 |
210 | #### 新版
211 | 新版的 Phabricator 不會直接輸出 PHP 格式,且所產生的語系資源改使用 json 格式儲存於 Phabricator 目錄下的 `/src/.cache/i18n_strings.json`
212 |
213 | 使用指令擷取目前程式中可翻譯的字串
214 |
215 | `cd /usr/local/lib/php/ && phabricator/bin/i18n extract`
216 |
217 | 接著使本檔案庫所附的用將 `/src/.cache/i18n_strings.json` 的翻譯轉換與舊的翻譯合併為 PHP Class
218 |
219 | `php -f parseI18nStrings.php /usr/local/lib/php/phabricator/src/.cache/i18n_strings.json > PhabricatorTradChineseTranslation.php.new`
220 |
221 | 所有動作執行 `extract.sh` 便可完成,執行前要先確認 i18n_strings.json 的檔案路徑是否正確
222 |
223 | #### 舊版
224 | 請使用指令擷取目前程式碼中可翻譯的字串
225 | `./phabricator/bin/i18n extract ./phabricator/src > extractStrings`
226 | 擷取完之後將該字串依語系擴充套件的 API 文件放到新語系類別的 getTranslations() 函數中
227 |
228 | ### 建立語系擴充套件
229 | https://secure.phabricator.com/book/phabcontrib/article/internationalization/
230 |
231 |
232 | ## 術語表
233 | 詞 | 翻譯 | 說明
234 | ------------------------ | ------------- | -------------
235 | Review | 審查 |
236 | Audit | 稽查 |
237 | Assign | 分配 |
238 | Repository | 檔案庫 |
239 | Revision | 修訂 | 與版本管理的修訂不太一樣,是指 Differential 審查程式碼的申請項目
240 | Needs Triage | 需要分級 | 新增完工作的預設狀態, 代表讓工作需要先區分優先權等級以便後續動作
241 | Conpherence | 會議 | 會議,為 Conference 的協音
242 | Room | 會議室 | 由 Conpherence 所使用,因此譯為會議室
243 | Column | 欄 | 用在工作看板 (Workboard) 的欄
244 | "Unbreak Now!" | 緊急! | 工作優先權狀態, 需要立即處理的工作
245 | Dashboard | 資訊看板 |
246 | Panel | 面板 | 資訊看板的面板
247 | Commit | 提交 | 版本管理系統的一個提出修訂的動作
248 | Image Macro, Meme | 貼圖 | Image Macro 指的是加上文字的貼圖,Meme 是在網路上流行/散佈的一個點子
249 | Credential | 憑證 | 密碼憑證
250 | Policy | 原則 | 存取原則,用來規範存取的方式
251 | Mock | 模型 | 畫面模型
252 | Patch | 修補 | 修補檔
253 | Provider, Auth Provider | 提供者 | 認証提供者
254 | Pin, Pinned | 釘選 | 釘選應用程式
255 | Filetree | 檔案樹 |
256 | Tags | 標籤 | 專案標籤
257 | Token | 獎勵, Token | 頒發獎勵, API Token
258 | Multi-Factor auth | 多重認証 |
259 | Schema | 架構 | 資料庫架構
260 | Poll | 調查 | 決策調查
261 | Staging Area | 臨時區 | 整合測試與編譯測試用的臨時區
262 | Build, Build Plan | 建置 | 建置計劃
263 | File Storage | 檔案儲存庫 |
264 | Transforms | 轉換 |
265 | Package | 套件 | 擁有者(Owner)管理以套件 (Package) 為單位
266 | Contributor | 貢獻者 | 協議貢獻者
267 | Signed | 簽署 | 簽署協議
268 | Flag, Flagged | 旗幟, 旗標 | n. 旗幟, v. 旗標
269 | Initiatives | 提案 | Fund Initiatives
270 | Blog | 網誌 | Phame Blog
271 | Post | 文章 | Phame Post
272 | Paste | 剪貼簿 |
273 | Passphrase | 暗號 |
274 | Development, Production | 開發/線上模式 |
275 | Automation Blueprint | 自動化藍圖 |
276 | Badge | 徽章 |
277 | Revision Blocking, Block | 阻擋 | 阻擋, 無法繼續審查
278 | Commandeer | 徵用, 徵用修訂|
279 | Resign | 放棄 | 放棄審查
280 | Parent Task/Subtask | 父工作/子工作 | 工作
281 | Publisher | 發行人 | 套件發行人
282 | Favorite | 我的最愛 | 自訂選單項目
283 | Assignee | 受託人 | 工作的受託人
284 | dependent revision | | Differential
285 | Blocking | 阻擋 | Differential
286 | blocking reviewer | 阻擋審查員 | Differential
287 | Changeset | | Differential
288 | patches | | Differential
289 |
290 | ## 已知問題
291 | 由於 arcanist 會去解析 Commit 訊息,因此 `Differential Revision` 訊息翻譯會導致 arcanist 無法正常執行
292 |
293 | 問題詳見:
294 | https://github.com/phacility/arcanist/blob/master/src/differential/ArcanistDifferentialCommitMessage.php#L119
295 |
296 | ```
297 | 'Differential Revision' => NULL, //'Differential 修訂', @TODO 會導致 arcanist 無法正常使用
298 | ```
--------------------------------------------------------------------------------