Skip to content

Commit ef452b1

Browse files
committed
contrib/push_locale: update qt5->qt6
1 parent 5dad7c5 commit ef452b1

File tree

3 files changed

+32
-8
lines changed

3 files changed

+32
-8
lines changed

.cirrus.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ task:
7777
fingerprint_script: echo Locale && echo $ELECTRUM_IMAGE && cat $ELECTRUM_REQUIREMENTS_CI
7878
install_script:
7979
- apt-get update
80-
- apt-get -y install gettext qttools5-dev-tools
80+
- apt-get -y install gettext qt6-l10n-tools
8181
- pip install -r $ELECTRUM_REQUIREMENTS_CI
8282
- pip install requests
8383
locale_script:

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ $ python3 -m pip install --user -e .
109109

110110
Create translations (optional):
111111
```
112-
$ sudo apt-get install python3-requests gettext qttools5-dev-tools
112+
$ sudo apt-get install python3-requests gettext qt6-l10n-tools
113113
$ ./contrib/pull_locale
114114
```
115115

contrib/push_locale

+30-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#!/usr/bin/env python3
2+
# Dependencies:
3+
# $ sudo apt-get install python3-requests gettext qt6-l10n-tools
4+
25
import os
36
import subprocess
47
import sys
@@ -8,11 +11,32 @@ try:
811
except ImportError as e:
912
sys.exit(f"Error: {str(e)}. Try 'python3 -m pip install --user <module-name>'")
1013

11-
14+
# set cwd
1215
project_root = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
13-
1416
os.chdir(project_root)
1517

18+
# check dependencies are available
19+
try:
20+
subprocess.check_output(["xgettext", "--version"])
21+
subprocess.check_output(["msgcat", "--version"])
22+
except (subprocess.CalledProcessError, OSError) as e2:
23+
raise Exception("missing gettext. Maybe try 'apt install gettext'")
24+
25+
QT_LUPDATE="lupdate"
26+
QT_LCONVERT="lconvert"
27+
try:
28+
subprocess.check_output([QT_LUPDATE, "-version"])
29+
subprocess.check_output([QT_LCONVERT, "-h"])
30+
except (subprocess.CalledProcessError, OSError) as e1:
31+
QT_LUPDATE="/usr/lib/qt6/bin/lupdate" # workaround qt5/qt6 confusion on ubuntu 22.04
32+
QT_LCONVERT="/usr/lib/qt6/bin/lconvert"
33+
try:
34+
subprocess.check_output([QT_LUPDATE, "-version"])
35+
subprocess.check_output([QT_LCONVERT, "-h"])
36+
except (subprocess.CalledProcessError, OSError) as e2:
37+
raise Exception("missing Qt lupdate/convert tools. Maybe try 'apt install qt6-l10n-tools'")
38+
39+
1640
cmd = "find electrum -type f -name '*.py' -o -name '*.kv'"
1741
files = subprocess.check_output(cmd, shell=True)
1842

@@ -38,13 +62,13 @@ with open("electrum/locale/qml.lst", "wb") as f:
3862

3963
print("Found {} QML files to translate".format(len(files.splitlines())))
4064

41-
cmd = "lupdate @electrum/locale/qml.lst -ts electrum/locale/qml.ts"
65+
cmd = [QT_LUPDATE, "@electrum/locale/qml.lst","-ts", "electrum/locale/qml.ts"]
4266
print('Collecting strings')
43-
subprocess.check_output(cmd, shell=True)
67+
subprocess.check_output(cmd)
4468

45-
cmd = "lconvert -of po -o electrum/locale/messages_qml.pot electrum/locale/qml.ts"
69+
cmd = [QT_LCONVERT, "-of", "po", "-o", "electrum/locale/messages_qml.pot", "electrum/locale/qml.ts"]
4670
print('Convert to gettext')
47-
subprocess.check_output(cmd, shell=True)
71+
subprocess.check_output(cmd)
4872

4973
cmd = "msgcat -u -o electrum/locale/messages.pot electrum/locale/messages_gettext.pot electrum/locale/messages_qml.pot"
5074
print('Generate template')

0 commit comments

Comments
 (0)