I believe the last build bugs are gone from the dist, install, and uninstall requirements.

The absence of translated file removal from distclean target is intentional. That is only performed on re-translation.


The purpose of this patch:

Add the ability for distribution time creation of the translated error pages. Deprecating the need to store each and every page in VCS. At present a manual translation run and VCS update of all files is required even though the .po are in VCS.

However it also adds a single-point dependency on the po2html translation toolkit script being present and available on any machine performing "make dist".

The dist command does all generation, so the individual file are all present in the tar bundle for the install command without pootle.


Additional requirements:
translation toolkit install on squid-cache.org server, to do snapshot and release 'dist' generation translation on behalf of users.


Followups:

When this is accepted and proven working, only the per-language .po will be needed. So obsoleting the old translation files in VCS will begin.


PS. if anyone is able to provide a hack to detect po2html and failover to a tarball D/L from fixed location, it would be welcome as well for backup.

Amos
--
Please use Squid 2.7.STABLE3 or 3.0.STABLE8
=== modified file 'errors/Makefile.am'
--- errors/Makefile.am	2008-02-24 19:10:30 +0000
+++ errors/Makefile.am	2008-07-20 12:23:23 +0000
@@ -10,6 +10,12 @@
 
 DEFAULT_ERROR_DIR	= $(errordir)
 
+# List of automated translations possible:
+TRANSLATIONS = \
+	en
+
+# Legacy language contributions...
+#
 INSTALL_LANGUAGES	= @ERR_LANGUAGES@
 LANGUAGES	= \
 		Armenian \
@@ -53,14 +59,30 @@
 		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) ; 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 f in $(srcdir)/$$l/ERR_*; do \
-	        	rm -f $(DESTDIR)$(DEFAULT_ERROR_DIR)/$$l/`basename $$f`; \
-		done \
+	@ for l in $(INSTALL_LANGUAGES); do \
+		for f in $(srcdir)/$$l/ERR_*; do \
+	        	rm -f $(DESTDIR)$(DEFAULT_ERROR_DIR)/$$l/`basename $$f`; \
+		done; \
+	done; \
+	for l in $(TRANSLATIONS); 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
@@ -70,6 +92,10 @@
 #
 # by Andres Kroonmaa <[EMAIL PROTECTED]>
 #
+# 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
 	[EMAIL PROTECTED] test -d $(srcdir)/$(ADDLANG); then \
 	if test -d $(DEFAULT_ERROR_DIR)/$(DESTLANG); then \
@@ -85,7 +111,7 @@
 	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 \
@@ -93,4 +119,26 @@
 	    cp -p $(srcdir)/$$lang/ERR_*  $(distdir)/$$lang \
 	      || exit 1; \
 	  fi; \
-	done		
+	done; \
+	translate
+
+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

Reply via email to