diff --git a/icons/translations.png b/icons/translations.png new file mode 100644 index 0000000..3664bd7 Binary files /dev/null and b/icons/translations.png differ 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,