From a123b680ffbf95cebf225dd4f143ccc8728faa74 Mon Sep 17 00:00:00 2001 From: yyc12345 Date: Fri, 9 Oct 2026 19:50:58 +0800 Subject: [PATCH] fix: adapt inno setup rendering to metaglot language name conversion --- CMakeLists.txt | 2 +- dist/scwpic.iss.in.liquid | 25 +++++++++++++++++++------ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 609f78e..cd0d101 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -246,7 +246,7 @@ if (WIN32) --iss-template ${CMAKE_SOURCE_DIR}/dist/scwpic.iss.in.liquid --isl-template ${CMAKE_SOURCE_DIR}/dist/scwpic.isl.liquid --iss-path scwpic.iss.in - --isl-path "Strings/{{ lang }}.isl" + --isl-path "Strings/{{ lang | default: name }}.isl" --output ${SCWPIC_INNO_OUTPUT_DIR} RESULT_VARIABLE METAGLOT_INNO_RESULT ) diff --git a/dist/scwpic.iss.in.liquid b/dist/scwpic.iss.in.liquid index 1eca143..030f458 100644 --- a/dist/scwpic.iss.in.liquid +++ b/dist/scwpic.iss.in.liquid @@ -48,14 +48,27 @@ SolidCompression=yes WizardStyle=modern [Languages] +{% comment %} +YYC MARK: +The base messages file pairing (the official full translation that provides +the language identity) is derived from MetaGlot's best-effort conversion of +the PO language tag to the conventional Inno Setup language name (lang.lang). +The English source language maps to "Default" and languages unknown to +MetaGlot convert to nothing; both fall back to "compiler:Default.isl" and +inherit the English language identity, so pair such a language with its base +file explicitly (e.g. via a "case" on "lang.name") when adding one. The +incremental custom messages file is named after the conventional name (or +the PO language tag when no conventional name exists); keep it in sync with +the "--isl-path" argument in CMakeLists.txt. +{% endcomment -%} {% for lang in langs -%} -{% case lang -%} -{% when 'zh_CN' -%} -{% assign base = 'compiler:Languages\ChineseSimplified.isl' -%} -{% else -%} +{%- if lang.lang and lang.lang != 'Default' -%} +{% assign base = 'compiler:Languages\' | append: lang.lang | append: '.isl' -%} +{%- else -%} {% assign base = 'compiler:Default.isl' -%} -{% endcase -%} -Name: "{{ lang }}"; MessagesFile: "{{ base }},Strings\{{ lang }}.isl" +{%- endif -%} +{% assign incremental = lang.lang | default: lang.name -%} +Name: "{{ lang.name }}"; MessagesFile: "{{ base }},Strings\{{ incremental }}.isl" {% endfor -%} [Tasks]