From 17898fbabde35ab346c133114e78614e707c0eca Mon Sep 17 00:00:00 2001 From: Rubén Beltrán del Río Date: Sat, 17 Jan 2026 00:36:49 +0100 Subject: Add localization --- Makefile | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index f179087..0f6087d 100644 --- a/Makefile +++ b/Makefile @@ -42,6 +42,23 @@ format: lint: cargo fmt -- --check && cargo clippy +# Internationalization / Localization ########################################## + +find_translatable_files: + @find ./ -not -path '*/.*' -type f -name "*.rs" -exec grep -l "tr!(\"\|gettext" {} \; | sort > po/POTFILES + +extract_strings: find_translatable_files + @xgettext --files-from=po/POTFILES --output=po/systems.tranquil.Map.pot --from-code=UTF-8 --add-comments --keyword='tr!' + +po_files := $(wildcard po/*.po) +mo_files := $(patsubst po/%.po,po/%/LC_MESSAGES/systems.tranquil.Map.mo,$(po_files)) + +compile_translations: $(mo_files) + +po/%/LC_MESSAGES/systems.tranquil.Map.mo: po/%.po + @mkdir -p $(dir $@) + msgfmt $< -o $@ + # Packaging #################################################################### package: $(architectures) @@ -95,4 +112,4 @@ else endif -.PHONY: default build $(architectures) rpm package prepare set_rust ci release test coverage format flatpak +.PHONY: default build $(architectures) rpm package prepare set_rust ci release test coverage format flatpak extract_strings find_translatable_files compile_translations -- cgit