aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorRubén Beltrán del Río <jj@r.bdr.sh>2026-01-17 00:36:49 +0100
committerRubén Beltrán del Río <jj@r.bdr.sh>2026-01-17 02:43:21 +0100
commit17898fbabde35ab346c133114e78614e707c0eca (patch)
tree90f0fd36211c036a507a0af092aac3c5fb8e7ac8 /Makefile
parent90b12c34debaa4aa816d4e6862cdb4e39c7181e4 (diff)
Add localization
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile19
1 files changed, 18 insertions, 1 deletions
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