chore: split English TS files

- qml_base.ts is created as a reference point for translators
- qml_en.ts is a minimal overlay translation, providing just the needed
  plural forms
- adjust the script to generate the above TS files
- fixup some leftover qsTrId() calls and the qmake file
This commit is contained in:
Lukáš Tinkl 2022-10-18 23:59:46 +02:00 committed by Lukáš Tinkl
parent 7111879e04
commit 38b6bdbfd3
5 changed files with 14859 additions and 15299 deletions

View File

@ -1,8 +1,9 @@
import xml.etree.ElementTree as ET
import subprocess
import os
# 1) Runs lupdate ../../ui/nim-status-client.pro -target-language en
# 2) Fixups qml_en.ts: ensure each source has translation, otherwise Lokalise can't figure out base words
# 1) Runs lupdate on ../../ui/nim-status-client.pro
# 2) Fixups qml_base.ts: ensure each source has translation, otherwise Lokalise can't figure out base words
#
# usage: `python update-en-ts.py`
@ -23,9 +24,15 @@ def fixupTranslations(enTsFile: str):
if __name__ == "__main__":
p = subprocess.run(['lupdate', '../../ui/nim-status-client.pro', '-target-language', 'en'],
# full base TS file (has to come first as we're targetting the same language)
basefile = "../../ui/i18n/qml_base.ts"
p = subprocess.run(['lupdate', '../../ui/nim-status-client.pro', '-source-language', 'en', '-no-obsolete', '-target-language', 'en_GB', '-ts', basefile],
stdout=subprocess.PIPE, stderr=subprocess.STDOUT, check=True, text=True)
print(p.stdout)
fixupTranslations(basefile)
fixupTranslations('../../ui/i18n/qml_en.ts')
# EN "translation" file, plurals only
enfile = "../../ui/i18n/qml_en.ts"
p = subprocess.run(['lupdate', '../../ui/nim-status-client.pro', '-source-language', 'en', '-pluralonly', '-target-language', 'en_GB', '-ts', enfile],
stdout=subprocess.PIPE, stderr=subprocess.STDOUT, check=True, text=True)
print(p.stdout)

14702
ui/i18n/qml_base.ts Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -842,8 +842,8 @@ Loader {
ConfirmationDialog {
confirmButtonObjectName: "chatButtonsPanelConfirmDeleteMessageButton"
header.title: qsTrId("Confirm deleting this message")
confirmationText: qsTrId("Are you sure you want to delete this message? Be aware that other clients are not guaranteed to delete the message as well.")
header.title: qsTr("Confirm deleting this message")
confirmationText: qsTr("Are you sure you want to delete this message? Be aware that other clients are not guaranteed to delete the message as well.")
height: 260
checkbox.visible: true
executeConfirm: function () {

View File

@ -19,6 +19,7 @@ SOURCES += $$files("$$PWD/*.js", true)
# Other *.ts files will be provided by Lokalise platform
TRANSLATIONS += \
i18n/qml_base.ts \
i18n/qml_en.ts \
OTHER_FILES += $$files("$$PWD/*.qml", true)