Update instructions about NSIS packaging

Include a helper a script to gather valid Qt translations for packaging.
This commit is contained in:
sledgehammer999 2022-03-26 15:09:20 +02:00
parent 01206a0e2e
commit f35d94d98e
No known key found for this signature in database
GPG key ID: 6E4A2D025B7CC9A2
2 changed files with 37 additions and 4 deletions

View file

@ -38,10 +38,12 @@ installer-translations
translations translations
qt_ar.qm qt_ar.qm
... ...
(all the .qm files found in the 'translations' folder of your Qt install. Those files differ between Qt4 and Qt5. (All the .qm files found in the 'translations' folder of your Qt install. Those files differ between Qt5 and Qt6.
If you want to distribute Qt4 translations it is better to use the ones found in this repo under the path "dist/qt-translations". You will need the files that conform to this globbing expression 'qt_??.qm qt_??_??.qm qtbase_??.qm qtbase_??_??.qm'.
They contain extra languages not distributed via the official qt4 sources. Some of those files will be stubs. Filter any file that is smaller than 10KB in size.
Don't forget to edit the filelist in installer.nsi + uninstaller.nsi to include all your .qm files.) Alternatively you can use the 'gather_qt_translations.py' script found in the same folder as this file.
Run it with '--help' to see its usage.
**YOU MUST** edit the list of .qm files in the 'installer.nsi' to match whatever files are in the 'translations' subfolder.)
qt_zh_TW.qm qt_zh_TW.qm
installer.nsi installer.nsi
license.txt license.txt

31
dist/windows/gather_qt_translations.py vendored Normal file
View file

@ -0,0 +1,31 @@
#!/usr/bin/env python3
import argparse
import glob
import os
import shutil
import sys
from typing import List
def isNotStub(path: str) -> bool:
return (os.path.getsize(path) >= (10 * 1024))
def main() -> int:
parser = argparse.ArgumentParser(description='Gather valid Qt translations for NSIS packaging.')
parser.add_argument("qt_translations_folder", help="Qt's translations folder")
parser.add_argument("nsis_packaging_folder", help="NSIS packaging translations folder")
args = parser.parse_args()
tmp_translations: List[str] = glob.glob(f'{args.qt_translations_folder}/qt_??.qm')
tmp_translations += glob.glob(f'{args.qt_translations_folder}/qt_??_??.qm')
tmp_translations += glob.glob(f'{args.qt_translations_folder}/qtbase_??.qm')
tmp_translations += glob.glob(f'{args.qt_translations_folder}qtbase_??_??.qm')
filtered = filter(isNotStub, tmp_translations)
for file in filtered:
shutil.copy2(file, args.nsis_packaging_folder)
return 0
if __name__ == '__main__':
sys.exit(main())