Skip to content

Commit

Permalink
feat(cmake): Compile translations on during build
Browse files Browse the repository at this point in the history
Should be quite quick. This allows removing the binary `*.qm` files from
the source tree and thus reduce of both the size of diffs and the
transferred git object deltas on translation changes.
  • Loading branch information
Holzhaus committed Oct 17, 2024
1 parent c2e1b5f commit c26b89a
Show file tree
Hide file tree
Showing 85 changed files with 50 additions and 1 deletion.
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

# Exclude Transifex files from merging
/res/translations/*.ts merge=ours
/res/translations/*.qm merge=ours

# Treat serato test data as binary
*.octet-stream binary
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,6 @@ src/mixxx.rc.include
src/mixxx.res
src/test/**/*.actual
res/qrc_mixxx.cc

# Ignore translations (now compiled via CMake and removed from git)
res/translations/*.qm
47 changes: 47 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2634,6 +2634,53 @@ elseif(WIN32)
endif()
endif()

# Mixxx translation files
file(GLOB MIXXX_TS_FILES "${CMAKE_CURRENT_SOURCE_DIR}/res/translations/*.ts")
message(VERBOSE "Mixxx translation files: ${MIXXX_TS_FILES}")

if(QT6 AND FALSE)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS LinguistTools)
set_source_files_properties(
${MIXXX_TS_FILES}
PROPERTIES OUTPUT_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/res/translations"
)
qt_add_lrelease(
TS_FILES ${MIXXX_TS_FILES}
LRELEASE_TARGET mixxx-translations
EXCLUDE_FROM_ALL
NO_GLOBAL_TARGET
QM_FILES_OUTPUT_VARIABLE MIXXX_TRANSLATIONS
OPTIONS -nounfinished
)
else()
find_program(LRELEASE_EXECUTABLE "lrelease")
if(LRELEASE_EXECUTABLE)
message(STATUS "Found lrelease: ${LRELEASE_EXECUTABLE}")
else()
message(STATUS "Could NOT find lrelease (missing executable)")
endif()

set(MIXXX_QM_FILES "")
foreach(TS_FILE ${MIXXX_TS_FILES})
string(REGEX REPLACE "[.]ts$" ".qm" QM_FILE "${TS_FILE}")
add_custom_command(
OUTPUT "${QM_FILE}"
DEPENDS "${TS_FILE}"
COMMAND "${LRELEASE_EXECUTABLE}" -nounfinished "${TS_FILE}" -qm "${QM_FILE}"
)
list(APPEND MIXXX_QM_FILES "${QM_FILE}")
endforeach()
add_custom_target(mixxx-translations DEPENDS ${MIXXX_QM_FILES})
endif()
add_dependencies(mixxx mixxx-translations)
install(
FILES
${MIXXX_TRANSLATIONS}
DESTINATION
"${MIXXX_INSTALL_DATADIR}/translations"
)

# Qt translation files
if(APPLE OR WIN32)
# qt_de.qm is just one arbitrary file in the directory that needs to be located;
# there is no particular reason to look for this file versus any other one in the directory.
Expand Down
Binary file removed res/translations/mixxx_ar.qm
Binary file not shown.
Binary file removed res/translations/mixxx_ast.qm
Binary file not shown.
Binary file removed res/translations/mixxx_bg.qm
Binary file not shown.
Binary file removed res/translations/mixxx_br.qm
Binary file not shown.
Binary file removed res/translations/mixxx_bs.qm
Binary file not shown.
Binary file removed res/translations/mixxx_ca.qm
Binary file not shown.
Binary file removed res/translations/mixxx_cs.qm
Binary file not shown.
Binary file removed res/translations/mixxx_da.qm
Binary file not shown.
Binary file removed res/translations/mixxx_de.qm
Binary file not shown.
Binary file removed res/translations/mixxx_el.qm
Binary file not shown.
Binary file removed res/translations/mixxx_en_CA.qm
Binary file not shown.
Binary file removed res/translations/mixxx_en_GB.qm
Binary file not shown.
Binary file removed res/translations/mixxx_eo.qm
Binary file not shown.
Binary file removed res/translations/mixxx_es.qm
Binary file not shown.
Binary file removed res/translations/mixxx_es_419.qm
Binary file not shown.
Binary file removed res/translations/mixxx_es_AR.qm
Binary file not shown.
Binary file removed res/translations/mixxx_es_CO.qm
Binary file not shown.
Binary file removed res/translations/mixxx_es_CR.qm
Binary file not shown.
Binary file removed res/translations/mixxx_es_EC.qm
Binary file not shown.
Binary file removed res/translations/mixxx_es_ES.qm
Binary file not shown.
Binary file removed res/translations/mixxx_es_MX.qm
Binary file not shown.
Binary file removed res/translations/mixxx_es_PA.qm
Binary file not shown.
Binary file removed res/translations/mixxx_es_UY.qm
Binary file not shown.
Binary file removed res/translations/mixxx_et.qm
Binary file not shown.
Binary file removed res/translations/mixxx_eu.qm
Binary file not shown.
Binary file removed res/translations/mixxx_fa.qm
Binary file not shown.
Binary file removed res/translations/mixxx_fi.qm
Binary file not shown.
Binary file removed res/translations/mixxx_fr.qm
Binary file not shown.
Binary file removed res/translations/mixxx_fr_BE.qm
Binary file not shown.
Binary file removed res/translations/mixxx_fr_CA.qm
Binary file not shown.
Binary file removed res/translations/mixxx_fr_CI.qm
Binary file not shown.
Binary file removed res/translations/mixxx_fr_FR.qm
Binary file not shown.
Binary file removed res/translations/mixxx_ga.qm
Binary file not shown.
Binary file removed res/translations/mixxx_gl.qm
Binary file not shown.
Binary file removed res/translations/mixxx_he.qm
Binary file not shown.
Binary file removed res/translations/mixxx_hi_IN.qm
Binary file not shown.
Binary file removed res/translations/mixxx_hr.qm
Binary file not shown.
Binary file removed res/translations/mixxx_hu.qm
Binary file not shown.
Binary file removed res/translations/mixxx_hy.qm
Binary file not shown.
Binary file removed res/translations/mixxx_id.qm
Binary file not shown.
Binary file removed res/translations/mixxx_is.qm
Binary file not shown.
Binary file removed res/translations/mixxx_it.qm
Binary file not shown.
Binary file removed res/translations/mixxx_ja.qm
Binary file not shown.
Binary file removed res/translations/mixxx_ko.qm
Binary file not shown.
Binary file removed res/translations/mixxx_lb.qm
Binary file not shown.
Binary file removed res/translations/mixxx_lt.qm
Binary file not shown.
Binary file removed res/translations/mixxx_lv.qm
Binary file not shown.
Binary file removed res/translations/mixxx_mi.qm
Binary file not shown.
Binary file removed res/translations/mixxx_mk.qm
Binary file not shown.
Binary file removed res/translations/mixxx_ml.qm
Binary file not shown.
Binary file removed res/translations/mixxx_mn.qm
Binary file not shown.
Binary file removed res/translations/mixxx_mr.qm
Binary file not shown.
Binary file removed res/translations/mixxx_ms.qm
Binary file not shown.
Binary file removed res/translations/mixxx_my.qm
Binary file not shown.
Binary file removed res/translations/mixxx_nb.qm
Binary file not shown.
Binary file removed res/translations/mixxx_nl.qm
Binary file not shown.
Binary file removed res/translations/mixxx_nl_BE.qm
Binary file not shown.
Binary file removed res/translations/mixxx_nl_NL.qm
Binary file not shown.
Binary file removed res/translations/mixxx_nn.qm
Binary file not shown.
Binary file removed res/translations/mixxx_oc.qm
Binary file not shown.
Binary file removed res/translations/mixxx_pl.qm
Binary file not shown.
Binary file removed res/translations/mixxx_pt.qm
Binary file not shown.
Binary file removed res/translations/mixxx_pt_BR.qm
Binary file not shown.
Binary file removed res/translations/mixxx_pt_PT.qm
Binary file not shown.
Binary file removed res/translations/mixxx_ro.qm
Binary file not shown.
Binary file removed res/translations/mixxx_ru.qm
Binary file not shown.
Binary file removed res/translations/mixxx_si.qm
Binary file not shown.
Binary file removed res/translations/mixxx_sk.qm
Binary file not shown.
Binary file removed res/translations/mixxx_sl.qm
Binary file not shown.
Binary file removed res/translations/mixxx_sn.qm
Binary file not shown.
Binary file removed res/translations/mixxx_sq_AL.qm
Binary file not shown.
Binary file removed res/translations/mixxx_sr.qm
Binary file not shown.
Binary file removed res/translations/mixxx_sv.qm
Binary file not shown.
Binary file removed res/translations/mixxx_te.qm
Binary file not shown.
Binary file removed res/translations/mixxx_tr.qm
Binary file not shown.
Binary file removed res/translations/mixxx_uk.qm
Binary file not shown.
Binary file removed res/translations/mixxx_uz.qm
Binary file not shown.
Binary file removed res/translations/mixxx_vi.qm
Binary file not shown.
Binary file removed res/translations/mixxx_zh.qm
Binary file not shown.
Binary file removed res/translations/mixxx_zh_CN.qm
Binary file not shown.
Binary file removed res/translations/mixxx_zh_HK.qm
Binary file not shown.
Binary file removed res/translations/mixxx_zh_TW.qm
Binary file not shown.

0 comments on commit c26b89a

Please sign in to comment.