diff --git a/.github/actions/install-dependencies/install-dependencies.sh b/.github/actions/install-dependencies/install-dependencies.sh index 036ea69e1..5c8235cf3 100755 --- a/.github/actions/install-dependencies/install-dependencies.sh +++ b/.github/actions/install-dependencies/install-dependencies.sh @@ -51,6 +51,7 @@ setup_macos() { } setup_windows() { + pip install --ignore-requires-python translate-toolkit[rc] curl -fsSLO https://okapiframework.org/binaries/main/1.45.0/okapi-apps_win32-x86_64_1.45.0.zip mkdir okapi "${WINDIR}\\System32\\tar" xfC okapi-apps_win32-x86_64_1.45.0.zip okapi diff --git a/app/app.pro b/app/app.pro index 714312b77..ce2426048 100644 --- a/app/app.pro +++ b/app/app.pro @@ -21,6 +21,11 @@ UI_DIR = .ui RESOURCES += data/app.qrc +MUI_TRANSLATIONS += \ + translations/mui_de.po + +RC_LANGS.de = --lang LANG_GERMAN --sublang SUBLANG_NEUTRAL + EXTRA_TRANSLATIONS += \ $$PWD/../translations/pencil_ar.ts \ $$PWD/../translations/pencil_ca.ts \ @@ -222,7 +227,41 @@ macx { } win32 { - RC_FILE = data/pencil2d.rc + RC_FILES = data/version.rc data/mui.rc + + ensurePathEnv() + isEmpty(PO2RC): for(dir, QMAKE_PATH_ENV) { + exists("$$dir/po2rc.exe") { + PO2RC = "$$dir/po2rc.exe" + break() + } + } + !isEmpty(PO2RC) { + defineReplace(rcLang) { + name = $$basename(1) + base = $$section(name, ., 0, -2) + return($$member(RC_LANGS.$$section(base, _, 1), 0, -1)) + } + po2rc.name = po2rc + po2rc.input = MUI_TRANSLATIONS + po2rc.output = ${QMAKE_FILE_IN_BASE}.rc + po2rc.commands = $$shell_path($$PO2RC) -t $$PWD/data/mui.rc ${QMAKE_FILE_IN} ${QMAKE_FUNC_FILE_IN_rcLang} ${QMAKE_FILE_OUT} + silent: makepri.commands = @echo po2rc ${QMAKE_FILE_IN} && $$makepri.commands + po2rc.CONFIG = no_link + QMAKE_EXTRA_COMPILERS += po2rc + # variable_out doesn't seem to work in this case + for(file, MUI_TRANSLATIONS): { + name = $$basename(file) + RC_FILES += $$replace(name, .po, .rc) + } + } else { + warning("po2rc was not found. MUI resources will not be translated. You can safely ignore this warning if you do not plan to distribute this build of Pencil2D through its installer.") + } + + for(file, RC_FILES): RC_INCLUDES += "$${LITERAL_HASH}include \"$$file\"" + write_file($$OUT_PWD/pencil2d.rc, RC_INCLUDES)|error() + RC_FILE = $$OUT_PWD/pencil2d.rc + RC_INCLUDEPATH += $$PWD $$PWD/data } unix:!macx { diff --git a/app/data/mui.rc b/app/data/mui.rc new file mode 100644 index 000000000..292316c76 --- /dev/null +++ b/app/data/mui.rc @@ -0,0 +1,15 @@ +#if defined(__MINGW32__) || defined(__MINGW64__) +// This is needed for MinGW versions < 8 +// (not to be confused with the GCC version by which Qt labels their MinGW packages) +#include +#else +#include +#endif + +STRINGTABLE +LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL +{ + 0 "Pencil2D" + 1 "Pencil2D Animation" + 2 "Pencil2D Animation (Old Format)" +} diff --git a/app/data/pencil2d.rc b/app/data/version.rc similarity index 88% rename from app/data/pencil2d.rc rename to app/data/version.rc index facc7303b..1208f78ac 100644 --- a/app/data/pencil2d.rc +++ b/app/data/version.rc @@ -35,7 +35,7 @@ FILETYPE VFT_APP { BLOCK "StringFileInfo" { - BLOCK "040904B0" + BLOCK "000904B0" { VALUE "ProductName", "Pencil2D" #ifdef __GNUC__ @@ -61,14 +61,6 @@ FILETYPE VFT_APP BLOCK "VarFileInfo" { - VALUE "Translation", 0x0409, 0x04B0 + VALUE "Translation", 0x0009, 0x04B0 } } - -STRINGTABLE -LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL -{ - 0 "Pencil2D" - 1 "Pencil2D Animation" - 2 "Pencil2D Animation (Old Format)" -} diff --git a/app/translations/mui.pot b/app/translations/mui.pot new file mode 100644 index 000000000..6b3c21e79 --- /dev/null +++ b/app/translations/mui.pot @@ -0,0 +1,27 @@ +#. extracted from data\mui.rc +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-09-22 15:26+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Accelerator-Marker: &\n" +"X-Generator: Translate Toolkit 3.9.0\n" +"X-Merge-On: location\n" + +#: STRINGTABLE.0 +msgid "Pencil2D" +msgstr "" + +#: STRINGTABLE.1 +msgid "Pencil2D Animation" +msgstr "" + +#: STRINGTABLE.2 +msgid "Pencil2D Animation (Old Format)" +msgstr "" diff --git a/app/translations/mui_de.po b/app/translations/mui_de.po new file mode 100644 index 000000000..e21091506 --- /dev/null +++ b/app/translations/mui_de.po @@ -0,0 +1,32 @@ +# +# Translators: +# Jakob , 2023 +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-09-22 15:26+0200\n" +"PO-Revision-Date: 2023-09-22 14:10+0000\n" +"Last-Translator: Jakob , 2023\n" +"Language-Team: German (https://app.transifex.com/pencil2d/teams/76612/de/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Accelerator-Marker: &\n" +"X-Generator: Translate Toolkit 3.9.0\n" +"X-Merge-On: location\n" + +#: STRINGTABLE.0 +msgid "Pencil2D" +msgstr "Pencil2D" + +#: STRINGTABLE.1 +msgid "Pencil2D Animation" +msgstr "Pencil2D-Animation" + +#: STRINGTABLE.2 +msgid "Pencil2D Animation (Old Format)" +msgstr "Pencil2D-Animation (altes Format)" diff --git a/util/common.pri b/util/common.pri index 032d44227..400523cbf 100644 --- a/util/common.pri +++ b/util/common.pri @@ -1,7 +1,7 @@ VERSION = 0.6.6 DEFINES += APP_VERSION=\\\"$$VERSION\\\" -DEFINES += APP_VERSION_RC=$$replace(VERSION, "\.", ",") +RC_DEFINES += APP_VERSION=\\\"$$VERSION\\\" APP_VERSION_RC=$$replace(VERSION, "\.", ",") PENCIL2D_NIGHTLY { DEFINES += PENCIL2D_NIGHTLY_BUILD