aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
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