Skip to content

Commit f4a88e3

Browse files
committedMar 15, 2022
Switch to Regional Language Codes
This patch updates the translations to be able to use regional language codes in order to be able to distinguish between languages like Traditional Chinese and Simplified Chinese or Swiss German, Lower German and High German.
1 parent 4dba0f0 commit f4a88e3

13 files changed

+200
-194
lines changed
 

‎.crowdin.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ base_path: .
44
preserve_hierarchy: true
55

66
files:
7-
- source: /src/i18n/locales/en.json
8-
translation: /src/i18n/locales/%two_letters_code%.json
7+
- source: /src/i18n/locales/en-US.json
8+
translation: /src/i18n/locales/%locale%.json

‎.github/workflows/update-translations.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
working-directory: src/i18n/locales
3636
run: |
3737
echo -n '[ "' > locales.json
38-
echo -n ??.json | sed 's/ */", "/g' >> locales.json
38+
echo -n ??-??.json | sed 's/ */", "/g' >> locales.json
3939
echo '" ]' >> locales.json
4040
4141
- name: upload translations

‎crowdin.yml

-3
This file was deleted.

‎src/i18n/config.tsx

+13-4
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,27 @@ const debug = Boolean(new URLSearchParams(window.location.search).get('debug'));
99
const resources: any = {};
1010
for (const lang of locales) {
1111
const code = lang.replace(/\..*$/, '');
12+
const short = code.replace(/-.*$/, '');
13+
const main = locales.filter(l => l.indexOf(short) === 0).length === 1
1214
import('./locales/' + lang)
1315
.then(translations => {
14-
resources[code] = { translation: translations };
16+
if (!main) {
17+
resources[code] = { translation: translations };
18+
}
19+
resources[short] = { translation: translations };
1520
})
1621
}
1722

18-
console.warn(typeof resources);
19-
2023
i18n.use(initReactI18next)
2124
.use(LanguageDetector)
2225
.init({
2326
resources,
24-
fallbackLng: 'en',
27+
fallbackLng: 'en-US',
28+
nonExplicitSupportedLngs: true,
2529
debug: debug,
2630
});
31+
32+
if (debug) {
33+
console.debug('language', i18n.language);
34+
console.debug('languages', i18n.languages);
35+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

‎src/i18n/locales/locales.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
[ "de.json", "en.json", "es.json", "fr.json", "ja.json", "nl.json", "pt.json" ]
1+
[ "de-DE.json", "en-US.json", "es-ES.json", "fr-FR.json", "nl-NL.json", "zh-CN.json", "zh-TW.json" ]
File renamed without changes.

‎src/i18n/locales/pt.json

-183
This file was deleted.
File renamed without changes.

‎src/i18n/locales/zh-TW.json

+183
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
{
2+
"mainMenu": {
3+
"cutting-button": "裁剪",
4+
"finish-button": "完成",
5+
"select-tracks-button": "追蹤",
6+
"thumbnail-button": "縮圖",
7+
"metadata-button": "後設資料",
8+
"tooltip-aria": "主導航"
9+
},
10+
"cuttingActions": {
11+
"cut-button": "裁剪",
12+
"cut-tooltip": "在當前清除器位置分割區段。 熱鍵:{{hotkeyName}}",
13+
"cut-tooltip-aria": "裁剪。在當前清除器位置分割區段。 熱鍵:{{hotkeyName}}",
14+
"delete-button": "刪除",
15+
"delete-restore-tooltip": "在當前位置標記或取消標記要刪除的區段。 熱鍵:{{hotkeyName}}",
16+
"delete-restore-tooltip-aria": "刪除或還原。 在當前位置標記或取消標記要刪除的區段。 熱鍵:{{hotKeyName}}。",
17+
"restore-button": "還原",
18+
"mergeLeft-button": "左合併",
19+
"mergeLeft-tooltip": "將當前活動區段與其左側的區段合併。 熱鍵:{{hotkeyName}}",
20+
"mergeLeft-tooltip-aria": "左合併。 將當前活動區段與其左側的區段合併。 熱鍵:{{hotkeyName}}。",
21+
"mergeRight-button": "右合併",
22+
"mergeRight-tooltip": "將當前活動區段與其右側的區段合併。 熱鍵:{{hotkeyName}}",
23+
"mergeRight-tooltip-aria": "右合併。將當前活動區段與其右側的區段合併。 熱鍵:{{hotkeyName}}"
24+
},
25+
"video": {
26+
"previewButton": "預覽模式",
27+
"previewButton-tooltip": "播放影片時跳過已刪除的片段。 當前 {{status}}。 熱鍵:{{hotkeyName}}",
28+
"previewButton-aria": "啟用或禁用預覽模式。 熱鍵:{{hotkeyName}}。",
29+
"playButton-tooltip": "播放按鈕",
30+
"time-duration-tooltip": "播放時間和持續時間",
31+
"duration-aria": "持續時間",
32+
"time-aria": "目前時間",
33+
"comError-text": "與 Opencast 通訊時出現問題。",
34+
"loadError-text": "載入此影片時出現錯誤。",
35+
"title-tooltip": "影片標題",
36+
"presenter-tooltip": "影片簡報者",
37+
"controls-tooltip": "影片控制"
38+
},
39+
"finishMenu": {
40+
"save-button": "儲存變更",
41+
"start-button": "開始處理",
42+
"discard-button": "放棄變更"
43+
},
44+
"save": {
45+
"headline-text": "儲存目前專案",
46+
"confirm-button": "是的,儲存變更",
47+
"confirmButton-default-tooltip": "儲存按鈕",
48+
"confirmButton-attempting-tooltip": "嘗試儲存",
49+
"confirmButton-success-tooltip": "儲存成功",
50+
"confirmButton-failed-tooltip": "儲存失敗",
51+
"info-text": "影片不會被處理,但所有裁剪訊息都將存儲在 Opencast 中。 您可以稍後繼續編輯。",
52+
"success-text": "變更儲存成功",
53+
"success-tooltip-aria": "儲存成功",
54+
"saveArea-tooltip": "儲存區域"
55+
},
56+
"discard": {
57+
"headline-text": "放棄變更",
58+
"confirm-button": "是的,放棄變更",
59+
"confirm-tooltip": "放棄變更按鈕",
60+
"info-text": "放棄您所做的所有更改? 這不能被還原!"
61+
},
62+
"theEnd": {
63+
"discarded-text": "您的所有更改現在都已經遺失。 您現在可以關閉編輯器。",
64+
"startOver-button": "讓我重新開始!",
65+
"startOver-tooltip": "重新載入頁面以重新開始",
66+
"info-text": "更改已成功儲存到 Opencast。 處理您的更改最多可能需要 {{duration}} 小時。 您現在可以關閉編輯器。\n"
67+
},
68+
"workflowSelection": {
69+
"saveAndProcess-text": "儲存和處理",
70+
"selectWF-text": "選擇工作流程",
71+
"noWorkflows-text": "出現問題,沒有用於處理您的更改的工作流程。<3/> 請儲存您的更改並聯繫 Opencast 管理員。\n",
72+
"oneWorkflow-text": "影片將使用工作流程“{{workflow}}”進行裁剪和處理。 <3/> 這需要一些時間。\n",
73+
"manyWorkflows-text": "選擇 Opencast 應該使用哪個工作流程進行處理。",
74+
"startProcessing-button": "開始處理",
75+
"back-button": "回到上一步",
76+
"selectWF-button": "單擊以選擇此工作流程",
77+
"selectWF-button-aria": "按下要選擇的工作流程:{{stateName}}\n"
78+
},
79+
"timeline": {
80+
"generateWaveform-text": "生成波形",
81+
"segment-tooltip": "片段{{segment}}",
82+
"scrubber-text-aria": "清除器。 {{currentTime}}。 活動片段:{{segment}}。{{segmentStatus}}。 控制:{{moveLeft}} 和 {{moveRight}} 移動清除器。 {{increase}} 和 {{decrease}} 增加/減少移動增量。\n",
83+
"segments-text-aria": "片段 {{index}}. {{segmentStatus}}. 開始: {{start}}. 結束: {{end}}.\n"
84+
},
85+
"workflowConfig": {
86+
"headline-text": "工作流程配置",
87+
"area-tooltip": "工作流程配置區域",
88+
"satisfied-text": "對您的配置滿意嗎?",
89+
"confirm-button": "是的,開始處理"
90+
},
91+
"metadata": {
92+
"EVENTS-EVENTS-DETAILS-CATALOG-EPISODE": "劇集後設資料",
93+
"submit-button": "提交",
94+
"submit-button-tooltip": "確認您的變更",
95+
"reset-button": "重置",
96+
"reset-button-tooltip": "取消所有更改",
97+
"submit-helpertext": "根據需要進行更改,然後點擊 {{buttonName}} 按鈕。\n請注意,您仍然必須開始處理才能使更改生效。",
98+
"validation": {
99+
"required": "必須的",
100+
"duration-format": "格式必須為 HH:MM:SS",
101+
"datetime": "不合法"
102+
},
103+
"labels": {
104+
"title": "標題",
105+
"subject": "主旨",
106+
"description": "描述",
107+
"language": "語言",
108+
"rightsHolder": "版權所有人",
109+
"license": "版權",
110+
"isPartOf": "系列",
111+
"creator": "演講者",
112+
"contributor": "貢獻者",
113+
"startDate": "開始日期",
114+
"duration": "持續時間",
115+
"location": "位置",
116+
"source": "來源",
117+
"created": "建立",
118+
"publisher": "發行人",
119+
"identifier": "UID"
120+
},
121+
"language": {
122+
"LANGUAGES-SLOVENIAN": "斯洛文尼亞語",
123+
"LANGUAGES-PORTUGESE": "葡萄牙語",
124+
"LANGUAGES-ROMANSH": "羅曼什語",
125+
"LANGUAGES-ARABIC": "阿拉伯語",
126+
"LANGUAGES-POLISH": "波蘭語",
127+
"LANGUAGES-ITALIAN": "意大利語",
128+
"LANGUAGES-CHINESE": "繁體中文",
129+
"LANGUAGES-FINNISH": "芬蘭語",
130+
"LANGUAGES-DANISH": "丹麥語",
131+
"LANGUAGES-UKRAINIAN": "烏克蘭",
132+
"LANGUAGES-FRENCH": "法語",
133+
"LANGUAGES-SPANISH": "西班牙語",
134+
"LANGUAGES-GERMAN_CH": "瑞士德語",
135+
"LANGUAGES-NORWEGIAN": "挪威",
136+
"LANGUAGES-RUSSIAN": "俄語",
137+
"LANGUAGES-JAPANESE": "日語",
138+
"LANGUAGES-DUTCH": "荷蘭語",
139+
"LANGUAGES-TURKISH": "土耳其語",
140+
"LANGUAGES-HINDI": "印度語",
141+
"LANGUAGES-SWEDISH": "瑞典語",
142+
"LANGUAGES-ENGLISH": "英語",
143+
"LANGUAGES-GERMAN": "德語"
144+
},
145+
"license": {
146+
"EVENTS-LICENSE-CC0": "創作共享 CC0",
147+
"EVENTS-LICENSE-CCBYND": "CC-BY-ND 創作分享-姓名標示-禁止改作",
148+
"EVENTS-LICENSE-CCBYNCND": "創作分享-姓名標示-非商業性使用-禁止改作",
149+
"EVENTS-LICENSE-CCBYNCSA": "創作分享-姓名標示-非商業性使用-相同方式分享",
150+
"EVENTS-LICENSE-ALLRIGHTS": "保留所有權利",
151+
"EVENTS-LICENSE-CCBYSA": "創作分享-姓名標示-相同方式分享",
152+
"EVENTS-LICENSE-CCBYNC": "創作分享-姓名標示-非商業性使用",
153+
"EVENTS-LICENSE-CCBY": "創作分享-姓名標示"
154+
}
155+
},
156+
"error": {
157+
"generic-message": "發生嚴重錯誤!",
158+
"details": "細節: "
159+
},
160+
"landing": {
161+
"main-heading": "歡迎使用影片編輯器",
162+
"contact-admin": "如果您嘗試編輯特定影片但看到此頁面時,請聯繫您的管理員。",
163+
"start-editing-1": "要開始編輯,請指定參數 ",
164+
"start-editing-2": " 使用您要編輯的影片的媒體識別 ID。",
165+
"link-to-documentation": "有關配置影片編輯器的更多信息,請參閱管理指南,網址為 "
166+
},
167+
"various": {
168+
"error-details-text": "詳細訊息:{{errorMessage}}",
169+
"error-noDetails-text": "沒有可用的錯誤詳細訊息。",
170+
"error-text": "發生了錯誤。 請稍等,然後再重試。",
171+
"goBack-button": "不,回到上一步"
172+
},
173+
"trackSelection": {
174+
"description": "選擇或取消選擇用於處理和發佈的軌道。",
175+
"trackInactive": "不活動的",
176+
"deleteTrackText": "刪除軌道",
177+
"restoreTrackText": "還原軌道",
178+
"cannotDeleteTrackText": "無法刪除軌道",
179+
"deleteTrackTooltip": "請勿編碼和發佈此軌道。",
180+
"restoreTrackTooltip": "編碼並發佈此軌道",
181+
"cannotDeleteTrackTooltip": "無法從發佈的影片中刪除此軌道。"
182+
}
183+
}

0 commit comments

Comments
 (0)
Please sign in to comment.