Browse Source

Merge pull request #16745 from sledgehammer999/drop_qt_translations_folder

Drop qt translations folder
adaptive-webui-19844
sledgehammer999 3 years ago committed by GitHub
parent
commit
95f3073e6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 25
      cmake/Modules/FindQtTranslations.cmake
  2. BIN
      dist/qt-translations/qt_fa.qm
  3. BIN
      dist/qt-translations/qt_gl.qm
  4. BIN
      dist/qt-translations/qt_lt.qm
  5. BIN
      dist/qt-translations/qt_pt.qm
  6. BIN
      dist/qt-translations/qt_sl.qm
  7. BIN
      dist/qt-translations/qt_sv.qm
  8. BIN
      dist/qt-translations/qt_zh_CN.qm
  9. BIN
      dist/qt-translations/qtbase_ar.qm
  10. BIN
      dist/qt-translations/qtbase_bg.qm
  11. BIN
      dist/qt-translations/qtbase_ca.qm
  12. BIN
      dist/qt-translations/qtbase_cs.qm
  13. BIN
      dist/qt-translations/qtbase_da.qm
  14. BIN
      dist/qt-translations/qtbase_de.qm
  15. BIN
      dist/qt-translations/qtbase_es.qm
  16. BIN
      dist/qt-translations/qtbase_fi.qm
  17. BIN
      dist/qt-translations/qtbase_fr.qm
  18. BIN
      dist/qt-translations/qtbase_gd.qm
  19. BIN
      dist/qt-translations/qtbase_he.qm
  20. BIN
      dist/qt-translations/qtbase_hu.qm
  21. BIN
      dist/qt-translations/qtbase_it.qm
  22. BIN
      dist/qt-translations/qtbase_ja.qm
  23. BIN
      dist/qt-translations/qtbase_ko.qm
  24. BIN
      dist/qt-translations/qtbase_lv.qm
  25. BIN
      dist/qt-translations/qtbase_pl.qm
  26. BIN
      dist/qt-translations/qtbase_ru.qm
  27. BIN
      dist/qt-translations/qtbase_sk.qm
  28. BIN
      dist/qt-translations/qtbase_tr.qm
  29. BIN
      dist/qt-translations/qtbase_uk.qm
  30. BIN
      dist/qt-translations/qtbase_zh_TW.qm
  31. 10
      dist/windows/README.txt
  32. 31
      dist/windows/gather_qt_translations.py
  33. 32
      macxconf.pri
  34. 24
      src/app/CMakeLists.txt

25
cmake/Modules/FindQtTranslations.cmake

@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
# Return Qt translations files as list of paths
# It will return .qm files of qt/qtbase that aren't stub files.
# Requires that Qt has been found first because it depends on qmake being available
function(qbt_get_qt_translations qt_translations)
get_target_property(QT_QMAKE_EXECUTABLE Qt::qmake IMPORTED_LOCATION)
execute_process(COMMAND "${QT_QMAKE_EXECUTABLE}" -query QT_INSTALL_TRANSLATIONS
OUTPUT_VARIABLE QT_TRANSLATIONS_DIR OUTPUT_STRIP_TRAILING_WHITESPACE)
FILE(GLOB QT_TEMP_TRANSLATIONS CONFIGURE_DEPENDS
"${QT_TRANSLATIONS_DIR}/qt_??.qm"
"${QT_TRANSLATIONS_DIR}/qt_??_??.qm"
"${QT_TRANSLATIONS_DIR}/qtbase_??.qm"
"${QT_TRANSLATIONS_DIR}/qtbase_??_??.qm")
foreach(TRANSLATION ${QT_TEMP_TRANSLATIONS})
FILE(SIZE "${TRANSLATION}" translation_size)
# Consider files less than 10KB as stub translations
if (translation_size GREATER_EQUAL 10240)
list(APPEND QT_FINAL_TRANSLATIONS "${TRANSLATION}")
endif()
endforeach()
SET(${qt_translations} ${QT_FINAL_TRANSLATIONS} PARENT_SCOPE)
endfunction()

BIN
dist/qt-translations/qt_fa.qm vendored

Binary file not shown.

BIN
dist/qt-translations/qt_gl.qm vendored

Binary file not shown.

BIN
dist/qt-translations/qt_lt.qm vendored

Binary file not shown.

BIN
dist/qt-translations/qt_pt.qm vendored

Binary file not shown.

BIN
dist/qt-translations/qt_sl.qm vendored

Binary file not shown.

BIN
dist/qt-translations/qt_sv.qm vendored

Binary file not shown.

BIN
dist/qt-translations/qt_zh_CN.qm vendored

Binary file not shown.

BIN
dist/qt-translations/qtbase_ar.qm vendored

Binary file not shown.

BIN
dist/qt-translations/qtbase_bg.qm vendored

Binary file not shown.

BIN
dist/qt-translations/qtbase_ca.qm vendored

Binary file not shown.

BIN
dist/qt-translations/qtbase_cs.qm vendored

Binary file not shown.

BIN
dist/qt-translations/qtbase_da.qm vendored

Binary file not shown.

BIN
dist/qt-translations/qtbase_de.qm vendored

Binary file not shown.

BIN
dist/qt-translations/qtbase_es.qm vendored

Binary file not shown.

BIN
dist/qt-translations/qtbase_fi.qm vendored

Binary file not shown.

BIN
dist/qt-translations/qtbase_fr.qm vendored

Binary file not shown.

BIN
dist/qt-translations/qtbase_gd.qm vendored

Binary file not shown.

BIN
dist/qt-translations/qtbase_he.qm vendored

Binary file not shown.

BIN
dist/qt-translations/qtbase_hu.qm vendored

Binary file not shown.

BIN
dist/qt-translations/qtbase_it.qm vendored

Binary file not shown.

BIN
dist/qt-translations/qtbase_ja.qm vendored

Binary file not shown.

BIN
dist/qt-translations/qtbase_ko.qm vendored

Binary file not shown.

BIN
dist/qt-translations/qtbase_lv.qm vendored

Binary file not shown.

BIN
dist/qt-translations/qtbase_pl.qm vendored

Binary file not shown.

BIN
dist/qt-translations/qtbase_ru.qm vendored

Binary file not shown.

BIN
dist/qt-translations/qtbase_sk.qm vendored

Binary file not shown.

BIN
dist/qt-translations/qtbase_tr.qm vendored

Binary file not shown.

BIN
dist/qt-translations/qtbase_uk.qm vendored

Binary file not shown.

BIN
dist/qt-translations/qtbase_zh_TW.qm vendored

Binary file not shown.

10
dist/windows/README.txt vendored

@ -38,10 +38,12 @@ installer-translations @@ -38,10 +38,12 @@ installer-translations
translations
qt_ar.qm
...
(all the .qm files found in the 'translations' folder of your Qt install. Those files differ between Qt4 and Qt5.
If you want to distribute Qt4 translations it is better to use the ones found in this repo under the path "dist/qt-translations".
They contain extra languages not distributed via the official qt4 sources.
Don't forget to edit the filelist in installer.nsi + uninstaller.nsi to include all your .qm files.)
(All the .qm files found in the 'translations' folder of your Qt install. Those files differ between Qt5 and Qt6.
You will need the files that conform to this globbing expression 'qt_??.qm qt_??_??.qm qtbase_??.qm qtbase_??_??.qm'.
Some of those files will be stubs. Filter any file that is smaller than 10KB in size.
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
installer.nsi
license.txt

31
dist/windows/gather_qt_translations.py vendored

@ -0,0 +1,31 @@ @@ -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())

32
macxconf.pri

@ -7,13 +7,31 @@ else { @@ -7,13 +7,31 @@ else {
include(conf.pri)
}
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.14
# Custom function
# Return Qt translations files as list of paths
# It will return .qm files of qt/qtbase that aren't stub files.
defineReplace(qbt_get_qt_translations) {
# The $$[] syntax queries qmake properties
TMP_TRANSLATIONS = $$files($$[QT_INSTALL_TRANSLATIONS]/qt_??.qm)
TMP_TRANSLATIONS += $$files($$[QT_INSTALL_TRANSLATIONS]/qt_??_??.qm)
TMP_TRANSLATIONS += $$files($$[QT_INSTALL_TRANSLATIONS]/qtbase_??.qm)
TMP_TRANSLATIONS += $$files($$[QT_INSTALL_TRANSLATIONS]/qtbase_??_??.qm)
# Consider files less than 10KB as stub translations
for (TRANSLATION, TMP_TRANSLATIONS) {
TRANSLATION_SIZE = $$system("stat -f%z $${TRANSLATION}", true, EXIT_STATUS)
equals(EXIT_STATUS, 0):!lessThan(TRANSLATION_SIZE, 10240): FINAL_TRANSLATIONS += $${TRANSLATION}
}
return($$FINAL_TRANSLATIONS)
}
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.15
DEFINES += _DARWIN_FEATURE_64_BIT_INODE
LIBS += -framework Carbon -framework IOKit -framework AppKit
QT_LANG_PATH = ../dist/qt-translations
DIST_PATH = ../dist/mac
document_icon.path = Contents/Resources
@ -25,15 +43,7 @@ qt_conf.files = $$DIST_PATH/qt.conf @@ -25,15 +43,7 @@ qt_conf.files = $$DIST_PATH/qt.conf
QMAKE_BUNDLE_DATA += qt_conf
qt_translations.path = Contents/translations
qt_translations.files = $$files($$QT_LANG_PATH/qtbase_*.qm)
qt_translations.files += \
$$QT_LANG_PATH/qt_fa.qm \
$$QT_LANG_PATH/qt_gl.qm \
$$QT_LANG_PATH/qt_lt.qm \
$$QT_LANG_PATH/qt_pt.qm \
$$QT_LANG_PATH/qt_sl.qm \
$$QT_LANG_PATH/qt_sv.qm \
$$QT_LANG_PATH/qt_zh_CN.qm
qt_translations.files = $$qbt_get_qt_translations()
QMAKE_BUNDLE_DATA += qt_translations
ICON = $$DIST_PATH/qbittorrent_mac.icns

24
src/app/CMakeLists.txt

@ -16,11 +16,6 @@ if (WEBUI) @@ -16,11 +16,6 @@ if (WEBUI)
"${qBittorrent_BINARY_DIR}/src/webui/www/translations/webui_translations.qrc" COPYONLY)
endif()
FILE(GLOB QT_TRANSLATIONS "${qBittorrent_SOURCE_DIR}/dist/qt-translations/qtbase_*.qm")
foreach(EXTRA_TRANSLATION IN ITEMS "fa" "gl" "lt" "pt" "sl" "sv" "zh_CN")
list(APPEND QT_TRANSLATIONS "${qBittorrent_SOURCE_DIR}/dist/qt-translations/qt_${EXTRA_TRANSLATION}.qm")
endforeach()
# Executable target configuration
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
@ -65,16 +60,17 @@ endif() @@ -65,16 +60,17 @@ endif()
# Additional platform specific configuration
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
set_source_files_properties(${QT_TRANSLATIONS} PROPERTIES MACOSX_PACKAGE_LOCATION translations)
set_source_files_properties(
"${qBittorrent_SOURCE_DIR}/dist/mac/qt.conf"
"${qBittorrent_SOURCE_DIR}/dist/mac/qBitTorrentDocument.icns"
"${qBittorrent_SOURCE_DIR}/dist/mac/qbittorrent_mac.icns"
PROPERTIES
MACOSX_PACKAGE_LOCATION Resources
)
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
include(FindQtTranslations)
qbt_get_qt_translations(QT_TRANSLATIONS)
set_source_files_properties(${QT_TRANSLATIONS} PROPERTIES MACOSX_PACKAGE_LOCATION translations)
set_source_files_properties(
"${qBittorrent_SOURCE_DIR}/dist/mac/qt.conf"
"${qBittorrent_SOURCE_DIR}/dist/mac/qBitTorrentDocument.icns"
"${qBittorrent_SOURCE_DIR}/dist/mac/qbittorrent_mac.icns"
PROPERTIES
MACOSX_PACKAGE_LOCATION Resources
)
# provide variables for substitution in dist/mac/Info.plist
get_target_property(EXECUTABLE_NAME qbt_app OUTPUT_NAME)
# This variable name should be changed once qmake is no longer used. Refer to the discussion in PR #14813

Loading…
Cancel
Save