mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-08 22:31:04 +00:00
Translation update, handle locales precisely
This commit is contained in:
parent
e78d9ad592
commit
dfef929187
File diff suppressed because one or more lines are too long
@ -503,9 +503,8 @@ func restGetLang(w http.ResponseWriter, r *http.Request) {
|
||||
lang := r.Header.Get("Accept-Language")
|
||||
var langs []string
|
||||
for _, l := range strings.Split(lang, ",") {
|
||||
if len(l) >= 2 {
|
||||
langs = append(langs, l[:2])
|
||||
}
|
||||
parts := strings.SplitN(l, ";", 2)
|
||||
langs = append(langs, strings.TrimSpace(parts[0]))
|
||||
}
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
json.NewEncoder(w).Encode(langs)
|
||||
|
@ -51,21 +51,21 @@ func main() {
|
||||
|
||||
var langs []string
|
||||
for code, stat := range stats {
|
||||
shortCode := code[:2]
|
||||
if !curValidLangs[shortCode] {
|
||||
code = strings.Replace(code, "_", "-", 1)
|
||||
if !curValidLangs[code] {
|
||||
if pct := 100 * stat.Translated / (stat.Translated + stat.Untranslated); pct < 95 {
|
||||
log.Printf("Skipping language %q (too low completion ratio %d%%)", shortCode, pct)
|
||||
os.Remove("lang-" + shortCode + ".json")
|
||||
log.Printf("Skipping language %q (too low completion ratio %d%%)", code, pct)
|
||||
os.Remove("lang-" + code + ".json")
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
langs = append(langs, shortCode)
|
||||
if shortCode == "en" {
|
||||
langs = append(langs, code)
|
||||
if code == "en" {
|
||||
continue
|
||||
}
|
||||
|
||||
log.Printf("Updating language %q", shortCode)
|
||||
log.Printf("Updating language %q", code)
|
||||
|
||||
resp := req("https://www.transifex.com/api/2/project/syncthing/resource/gui/translation/" + code)
|
||||
var t translation
|
||||
@ -75,7 +75,7 @@ func main() {
|
||||
}
|
||||
resp.Body.Close()
|
||||
|
||||
fd, err := os.Create("lang-" + shortCode + ".json")
|
||||
fd, err := os.Create("lang-" + code + ".json")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
@ -130,7 +130,7 @@ func loadValidLangs() []string {
|
||||
}
|
||||
|
||||
var langs []string
|
||||
exp := regexp.MustCompile(`\[([a-z",]+)\]`)
|
||||
exp := regexp.MustCompile(`\[([a-zA-Z",-]+)\]`)
|
||||
if matches := exp.FindSubmatch(bs); len(matches) == 2 {
|
||||
langs = strings.Split(string(matches[1]), ",")
|
||||
for i := range langs {
|
||||
|
14
gui/app.js
14
gui/app.js
@ -86,11 +86,19 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http, $translate, $loca
|
||||
$scope.upgradeInfo = {};
|
||||
|
||||
$http.get(urlbase+"/lang").success(function (langs) {
|
||||
var lang;
|
||||
// Find the first language in the list provided by the user's browser
|
||||
// that is a prefix of a language we have available. That is, "en"
|
||||
// sent by the browser will match "en" or "en-US", while "zh-TW" will
|
||||
// match only "zh-TW" and not "zh-CN".
|
||||
|
||||
var lang, matching;
|
||||
for (var i = 0; i < langs.length; i++) {
|
||||
lang = langs[i];
|
||||
if (validLangs.indexOf(lang) >= 0) {
|
||||
$translate.use(lang);
|
||||
matching = validLangs.filter(function (l) {
|
||||
return l.indexOf(lang) == 0;
|
||||
});
|
||||
if (matching.length >= 1) {
|
||||
$translate.use(matching[0]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
120
gui/lang-zh-TW.json
Normal file
120
gui/lang-zh-TW.json
Normal file
@ -0,0 +1,120 @@
|
||||
{
|
||||
"API Key": "API 金鑰",
|
||||
"About": "關於",
|
||||
"Add Node": "增加節點",
|
||||
"Add Repository": "新增儲存庫",
|
||||
"Address": "位址",
|
||||
"Addresses": "位址",
|
||||
"Allow Anonymous Usage Reporting?": "允許匿名的使用資訊回報?",
|
||||
"Announce Server": "發佈伺服器",
|
||||
"Anonymous Usage Reporting": "匿名的使用資訊回報",
|
||||
"Bugs": "程式錯誤",
|
||||
"CPU Utilization": "CPU 使用率",
|
||||
"Close": "關閉",
|
||||
"Connection Error": "連線錯誤",
|
||||
"Copyright © 2014 Jakob Borg and the following Contributors:": "版權所有 © 2014 Jakob Borg 及以下貢獻者:",
|
||||
"Delete": "刪除",
|
||||
"Disconnected": "斷線",
|
||||
"Documentation": "說明文件",
|
||||
"Download Rate": "下載速率",
|
||||
"Edit": "編輯",
|
||||
"Edit Node": "編輯節點",
|
||||
"Edit Repository": "編輯儲存庫",
|
||||
"Enable UPnP": "啟用 UPnP",
|
||||
"Enter comma separated \"ip:port\" addresses or \"dynamic\" to perform automatic discovery of the address.": "輸入以半形逗號區隔的 \"ip:連接埠\" 位址,或著輸入 \"dynamic\" 以進行位址的自動探索",
|
||||
"Error": "錯誤",
|
||||
"File Versioning": "檔案版本控制",
|
||||
"File permission bits are ignored when looking for changes. Use on FAT filesystems.": "當在尋找變化時,檔案權限位元會被忽略。用於 FAT 檔案系統。",
|
||||
"Files are moved to date stamped versions in a .stversions folder when replaced or deleted by syncthing.": "當檔案被 syncthing 取代或刪除時,它們將被移至 .stversions 資料夾並添加日期戳記。",
|
||||
"Files are protected from changes made on other nodes, but changes made on this node will be sent to the rest of the cluster.": "其他節點做的改變不會影響到此節點的檔案,但在此節點上的變化將被發送到叢集中的其他部分。",
|
||||
"Folder": "資料夾",
|
||||
"GUI Authentication Password": "GUI 認證密碼",
|
||||
"GUI Authentication User": "GUI 認證使用者名稱",
|
||||
"GUI Listen Addresses": "GUI 監聽位址",
|
||||
"Generate": "產生",
|
||||
"Global Discovery": "全域探索",
|
||||
"Global Discovery Server": "全域探索伺服器",
|
||||
"Global Repository": "全域儲存庫",
|
||||
"Idle": "閒置",
|
||||
"Ignore Permissions": "忽略權限",
|
||||
"Keep Versions": "保留版本數",
|
||||
"Latest Release": "最新發佈",
|
||||
"Local Discovery": "本地探索",
|
||||
"Local Discovery Port": "本地探索連接埠",
|
||||
"Local Repository": "本地儲存庫",
|
||||
"Master Repo": "支配此儲存庫",
|
||||
"Max File Change Rate (KiB/s)": "最大檔案改變速率 (KiB/s)",
|
||||
"Max Outstanding Requests": "最大未完成的請求",
|
||||
"No": "否",
|
||||
"Node ID": "節點識別碼",
|
||||
"Node Identification": "節點識別",
|
||||
"Node Name": "節點名稱",
|
||||
"Notice": "公告",
|
||||
"OK": "確定",
|
||||
"Offline": "離線",
|
||||
"Online": "上線",
|
||||
"Out Of Sync": "不同步",
|
||||
"Outgoing Rate Limit (KiB/s)": "連出速率限制 (KiB/s)",
|
||||
"Override Changes": "覆蓋改變",
|
||||
"Path to the repository on the local computer. Will be created if it does not exist. The tilde character (~) can be used as a shortcut for": "儲存庫在本地電腦的路徑。若資料夾不存在則會建立。波浪符號 (~) 可用作下列資料夾的捷徑:",
|
||||
"Please wait": "請稍後",
|
||||
"Preview Usage Report": "預覽使用資訊報告",
|
||||
"RAM Utilization": "記憶體使用率",
|
||||
"Reconnect Interval (s)": "重新連接間隔 (秒)",
|
||||
"Repository ID": "儲存庫識別碼",
|
||||
"Repository Master": "儲存庫支配者",
|
||||
"Repository Path": "儲存庫路徑",
|
||||
"Rescan Interval (s)": "掃描間隔 (秒)",
|
||||
"Restart": "重新啟動",
|
||||
"Restart Needed": "需要重新啟動",
|
||||
"Restarting": "正在重新啟動",
|
||||
"Save": "儲存",
|
||||
"Scanning": "正在掃描",
|
||||
"Select the nodes to share this repository with.": "選擇要共享這個儲存庫的節點。",
|
||||
"Settings": "設定",
|
||||
"Share With Nodes": "與節點共享",
|
||||
"Shared With": "與誰共享",
|
||||
"Short identifier for the repository. Must be the same on all cluster nodes.": "儲存庫的簡短識別碼。必須在所有叢集節點上皆相同。",
|
||||
"Show ID": "顯示識別碼",
|
||||
"Shown instead of Node ID in the cluster status.": "代替節點識別碼顯示在叢集狀態中。",
|
||||
"Shutdown": "關閉",
|
||||
"Source Code": "原始碼",
|
||||
"Start Browser": "啟動瀏覽器",
|
||||
"Stopped": "已停止",
|
||||
"Support / Forum": "支援 / 論壇",
|
||||
"Sync Protocol Listen Addresses": "同步通訊協定監聽位址",
|
||||
"Synchronization": "同步作業",
|
||||
"Syncing": "正在同步",
|
||||
"Syncthing has been shut down.": "Syncthing 已經關閉。",
|
||||
"Syncthing includes the following software or portions thereof:": "Syncthing 包括以下軟體或其中的一部分:",
|
||||
"Syncthing is restarting.": "Syncthing 正在重新啟動。",
|
||||
"Syncthing is upgrading.": "Syncthing 正在進行升級。",
|
||||
"Syncthing seems to be down, or there is a problem with your Internet connection. Retrying…": "Syncthing 似乎下線了,或者您的網際網路連線出現問題。正在重試...",
|
||||
"The aggregated statistics are publicly available at {%url%}.": "匯總統計公佈於 {{url}}。",
|
||||
"The configuration has been saved but not activated. Syncthing must restart to activate the new configuration.": "組態已經儲存但尚未啟用。Syncthing 必須重新啟動以便啟用新的組態。",
|
||||
"The encrypted usage report is sent daily. It is used to track common platforms, repo sizes and app versions. If the reported data set is changed you will be prompted with this dialog again.": "經過加密的使用資訊報告會每天傳送。報告是用來追蹤常用的平台、儲存庫的大小以及應用程式的版本。若傳送的資料集有異動,您會再次看到這個對話框。",
|
||||
"The entered node ID does not look valid. It should be a 52 character string consisting of letters and numbers, with spaces and dashes being optional.": "輸入的節點識別碼似乎無效。它應該為一串包含英文字母及數字,並可能會含有空白或連接符號的字串,且長度為 52 個字元。",
|
||||
"The entered node ID does not look valid. It should be a 52 or 56 character string consisting of letters and numbers, with spaces and dashes being optional.": "輸入的節點識別碼似乎無效。它應該為一串包含英文字母及數字,並可能會含有空白或連接符號的字串,且長度為 52 或 56 個字元。",
|
||||
"The node ID cannot be blank.": "節點識別碼不能為空白。",
|
||||
"The node ID to enter here can be found in the \"Edit > Show ID\" dialog on the other node. Spaces and dashes are optional (ignored).": "要輸入在這裡的節點識別碼可以在其他節點的 \"編輯 > 顯示識別碼\" 對話框找到。空白以及連接符號可不輸入 (忽略)",
|
||||
"The number of old versions to keep, per file.": "每個檔案要保留的舊版本數量。",
|
||||
"The number of versions must be a number and cannot be blank.": "每個檔案要保留的舊版本數量必須是數字且不能為空白。",
|
||||
"The repository ID cannot be blank.": "儲存庫識別碼不能為空白。",
|
||||
"The repository ID must be a short identifier (64 characters or less) consisting of letters, numbers and the the dot (.), dash (-) and underscode (_) characters only.": "儲存庫識別碼必須為一段只包含英文字母、半形數字、點 (.)、連接符號 (-) 以及底線 (_) 的簡短的識別碼 (不多於 64 個字元)",
|
||||
"The repository ID must be unique.": "儲存庫識別碼必須為唯一的。",
|
||||
"The repository path cannot be blank.": "儲存庫路徑不能空白。",
|
||||
"Unknown": "未知",
|
||||
"Up to Date": "最新",
|
||||
"Upgrade To {%version%}": "升級到 {{version}}",
|
||||
"Upgrading": "正在升級",
|
||||
"Upload Rate": "上載速率",
|
||||
"Usage": "使用",
|
||||
"Use Compression": "使用壓縮",
|
||||
"Use HTTPS for GUI": "為 GUI 使用 HTTPS",
|
||||
"Version": "版本",
|
||||
"When adding a new node, keep in mind that this node must be added on the other side too.": "當新增一個節點時,請記住,這個節點也必須添加至另一邊。",
|
||||
"When adding a new repository, keep in mind that the Repository ID is used to tie repositories together between nodes. They are case sensitive and must match exactly between all nodes.": "當新增一個儲存庫時,請記住,儲存庫識別碼是用來將節點之間的儲存庫綁定在一起的。它們有區分大小寫,且必須在所有節點之間完全相同。",
|
||||
"Yes": "是",
|
||||
"You must keep at least one version.": "您必須保留至少一個版本。",
|
||||
"items": "個物件"
|
||||
}
|
@ -1 +1 @@
|
||||
var validLangs = ["da","de","el","en","es","fr","hu","it","nl","pt","ru","sv","tr","uk"]
|
||||
var validLangs = ["da","de","el","en","es","fr","hu","it","nl","pt-PT","ru","sv","tr","uk","zh-TW"]
|
||||
|
Loading…
Reference in New Issue
Block a user