From 41bb2a3032942780709e9adf66012aca20187352 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mika=C3=ABl=20Capelle?= Date: Fri, 9 Aug 2024 17:44:38 +0200 Subject: [PATCH] Fix issues with translations. --- icons/translations.png | Bin 0 -> 7718 bytes mob.ini | 1 + src/core/conf.cpp | 1 + src/core/conf.h | 1 + src/tasks/translations.cpp | 41 +++++++++++++++++++++++++------------ 5 files changed, 31 insertions(+), 13 deletions(-) create mode 100644 icons/translations.png diff --git a/icons/translations.png b/icons/translations.png new file mode 100644 index 0000000000000000000000000000000000000000..3664bd7905ae4b6f9dedfe62c796592f8d8d464a GIT binary patch literal 7718 zcmb7pcTiK^xAs1V1d;#}x)db}(h;Od(*#7R(g|Gx0s_)Rq$rpZL_m@9iXcsjN>M-} zpnxC*P(Y>IXi~(AN>%B}&HKCG+?nr>`^TNxGi$H4_VcVYYxY@tpV?PztW0=u;y3^R zubHW_9RM(U3IhxWTXdGm^soitq^aF;0M5$-fFuC0!8Re^063=xz#Ihty&M2U!wR0* z8n7KFZ7dy*vZW>^?Lh1^^|xTd7gG9<)0iY7hgS}RM@5Q9XkwPgq@W= z5K?oD$#0w9Zxxg_^s^?z@_sGb1$kST7>mRXRfw?_t_ZW^N4dUXuzY*b<;0F`03>N< z#)b~jW4~?%9GQKxBhhR%i{^!Jb0w~`+LnjQ>Rno1UfYNwaP=_M!8Bryrhe?}%0JD&K}5C>ju-PcP3{+O=vw7+2MnMb8;%Bv!|pYIrJh z7)_melyh27zG&3D=_+rWHQH6^WofRepf|M=`|9%5VuLR!-|j95v>WBe$LFZn4Yvjs z2l>gzO!eAn5emctKOPLE^l$GHmgp-WtVj$N+Q{grP$}Yrb_AZ69icv@StR_~xsFg{ zB^thG^RSXDb}c}}eTaA`3laUYShTO$1xfvRt0=ehFRYBgvarEiD;lq6*As46lTL{1 zRvH?Prug=VEiV!8nIUOn-bSZF`N#JRQrPrBXk5pT4G)a(JOuJSQ1<2QEgR((UXoI4ywrdg06k z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i?(H1~*u3E7Vd9;VQi9)Z;xmEs(C{f($+`YMdu`0o@Zgf6!bMwMoU)H6B zBTDwN+nRructYOPVDy@F9IwxJ$sU_r`ePO!Zo!Fu^0es6-Cw%u^=qeO0#edYD$Lx` ztAXhHH4R`;Tr*R|gZ=tjZRpcL5)xw5Ilz7PU{Bng>m7OMh($r8vGzj*$%Ezc+5*-K z&pTt1ZhP-NwXc|%@_^K1kJbFcExWB;&KJB{TGy`k-j~Ep6$_FNZ1<`eQcdQZ^Y6HQIx1?q4hOXKG&J?pw3O7;^wiY4{(9j5KR|G(Pk>*{{|;!V{9MHb$p24-h=5?< bvk_jwVgEa3y7k#vHU^j-wK9HSM2Y_|@jHUn literal 0 HcmV?d00001 diff --git a/mob.ini b/mob.ini index 047a7bd..3a3ad52 100644 --- a/mob.ini +++ b/mob.ini @@ -143,6 +143,7 @@ python = release third_party = prefix = cache = +icons = patches = licenses = build = diff --git a/src/core/conf.cpp b/src/core/conf.cpp index b8f01da..1801d99 100644 --- a/src/core/conf.cpp +++ b/src/core/conf.cpp @@ -518,6 +518,7 @@ namespace mob { set_path_if_empty("vcpkg", find_vcpkg); // set after vs as it will use the VS set_path_if_empty("qt_install", find_qt); set_path_if_empty("temp_dir", find_temp_dir); + set_path_if_empty("icons", find_in_root("icons")); set_path_if_empty("patches", find_in_root("patches")); set_path_if_empty("licenses", find_in_root("licenses")); set_path_if_empty("qt_bin", qt::installation_path() / "bin"); diff --git a/src/core/conf.h b/src/core/conf.h index 9ce92e8..40ebbda 100644 --- a/src/core/conf.h +++ b/src/core/conf.h @@ -263,6 +263,7 @@ namespace mob { VALUE(third_party); VALUE(prefix); VALUE(cache); + VALUE(icons); VALUE(patches); VALUE(licenses); VALUE(build); diff --git a/src/tasks/translations.cpp b/src/tasks/translations.cpp index 1da7b64..bb0980b 100644 --- a/src/tasks/translations.cpp +++ b/src/tasks/translations.cpp @@ -259,11 +259,23 @@ namespace mob::tasks { { using json = nlohmann::ordered_json; - json metadata; - { - std::ifstream ifs(path); - metadata = json::parse(ifs); - } + json metadata = json::parse(R"( +{ + "id": "mo2-translations", + "name": "Translations for ModOrganizer2", + "version": "1.0.0", + "description": "Multi-language translations for ModOrganizer2 itself.", + "author": { + "name": "Mod Organizer 2", + "homepage": "https://www.modorganizer.org/" + }, + "icon": "translations.png", + "type": "translation", + "content": { + "translations": {} + } +} +)"); // fix version json translations; @@ -334,9 +346,10 @@ namespace mob::tasks { const auto base = extensions / project_to_extension[p.name]; if (!fs::exists(base)) { - cx().warning(context::generic, - "found project {} for extension {} extension is not built", - p.name, project_to_extension[p.name]); + cx().warning( + context::generic, + "found project {} for extension {} but extension is not built", + p.name, project_to_extension[p.name]); continue; } @@ -362,15 +375,17 @@ namespace mob::tasks { parallel(v); if (auto p = ps.find("organizer")) { - // the empty metadata for mo2-translations is copied from modorganizer and - // then filled here - generate_translations_metadata( - extensions / "mo2-translations" / "metadata.json", p->langs); + // copy Qt builting translation, icon and generate metadata copy_builtin_qt_translations(*p, extensions / "mo2-translations" / "translations"); + op::copy_file_to_file_if_better( + cx(), conf().path().icons() / "translations.png", + extensions / "mo2-translations" / "translations.png", op::unsafe); + generate_translations_metadata( + extensions / "mo2-translations" / "metadata.json", p->langs); } else - cx().bail_out(context::generic, "organizer project not found"); + cx().warning(context::generic, "organizer project not found"); } void translations::copy_builtin_qt_translations(const projects::project& p,