summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorPhilip Chimento <philip@endlessm.com>2015-06-04 09:20:31 -0700
committerPhilip Chimento <philip@endlessm.com>2015-06-04 14:27:31 -0700
commitf17a6ff5c41215701b822ccc4d46e89832fbd033 (patch)
tree32e80569771061e8948903002c694dafc3514ea1 /m4
parentfbc49cb284067838416c6022d5c7dcb64899e030 (diff)
Add eos-html-extractor and m4 file
This is taken almost directly from the existing version in eos-english. Cleanups to follow in subsequent commits. Previously the m4 code was in two separate macros, but since they were much the same, I combined them into one macro. This also adds a very minimal test for eos-html-extractor; basically as a very quick regression test for the cleanups to follow. [endlessm/eos-sdk#3245]
Diffstat (limited to 'm4')
-rw-r--r--m4/eos-i18n-extras.m441
1 files changed, 41 insertions, 0 deletions
diff --git a/m4/eos-i18n-extras.m4 b/m4/eos-i18n-extras.m4
new file mode 100644
index 0000000..629bc73
--- /dev/null
+++ b/m4/eos-i18n-extras.m4
@@ -0,0 +1,41 @@
+dnl Copyright 2013-2015 Endless Mobile, Inc.
+dnl
+dnl Macro to define translation rules for HTML files
+dnl Usage: EOS_DEFINE_I18N_RULES (no arguments)
+dnl
+dnl Usage in Makefile:
+dnl HTML_I18N_RULES:
+dnl Just include @HTML_I18N_RULES@ and then for each file.html that has
+dnl internationalizable values (tags with name="translatable"), put
+dnl file.html.dummy.c in your po/POTFILES.in file. Also make sure the dummy file
+dnl gets made by putting it in all-am or noinst_DATA.
+dnl JSON_I18N_RULES:
+dnl Same as HTML_I18N_RULES, but scans file.json for keys ending with an
+dnl underscore, and puts those keys' values in file.json.dummy.c.
+dnl
+dnl Don't forget to add --directory=$(top_builddir) to XGETTEXT_OPTIONS in
+dnl po/Makevars, since xgettext by default only looks for the files listed in
+dnl POTFILES.in in the source tree, not in the build tree.
+
+AC_DEFUN([EOS_DEFINE_I18N_RULES],
+[
+ m4_pattern_allow([AM_V_GEN]) dnl Otherwise the variable is not allowed
+ AC_REQUIRE([AC_PROG_MKDIR_P])
+ HTML_I18N_RULES='
+%.html.dummy.c: %.html
+ $(AM_V_GEN)$(MKDIR_P) [$](@D) && \
+ eos-html-extractor $< $(top_srcdir) >[$]@
+'
+
+ AC_SUBST([HTML_I18N_RULES])
+ AM_SUBST_NOTMAKE([HTML_I18N_RULES])
+
+ JSON_I18N_RULES='
+%.json.dummy.c: %.json
+ $(AM_V_GEN)$(MKDIR_P) [$](@D) && \
+ eos-json-extractor $< $(top_srcdir) >[$]@
+'
+
+ AC_SUBST([JSON_I18N_RULES])
+ AM_SUBST_NOTMAKE([JSON_I18N_RULES])
+])