summaryrefslogtreecommitdiff
path: root/po/subdir.mk
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2017-07-08 22:08:04 -0400
committerLuke Shumaker <lukeshu@lukeshu.com>2017-07-08 22:08:04 -0400
commitbcc12b176fc19070aa16940ff4840830bc2ecd59 (patch)
treed106ea6a95d4fa20d8ccfce16d797df4ba425d9b /po/subdir.mk
parentafc6093ea5b87d2d4c870cef7ef66548d3d576ba (diff)
Makefile: add support for compiling and installing localizations
This means that the new `po/files.generate` target can be used to build the `.pot` files without doing anything else; we can stop requiring translators to install ruby-ronn. It also means that we can put the `.pot` files in the source tarball, to make it even easier for translators. Unfortunately, it does add the extra step of having to create another symlink when adding a new locale.
Diffstat (limited to 'po/subdir.mk')
-rw-r--r--po/subdir.mk17
1 files changed, 17 insertions, 0 deletions
diff --git a/po/subdir.mk b/po/subdir.mk
new file mode 100644
index 0000000..6c4120b
--- /dev/null
+++ b/po/subdir.mk
@@ -0,0 +1,17 @@
+include $(dir $(lastword $(MAKEFILE_LIST)))/../../config.mk
+include $(topsrcdir)/build-aux/Makefile.head.mk
+
+locale = $(notdir $(srcdir))
+domains = $(patsubst %.po,%,$(filter %.po,$(files.src.src)))
+
+$(outdir)/%.mo: $(srcdir)/%.po $(call at.path,../%.po)
+ msgfmt -o $@ $<
+
+$(DESTDIR)$(localedir)/$(locale)/LC_MESSAGES/%.mo: $(outdir)/%.mo
+ install -T -Dm644 '$<' '$@'
+
+files.out.all += $(addsuffix .mo,$(domains))
+files.sys.all += $(foreach domain,$(domains),$(localedir)/$(locale)/LC_MESSAGES/$(domain).mo)
+at.subdirs += ..
+
+include $(topsrcdir)/build-aux/Makefile.tail.mk