chiark / gitweb /
add Makefile to handle refreshing translation template
authorHans-Christoph Steiner <hans@eds.org>
Fri, 15 Sep 2017 21:39:32 +0000 (23:39 +0200)
committerHans-Christoph Steiner <hans@eds.org>
Sat, 16 Sep 2017 11:19:38 +0000 (13:19 +0200)
To generate the translation files, run `make -C locale`or
`cd locale && make`

To update the template, run `make -C locale template` or
`cd locale && make fdroidserver.pot`

locale/Makefile [new file with mode: 0644]

diff --git a/locale/Makefile b/locale/Makefile
new file mode 100644 (file)
index 0000000..2b4e25f
--- /dev/null
@@ -0,0 +1,37 @@
+
+FILES = ../fdroid $(wildcard ../fdroidserver/*.py)
+
+# these are the supported languages
+ALL_LINGUAS = de es pt_BR pt_PT tr zh_Hans zh_Hant
+POFILES = $(ALL_LINGUAS:=/LC_MESSAGES/fdroidserver.po)
+MOFILES = $(ALL_LINGUAS:=/LC_MESSAGES/fdroidserver.mo)
+
+TEMPLATE = fdroidserver.pot
+
+VERSION = $(shell git describe)
+
+# generate .mo files from the .po files
+all-local: $(MOFILES)
+
+clean-local:
+       -rm -f -- $(MOFILES)
+       -rm -f -- $(POFILES:=~)
+
+# refresh the template from the source code
+template: $(TEMPLATE)
+
+$(TEMPLATE): $(FILES)
+       xgettext --join-existing --from-code=UTF-8 \
+               --language=Python --keyword=_ \
+               --sort-output --no-location --output=$(TEMPLATE) \
+               --package-name="fdroidserver" --package-version=$(VERSION) \
+               --foreign-user \
+               --msgid-bugs-address=https://gitlab.com/fdroid/fdroidserver/issues \
+               $(FILES)
+       sed -i 's,CHARSET,UTF-8,' $(TEMPLATE)
+
+%/LC_MESSAGES/fdroidserver.mo: %/LC_MESSAGES/fdroidserver.po
+       msgfmt --check -o $@ $(@:mo=po)
+
+
+.PHONY = all-local clean-local template