summaryrefslogtreecommitdiff
path: root/make/po4a.mk
diff options
context:
space:
mode:
Diffstat (limited to 'make/po4a.mk')
-rw-r--r--make/po4a.mk31
1 files changed, 31 insertions, 0 deletions
diff --git a/make/po4a.mk b/make/po4a.mk
new file mode 100644
index 0000000..df5d051
--- /dev/null
+++ b/make/po4a.mk
@@ -0,0 +1,31 @@
+# override with e.g. htmltemplate when handling non-Markdown files
+fileformat = text
+
+# Percentage of l10n completed to be acceptable
+threshold = 100
+
+# l10nfiles: relative paths to localizable files
+
+# Invoke from inside basedir of master files
+# potfile: path to POT file
+mkpot:
+ po4a-gettextize -M UTF-8 -L UTF-8 -f "$(fileformat)" -o markdown $(patsubst %,-m %,$(l10nfiles)) -p "$(potfile)"
+
+# Invoke from root dir of translated files
+# masterdir: path to dir containing untranslated files
+# pofile: path to PO file
+mkpo:
+ po4a-gettextize -M UTF-8 -L UTF-8 -f "$(fileformat)" -o markdown $(patsubst %,-m %,$(l10nfiles)) $(patsubst %,-l $(masterdir)/%,$(l10nfiles)) -p "$(pofile)"
+
+# Invoke from inside basedir of master files
+# pofile: path to PO file
+updatepo:
+ po4a-updatepo -M UTF-8 -f "$(fileformat)" -o markdown $(patsubst %,-m %,$(l10nfiles)) -p "$(pofile)"
+
+# Invoke from root dir of translated files
+# masterdir: path to dir containing untranslated files
+# pofile: path to PO file
+$(l10nfiles):
+ po4a-translate -M UTF-8 -L UTF-8 -k "$(threshold)" -f "$(fileformat)" -o markdown $(patsubst %,-m $(masterdir)/%,$@) -p "$(pofile)" -l "$@"
+
+.PHONY: mkpot mkpo