fi
fi
+dnl Squid now has limited locale handling ...
+DO_TRANSLATE="yes"
+AC_ARG_WITH(po2html,
+[ --without-po2html Translation toolkit is required to auto-build translated
+ error pages. If it is not present this option can be used
+ to run the 'make dist' target without translating.
+ A drop-in bundle of pre-translated files is available from
+ http://www.squid-cache.org/Versions/v3/HEAD/
+],
+[ if test "$enableval" != "yes" ; then
+ echo "Disabling Translation Toolkit dependency"
+ DO_TRANSLATE="no"
+ fi
+])
+AC_SUBST(DO_TRANSLATE)
+
+
dnl Need the debugging version of malloc if available
XTRA_OBJS=''
if test "$ac_cv_lib_malloc_main" = "yes" ; then
DEFAULT_ERROR_DIR = $(errordir)
+# List of automated translations possible:
+TRANSLATIONS = \
+ en
+
+# Legacy language contributions...
+#
INSTALL_LANGUAGES = @ERR_LANGUAGES@
LANGUAGES = \
Armenian \
for f in $(srcdir)/$$l/ERR_*; do \
echo "$(INSTALL_DATA) $$f $(DESTDIR)$(DEFAULT_ERROR_DIR)/$$l"; \
$(INSTALL_DATA) $$f $(DESTDIR)$(DEFAULT_ERROR_DIR)/$$l; \
- done \
+ done; \
+ done; \
+ for l in $(TRANSLATIONS) templates; do \
+ if test -d $(srcdir)/$$l; then \
+ $(mkinstalldirs) $(DESTDIR)$(DEFAULT_ERROR_DIR)/$$l && \
+ for f in $(srcdir)/$$l/ERR_*; do \
+ echo "$(INSTALL_DATA) $$f $(DESTDIR)$(DEFAULT_ERROR_DIR)/$$l"; \
+ $(INSTALL_DATA) $$f $(DESTDIR)$(DEFAULT_ERROR_DIR)/$$l; \
+ done; \
+ fi \
done
uninstall-local:
- @for l in $(INSTALL_LANGUAGES); do \
+ @ for l in $(INSTALL_LANGUAGES); do \
for f in $(srcdir)/$$l/ERR_*; do \
rm -f $(DESTDIR)$(DEFAULT_ERROR_DIR)/$$l/`basename $$f`; \
- done \
+ done; \
+ done; \
+ for l in $(TRANSLATIONS) templates; do \
+ if test -d $(DESTDIR)$(DEFAULT_ERROR_DIR)/$$l; then \
+ for f in $(srcdir)/$$l/ERR_*; do \
+ rm -f $(DESTDIR)$(DEFAULT_ERROR_DIR)/$$l/`basename $$f`; \
+ done; \
+ fi \
done
# undocumented hack. You can use this target to create multi-lingual
#
# by Andres Kroonmaa <andre@mail.lbi.ee>
#
+# UPDATE: this hack completely breaks HTML standards and with the addition
+# of language translations is now largely obsolete.
+# It will be removed without notice at some future date.
+#
addlang: all
-@if test -d $(srcdir)/$(ADDLANG); then \
if test -d $(DEFAULT_ERROR_DIR)/$(DESTLANG); then \
fi
dist-hook:
- @ for lang in $(LANGUAGES); do \
+ for lang in $(LANGUAGES); do \
if test "$$lang" = .; then :; else \
test -d $(distdir)/$$lang \
|| mkdir $(distdir)/$$lang \
cp -p $(srcdir)/$$lang/ERR_* $(distdir)/$$lang \
|| exit 1; \
fi; \
- done
+ done; \
+ if test "$(DO_TRANSLATE)" = "yes" ; then \
+ translate; \
+ fi
+
+translate:
+ for lang in $(TRANSLATIONS); do \
+ test -d $$lang || rm -r $$lang; \
+ mkdir $$lang; \
+ test -d $(distdir)/$$lang \
+ || mkdir $(distdir)/$$lang \
+ || exit 1; \
+ cd $$lang; \
+ for f in `ls -1 ../templates`; do \
+ echo "po2html -i ../$$lang.po -t ../templates/$$f"; \
+ po2html -i ../$$lang.po -t ../templates/$$f \
+ | sed -r s/\>\ \ ?\</\>\\n\</g >$$f || exit 1; \
+ done; \
+ cd ..; \
+ cp -p $(srcdir)/$$lang/ERR_* $(distdir)/$$lang \
+ || exit 1; \
+ done
+
+all:
+ translate