From 78448a44c945a8008d7d13439eb6f0c06d19cefc Mon Sep 17 00:00:00 2001 From: Jaye Evins Date: Fri, 16 Jan 2026 14:17:36 -0500 Subject: [PATCH] Replace TRANSLATION_FILES.txt cmake include file with LINGUAS file (#287) Generate lists of translation (.ts) files by reading LINGUAS in CMake. --- translations/CMakeLists.txt | 15 ++++- translations/LINGUAS | 44 +++++++++++++++ translations/TRANSLATION_FILES.txt | 89 ------------------------------ 3 files changed, 58 insertions(+), 90 deletions(-) create mode 100644 translations/LINGUAS delete mode 100644 translations/TRANSLATION_FILES.txt diff --git a/translations/CMakeLists.txt b/translations/CMakeLists.txt index 219d77f..d5fe9f1 100644 --- a/translations/CMakeLists.txt +++ b/translations/CMakeLists.txt @@ -1,10 +1,23 @@ +#=========================================== +# Create list of ts files from LINGUAS file +#=========================================== +function (expand_linguas out_var linguas_file basename) + + file (STRINGS ${linguas_file} codes REGEX "^[^#].*$") + list (TRANSFORM codes REPLACE "\(.+\)" "${basename}_\\1.ts" OUTPUT_VARIABLE filenames) + set (${out_var} ${filenames} PARENT_SCOPE) + +endfunction () + + #======================================= # Translation files #======================================= # without this a "make clean" would delete the .ts files set_directory_properties (PROPERTIES CLEAN_NO_CUSTOM 1) -include (TRANSLATION_FILES.txt) +expand_linguas (GLABELS_TS_FILES "LINGUAS" "glabels") +expand_linguas (TEMPLATES_TS_FILES "LINGUAS" "templates") # # Update strings in C-locale translation files (lupdate+lrelease) diff --git a/translations/LINGUAS b/translations/LINGUAS new file mode 100644 index 0000000..70e0f92 --- /dev/null +++ b/translations/LINGUAS @@ -0,0 +1,44 @@ +############################################################ +# +# gLabels-qt application and template translations +# +# Please keep this file sorted. +# +############################################################ +ar +bs +ca +cs +da +de +el +en_GB +eo +es +fi +fr +gl +hu +id +it +ja +ko +lv +nb +nl +oc +pl +pt_BR +pt +ro +ru +sk +sl +sr@latin +sr +sv +tr +uk +zh_CN +zh_HK +zh_TW diff --git a/translations/TRANSLATION_FILES.txt b/translations/TRANSLATION_FILES.txt deleted file mode 100644 index 22e9eac..0000000 --- a/translations/TRANSLATION_FILES.txt +++ /dev/null @@ -1,89 +0,0 @@ -############################################################ -# -# gLabels Translation Files -# -############################################################ -set (GLABELS_TS_FILES - glabels_ar.ts - glabels_bs.ts - glabels_ca.ts - glabels_cs.ts - glabels_da.ts - glabels_de.ts - glabels_el.ts - glabels_en_GB.ts - glabels_eo.ts - glabels_es.ts - glabels_fi.ts - glabels_fr.ts - glabels_gl.ts - glabels_hu.ts - glabels_id.ts - glabels_it.ts - glabels_ja.ts - glabels_ko.ts - glabels_lv.ts - glabels_nb.ts - glabels_nl.ts - glabels_oc.ts - glabels_pl.ts - glabels_pt_BR.ts - glabels_pt.ts - glabels_ro.ts - glabels_ru.ts - glabels_sk.ts - glabels_sl.ts - glabels_sr@latin.ts - glabels_sr.ts - glabels_sv.ts - glabels_tr.ts - glabels_uk.ts - glabels_zh_CN.ts - glabels_zh_HK.ts - glabels_zh_TW.ts -) - -############################################################ -# -# Translation Files for Product Template Database -# -############################################################ -set (TEMPLATES_TS_FILES - templates_ar.ts - templates_bs.ts - templates_ca.ts - templates_cs.ts - templates_da.ts - templates_de.ts - templates_el.ts - templates_en_GB.ts - templates_eo.ts - templates_es.ts - templates_fi.ts - templates_fr.ts - templates_gl.ts - templates_hu.ts - templates_id.ts - templates_it.ts - templates_ja.ts - templates_ko.ts - templates_lv.ts - templates_nb.ts - templates_nl.ts - templates_oc.ts - templates_pt_BR.ts - templates_pt.ts - templates_ro.ts - templates_ru.ts - templates_sk.ts - templates_sl.ts - templates_sr@latin.ts - templates_sr.ts - templates_sv.ts - templates_tr.ts - templates_uk.ts - templates_zh_CN.ts - templates_zh_HK.ts - templates_zh_TW.ts -) -