Skip to content

Commit c22cad8

Browse files
committed
feat(installer): Implement PO file workflow for translations
This commit introduces a translation workflow for the Windows installer using `.po` files. This replaces the previous method of directly editing `.isl` files, making the localization process more accessible and manageable for translators. - PO/ISL Conversion: Added `isl_to_po.py` and `po_to_isl.py` scripts to convert between Inno Setup's `.isl` format and the standard `.po` format. - Makefile Integration:     - Created a `translations-export` target to generate `.po` files from existing `.isl` files for translators, using the `isl_to_po.py` script.     - Added a `translations-compile` target to convert all `.po` files back into `.isl` format, using the `po_to_isl.py` script.     - The `build-installer-windows` process now automatically runs `translations-compile`, ensuring the latest translations are always included in the build. - Initial German PO File: Added `German.po` to demonstrate the new workflow. - Improved Scaffolding: The `create_new_language.py` script has been updated to better handle the creation of new language files, ensuring custom messages are correctly scaffolded for translation.
1 parent 8cda0e6 commit c22cad8

File tree

6 files changed

+1711
-28
lines changed

6 files changed

+1711
-28
lines changed

Makefile

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ nssm:
131131

132132
# Windows Installer Build
133133
.PHONY: build-installer-windows
134-
build-installer-windows: needs-version nssm webview2
134+
build-installer-windows: translations-compile needs-version nssm webview2
135135
ifeq ($(OS),Windows_NT)
136136
# Assumes Inno Setup is installed in the default location.
137137
# MSYS_NO_PATHCONV=1 prevents Git Bash/MINGW from converting the /D flag into a file path.
@@ -151,6 +151,39 @@ new-language:
151151
--name "$(LANG)" \
152152
--inno-languages-dir "$(INNO_LANGUAGES_DIR)"
153153

154+
TRANSLATIONS_DIR := installer/translations
155+
ISL_TO_PO_SCRIPT := $(TRANSLATIONS_DIR)/isl_to_po.py
156+
PO_TO_ISL_SCRIPT := $(TRANSLATIONS_DIR)/po_to_isl.py
157+
158+
# Usage example: make translations-export LANG=German LANG_CODE=de_DE
159+
# Exports a single .isl file to a .po file for translators.
160+
.PHONY: translations-export
161+
translations-export:
162+
$(MAKE) guard-LANG
163+
$(MAKE) guard-LANG_CODE
164+
@echo "Exporting '$(LANG).isl' to a .po file for translators..."
165+
$(PYTHON_EXEC) $(ISL_TO_PO_SCRIPT) \
166+
-t $(TRANSLATIONS_DIR)/English.isl \
167+
-i $(TRANSLATIONS_DIR)/$(LANG).isl \
168+
-o $(TRANSLATIONS_DIR)/$(LANG).po \
169+
-l "$(LANG_CODE)"
170+
171+
# Compiles all .po files in the translations dir into their final .isl format.
172+
# Runs automatically before the windows installer is built.
173+
.PHONY: translations-compile
174+
translations-compile:
175+
@echo "Compiling .po files to .isl format for Inno Setup..."
176+
@for po_file in $(TRANSLATIONS_DIR)/*.po; do \
177+
if [ -f "$$po_file" ]; then \
178+
lang_name=$$(basename "$$po_file" .po); \
179+
echo " -> Processing $${lang_name}.po -> $${lang_name}.isl"; \
180+
$(PYTHON_EXEC) $(PO_TO_ISL_SCRIPT) \
181+
-t $(TRANSLATIONS_DIR)/English.isl \
182+
-i "$$po_file" \
183+
-o "$(TRANSLATIONS_DIR)/$${lang_name}.isl"; \
184+
fi \
185+
done
186+
154187
.PHONY: update-translations
155188
update-translations:
156189
@echo "Updating master language file from '$(INNO_DEFAULT_ISL)'..."

installer/translations/German.isl

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
[LangOptions]
2-
LanguageName=Deutsch
3-
LanguageID=$0407
4-
LanguageCodePage=1252
1+
[LangOptions]
2+
languagename=German
3+
languageid=$0407
4+
languagecodepage=0
55

66
[Messages]
77
SetupAppTitle=Setup
@@ -48,12 +48,12 @@ AboutSetupMenuItem=&Über das Setup ...
4848
AboutSetupTitle=Über das Setup
4949
AboutSetupMessage=%1 Version %2%n%3%n%n%1 Webseite:%n%4
5050
AboutSetupNote=
51-
TranslatorNote=German translation maintained by Jens Brand (jens.brand@wolf-software.de)
51+
TranslatorNote=
5252
ButtonBack=< &Zurück
5353
ButtonNext=&Weiter >
5454
ButtonInstall=&Installieren
5555
ButtonOK=OK
56-
ButtonCancel=Abbrechen
56+
ButtonCancel=&Abbrechen
5757
ButtonYes=&Ja
5858
ButtonYesToAll=J&a für Alle
5959
ButtonNo=&Nein
@@ -146,15 +146,15 @@ ReadyMemoType=Setup-Typ:
146146
ReadyMemoComponents=Ausgewählte Komponenten:
147147
ReadyMemoGroup=Startmenü-Ordner:
148148
ReadyMemoTasks=Zusätzliche Aufgaben:
149-
DownloadingLabel2=Lade Dateien herunter...
149+
DownloadingLabel2=Dateien werden herunter geladen...
150150
ButtonStopDownload=Download &abbrechen
151151
StopDownload=Sind Sie sicher, dass Sie den Download abbrechen wollen?
152152
ErrorDownloadAborted=Download abgebrochen
153153
ErrorDownloadFailed=Download fehlgeschlagen: %1 %2
154154
ErrorDownloadSizeFailed=Fehler beim Ermitteln der Größe: %1 %2
155155
ErrorProgress=Ungültiger Fortschritt: %1 von %2
156156
ErrorFileSize=Ungültige Dateigröße: erwartet %1, gefunden %2
157-
ExtractingLabel=Entpacke Dateien...
157+
ExtractingLabel=Dateien werden entpackt ...
158158
ButtonStopExtraction=Entpacken &abbrechen
159159
StopExtraction=Sind Sie sicher, dass Sie das Entpacken abbrechen wollen?
160160
ErrorExtractionAborted=Entpacken abgebrochen
@@ -191,11 +191,11 @@ PathLabel=&Pfad:
191191
FileNotInDir2=Die Datei "%1" befindet sich nicht in "%2". Bitte Ordner ändern oder richtigen Datenträger einlegen.
192192
SelectDirectoryLabel=Geben Sie bitte an, wo der nächste Datenträger eingelegt wird.
193193
SetupAborted=Das Setup konnte nicht abgeschlossen werden.%n%nBeheben Sie bitte das Problem und starten Sie das Setup erneut.
194-
AbortRetryIgnoreSelectAction=Bitte auswählen
195-
AbortRetryIgnoreRetry=&Nochmals versuchen
194+
AbortRetryIgnoreSelectAction=Aktion auswählen
195+
AbortRetryIgnoreRetry=&Wiederholen
196196
AbortRetryIgnoreIgnore=&Den Fehler ignorieren und fortfahren
197197
AbortRetryIgnoreCancel=Installation abbrechen
198-
RetryCancelSelectAction=Bitte auswählen
198+
RetryCancelSelectAction=Aktion auswählen
199199
RetryCancelRetry=&Wiederholen
200200
RetryCancelCancel=&Abbrechen
201201
StatusClosingApplications=Anwendungen werden geschlossen ...
@@ -233,7 +233,7 @@ VerificationFileSizeIncorrect=Die Größe der Datei ist ungültig
233233
VerificationFileHashIncorrect=Der Hashwert der Datei ist ungültig
234234
ExistingFileReadOnly2=Die vorhandene Datei kann nicht ersetzt werden, da sie schreibgeschützt ist.
235235
ExistingFileReadOnlyRetry=&Den Schreibschutz entfernen und noch einmal versuchen
236-
ExistingFileReadOnlyKeepExisting=Die &vorhandene Datei behalten
236+
ExistingFileReadOnlyKeepExisting=Vorhandene Datei &behalten
237237
ErrorReadingExistingDest=Lesefehler in Datei:
238238
FileExistsSelectAction=Aktion auswählen
239239
FileExists2=Die Datei ist bereits vorhanden.

0 commit comments

Comments
 (0)