Skip to content

Commit 942f600

Browse files
committed
build: move update-translations in script
1 parent f5751ee commit 942f600

File tree

5 files changed

+34
-17
lines changed

5 files changed

+34
-17
lines changed

.github/workflows/update-translation.yml .github/workflows/update-translations.yml

+3-12
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
workflow_dispatch:
1010
workflow_call:
1111

12-
name: Update Translation
12+
name: Update Translations
1313

1414
concurrency:
1515
group: ${{ github.workflow }}-${{ github.ref }}
@@ -35,18 +35,9 @@ jobs:
3535
git config --local user.email "github-actions[bot]@users.noreply.github.com"
3636
git config --local user.name "github-actions[bot]"
3737
38-
- name: Generate zh_Hant from zh_Hans
38+
- name: Update translations
3939
run: |
40-
cat ./crates/rnote-ui/po/LINGUAS \
41-
| sed -e 's|zh_Hans|zh_Hans\nzh_CN\nzh_SG|' \
42-
-e 's|zh_Hant|zh_Hant\nzh_HK\nzh_TW|' \
43-
| sort -uo ./crates/rnote-ui/po/LINGUAS
44-
45-
cat ./crates/rnote-ui/po/zh_Hans.po \
46-
| sed -e 's|Language: zh_Hans|Language: zh_Hant|' \
47-
-e 's|Last-Translator:|Last-Translator: openCC converted|' \
48-
| opencc -c /usr/share/opencc/s2twp.json \
49-
-o ./crates/rnote-ui/po/zh_Hant.po
40+
bash ./build-aux/update-translations.sh
5041
5142
- name: Commit changes
5243
id: commit-changes

MAINTAINING.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,12 @@ unlock the weblate repo to resynchronize with upstream.
9696

9797
## Update the "Chinese Traditional" Translation (zh_Hant.po) Manually
9898

99+
The package providing the `opencc` tool (`opencc-tools` on Fedora) needs to be installed to regenerate the translation.
100+
99101
To autogenerate chinese traditional translation (`zh_Hant`) from chinese simplified (`zh_Hans`), use opencc:
100102

101103
```bash
102-
opencc -i crates/rnote-ui/po/zh_Hans.po -o crates/rnote-ui/po/zh_Hant.po -c /usr/share/opencc/s2twp.json
104+
./build-aux/update-translations.sh
103105
```
104106

105107
discussed in [issue 220](https://github.com/flxzt/rnote/issues/220)

build-aux/update-translations.sh

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env bash
2+
3+
script_dir=$(dirname "$0")
4+
5+
if ! command -v opencc &> /dev/null
6+
then
7+
echo "The 'opencc' tool needs to be installed and present in PATH"
8+
exit 1
9+
fi
10+
11+
12+
# Regenerate 'zh_Hant' translation from 'zh_Hans'
13+
sed \
14+
-e 's|zh_Hans|zh_Hans\nzh_CN\nzh_SG|' \
15+
-e 's|zh_Hant|zh_Hant\nzh_HK\nzh_TW|' \
16+
"${script_dir}/../crates/rnote-ui/po/LINGUAS" \
17+
| sort -uo "${script_dir}/../crates/rnote-ui/po/LINGUAS"
18+
19+
sed \
20+
-e 's|Language: zh_Hans|Language: zh_Hant|' \
21+
-e 's|Last-Translator:|Last-Translator: openCC converted|' \
22+
"${script_dir}/../crates/rnote-ui/po/zh_Hans.po" \
23+
| opencc -c /usr/share/opencc/s2twp.json \
24+
-o "${script_dir}/../crates/rnote-ui/po/zh_Hant.po"

crates/rnote-ui/po/LINGUAS

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ tr
3030
uk
3131
vi
3232
zh_CN
33-
zh_HK
3433
zh_Hans
3534
zh_Hant
35+
zh_HK
3636
zh_SG
3737
zh_TW

crates/rnote-ui/po/zh_Hant.po

+3-3
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,7 @@ msgid ""
842842
"when this switch is off/on"
843843
msgstr ""
844844
"按住Ctrl鍵可暫時\n"
845-
"啟用/禁用約束條件\n"
845+
"啟用/停用約束條件\n"
846846
"當此開關被關閉/開啟時"
847847

848848
#: crates/rnote-ui/data/ui/penssidebar/shaperpage.ui:327
@@ -1088,7 +1088,7 @@ msgstr "使用觸控繪製 [_T]"
10881088

10891089
#: crates/rnote-ui/data/ui/canvasmenu.ui:59
10901090
msgid "Block Pinch to _Zoom"
1091-
msgstr "禁用雙指縮放 [_Z]"
1091+
msgstr "停用雙指縮放 [_Z]"
10921092

10931093
#: crates/rnote-ui/data/ui/canvasmenu.ui:90
10941094
#: crates/rnote-ui/data/ui/shortcuts.ui:132
@@ -1254,7 +1254,7 @@ msgid ""
12541254
"gets disabled."
12551255
msgstr ""
12561256
"設定畫布上的觸控滾動是否為慣性滾動。\n"
1257-
"當這個選項被禁用時,\n"
1257+
"當這個選項被停用時,\n"
12581258
"應用程式需要重新啟動。"
12591259

12601260
#: crates/rnote-ui/data/ui/settingspanel.ui:72

0 commit comments

Comments
 (0)