summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.am2
-rwxr-xr-xipatests/i18n.py5
-rw-r--r--po/Makefile.hack.in15
3 files changed, 20 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am
index 80f708b1d..07e998c60 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -128,7 +128,7 @@ apilint:
.PHONY: polint
polint:
- $(MAKE) -C $(srcdir)/po validate-src-strings
+ $(MAKE) -C $(srcdir)/po validate-src-strings validate-po test-gettext
# Run pylint for all python files. Finds all python files/packages, skips
# folders rpmbuild, freeipa-* and dist. Skip (match, but don't print) .*,
diff --git a/ipatests/i18n.py b/ipatests/i18n.py
index 1f48e65bb..8c6e641fd 100755
--- a/ipatests/i18n.py
+++ b/ipatests/i18n.py
@@ -546,7 +546,10 @@ def create_po(pot_file, po_file, mo_file):
for k in po.metadata:
if k.lower() == 'plural-forms':
po.metadata[k] = 'nplurals=2; plural=(n != 1)'
- break
+ # the auto-generated PO file should have charset set to UTF-8
+ # because we are using UTF-8 prefix and suffix below
+ elif k.lower() == 'content-type':
+ po.metadata[k] = 'Content-Type: text/plain; charset=UTF-8'
# Iterate over all msgid's and form a msgstr by prepending
diff --git a/po/Makefile.hack.in b/po/Makefile.hack.in
index 362d3a45a..2f2522be4 100644
--- a/po/Makefile.hack.in
+++ b/po/Makefile.hack.in
@@ -4,6 +4,7 @@
DISTFILES.common.extra3 = Makefile.hack.in
+IPA_TEST_I18N = @top_srcdir@/ipatests/i18n.py
MSGATTRIB = @MSGATTRIB@
.PHONY: strip-po
@@ -20,3 +21,17 @@ strip-po:
clean: mostlyclean
rm -f *~
+
+# linters
+test-gettext: $(DOMAIN).pot
+ $(IPA_TEST_I18N) --test-gettext
+
+validate-pot:
+ $(IPA_TEST_I18N) --show-strings --validate-pot $(DOMAIN).pot
+
+validate-po:
+ $(IPA_TEST_I18N) --show-strings --validate-po $(POFILES)
+
+# forcefully re-generate .pot file and test it
+validate-src-strings: $(DOMAIN).pot-update
+ $(MAKE) validate-pot