gimp-help-2 r2729 - in trunk: . tools



Author: ulfehlert
Date: Mon Feb  2 21:38:50 2009
New Revision: 2729
URL: http://svn.gnome.org/viewvc/gimp-help-2?rev=2729&view=rev

Log:
2009-02-02  Ulf-D. Ehlert  <ulfehlert svn gnome org>

	* tools/get_po_status.pl: print size of po files in summary

	* configure.ac: remove MSGINITFLAGS variable
	* Makefile.am: set msginit's po file width option;
	  remove messages.po; clean up pot files;
	  don't miss the cached log when validating;
	* Makefile.GNU: set msginit's po file width option;
	  split sed command for draft files
	  remove messages.po; clean up pot files;
	  don't miss the cached log when validating;
	  use SED variable; split sed command for draft files


Modified:
   trunk/ChangeLog
   trunk/Makefile.GNU
   trunk/Makefile.am
   trunk/configure.ac
   trunk/tools/get_po_status.pl

Modified: trunk/Makefile.GNU
==============================================================================
--- trunk/Makefile.GNU	(original)
+++ trunk/Makefile.GNU	Mon Feb  2 21:38:50 2009
@@ -29,7 +29,7 @@
 MSGCAT        = msgcat 
 MSGCATFLAGS   = --width=$(MSGWIDTH)
 MSGINIT       = msginit
-MSGINITFLAGS  = --no-translator
+MSGINITFLAGS  = --no-translator --width=$(MSGWIDTH)
 MSGFMT        = msgfmt
 MSGFMTFLAGS   = --check --use-fuzzy --statistics
 MSGMERGE      = msgmerge
@@ -40,7 +40,7 @@
 DOCBOOK2ODF      = docbook2odf
 DOCBOOK2ODFFLAGS =
 
-XDGOPEN = xdg-open
+SED = sed
 
 # Standard shell commands
 echo_n  = echo -n
@@ -153,7 +153,7 @@
 xml2pot = ($(XML2PO) --output='-' $(1) \
           | $(MSGUNIQ) $(MSGUNIQFLAGS) \
           | $(MSGCAT) $(MSGCATFLAGS) - > "$(2)") 2>&1 \
-          | sed -e '/image file .* not found/d'
+          | $(SED) -e '/image file .* not found/d'
 
 # Merge template (pot) and message catalog (po) or create a new catalog
 #
@@ -166,12 +166,15 @@
 pot2po = if [ -s $(3) ]; then \
              with_compendium="$(shell $(call get_compendium,$3))"; \
              tmpfile=$(3).tmp; \
-             $(MSGFMT)   $(MSGFMTFLAGS)   $(3); \
+             $(MSGFMT) $(MSGFMTFLAGS) $(3); \
+             rm -f messages.po messages.gmo; \
              $(MSGMERGE) $(MSGMERGEFLAGS) $${with_compendium} $(3) $(1) \
              > $${tmpfile}; \
              test -s  $${tmpfile} && mv -f $${tmpfile} $(3) || rm -f $${tmpfile}; \
          else \
-             $(MSGINIT)  $(MSGINITFLAGS) --input $(1) --locale=$(2) --output $(3); \
+             $(MSGINIT) $(MSGINITFLAGS) --input $(1) --locale=$(2) --output=- \
+             | $(SED) -e '/Plural-Forms:/d' \
+             > $(3); \
          fi
 
 # Merge PO file into (translated) XML file
@@ -185,11 +188,11 @@
 #     $4 - resulting (translated) XML file
 ifeq ("$(XMLLINT)", "")
 po2xml = $(XML2PO) --po-file=$(2) --language=$(3) --output=$(4) $(1) 2>&1 \
-         | sed -e '/Warning: image file .* not found./d'
+         | $(SED) -e '/Warning: image file .* not found./d'
 else
 po2xml = ($(XML2PO) --po-file=$(2) --language=$(3) --output='-' $(1) \
          | $(XMLLINT) $(XMLLINTFLAGS) --format --output $(4) -) 2>&1 \
-         | sed -e '/Warning: image file .* not found./d'
+         | $(SED) -e '/Warning: image file .* not found./d'
 endif
 
 
@@ -236,7 +239,7 @@
 	'xml-<LANG> ' 'Create/update XML files for language <LANG> (implies po-<LANG>)' \
 	'po-<LANG>  ' 'Create/update PO files for language <LANG> (implies pot)' \
 	'pot        ' 'Create/update POT files'
-	@echo '(where <LANG> is one of' $(shell echo $(LANGUAGES) | sed -e 's/ /,&/g')')'
+	@echo '(where <LANG> is one of' $(shell echo $(LANGUAGES) | $(SED) -e 's/ /,&/g')')'
 
 
 ########################################################################
@@ -269,7 +272,13 @@
 # Targets suitable for command line
 # ("make pot" will work even if pot exists)
 pot: potfiles ;
-potfiles: $(POT_FILES) ;
+potfiles: $(POT_FILES)
+	$(msg) "--- Cleaning up pot files ..."
+	$(cmd) find pot $(file_predicates) | \
+	while read potfile; do \
+		potfile=$${potfile#pot/}; srcfile=src/$${potfile%.pot}.xml \
+		test -e $${srcfile} || rm -f $${potfile}; \
+	done
 
 
 ########################################################################
@@ -309,7 +318,7 @@
 
 # Force updating po file(s)
 update-po/%.po:
-	$(cmd) pot=`echo $* | sed -e 's|[^/]*|pot|; s/$$/.pot/'`; \
+	$(cmd) pot=`echo $* | $(SED) -e 's|[^/]*|pot|; s/$$/.pot/'`; \
 	$(RMAKE) -W $${pot} po/$*.po
 
 force-po/%:
@@ -434,11 +443,12 @@
 	$(cmd) test -s $< && cat $<
 
 define MAKE_XMLLINT_RULES
-log/$(1)-xmllint.log: log $$($(1)_XML_FILES)
+log/$(1)-xmllint.log: $$($(1)_XML_FILES)
+	$$(cmd) $$(call make_target_dir,$$(@))
 	$$(cmd) if type $$(XMLLINT) >/dev/null 2>&1; then \
 		echo "*** Validating XML ($(1)) ... "; \
 		$$(XMLLINT) $$(XMLLINTFLAGS) --xinclude xml/$(1)/gimp.xml \
-		| sed -e 's,xmlns:xi="http://www.w3.org/2001/XInclude";,,' \
+		| $$(SED) -e 's,xmlns:xi="http://www.w3.org/2001/XInclude";,,' \
 		| $$(XMLLINT) $$(XMLLINTFLAGS) --nonet --valid \
 			--output log/$(1).xml - 2>$$(@); \
 		if test -s $$(@); then \
@@ -524,9 +534,12 @@
 ########################################################################
 
 preview-xml/%.xml: xml/%.xml stylesheets/drafthtml.xsl
-	$(cmd) id=`sed -e 's/.*id=.//; tmatch; d; :match; s/["'"'"'].*//; q' $<`; \
+	$(cmd) id=`$(SED) -e 's/.*id=.//' -e tmatch \
+	                  -e d -e :match \
+			  -e 's/["'"'"'].*//' \
+			  -e q $<`; \
 	test -n "$${id}" || id=noname; \
-	lang=$(shell echo $< | sed -e 's,^xml/,,; s,/.*,,'); \
+	lang=$(shell echo $< | $(SED) -e 's,^xml/,,; s,/.*,,'); \
 	destdir=html/$${lang}; \
 	test -d $${destdir}/images || $(RMAKE) $${destdir}/images; \
 	cp -f $(srcdir)/stylesheets/*.css $(srcdir)/stylesheets/$${lang}/*.css\
@@ -546,21 +559,9 @@
 preview-src/%.xml: $(foreach lang,$(LANGUAGES),preview-xml/$(lang)/%.xml)
 	$(msg) "(Remember that links won't work in a draft file.)"
 
-ifeq ("$(XDGOPEN)", "")
-preview-po/%.po: preview-xml/%.xml ;
-else
-preview-po/%.po: preview-xml/%.xml
-	$(cmd) if type "$(XDGOPEN)" >/dev/null 2>&1; then \
-		xml=$(shell echo $< | sed -e 's|preview-||'); \
-		lang=`echo $${xml} | sed -e 's,^xml/,,; s,/.*,,'`; \
-		id=`sed -e 's/.*id=.//; tmatch; d; \
-		            :match; s/["'"'"'].*//; q' $${xml}`; \
-		test -n "$${id}" || id=noname; \
-		destfile="html/$${lang}/$${id}-draft.html"; \
-		test -e $${destfile} && $(XDGOPEN) $${destfile}; \
-	fi
-endif
-
+preview-po/%.po:
+	@echo >&2 "After merging pofiles this feature does not work any more."
+	@echo >&2 "Use 'make ... preview-xml/$*.xml'."
 
 # For backward compatibility:
 

Modified: trunk/Makefile.am
==============================================================================
--- trunk/Makefile.am	(original)
+++ trunk/Makefile.am	Mon Feb  2 21:38:50 2009
@@ -31,7 +31,7 @@
 ## MSGCAT        = msgcat 
 MSGCATFLAGS   = --width=$(MSGWIDTH)
 ## MSGINIT       = msginit
-## MSGINITFLAGS  = --no-translator
+MSGINITFLAGS  = --no-translator --width=$(MSGWIDTH)
 ## MSGFMT        = msgfmt
 ## MSGFMTFLAGS   = --check --use-fuzzy --statistics
 ## MSGMERGE      = msgmerge
@@ -236,12 +236,15 @@
 pot2po = if [ -s $(3) ]; then \
              with_compendium="$(shell $(call get_compendium,$3))"; \
              tmpfile=$(3).tmp; \
-             $(MSGFMT)   $(MSGFMTFLAGS)   $(3); \
+             $(MSGFMT) $(MSGFMTFLAGS) $(3); \
+             rm -f messages.po messages.gmo; \
              $(MSGMERGE) $(MSGMERGEFLAGS) $${with_compendium} $(3) $(1) \
              > $${tmpfile}; \
              test -s  $${tmpfile} && mv -f $${tmpfile} $(3) || rm -f $${tmpfile}; \
          else \
-             $(MSGINIT)  $(MSGINITFLAGS) --input $(1) --locale=$(2) --output $(3); \
+             $(MSGINIT) $(MSGINITFLAGS) --input $(1) --locale=$(2) --output=- \
+             | $(SED) -e '/Plural-Forms:/d' \
+             > $(3); \
          fi
 
 # Merge PO file into (translated) XML file
@@ -319,7 +322,13 @@
 # Targets suitable for command line
 # ("make pot" will work even if pot exists)
 pot: potfiles ;
-potfiles: $(POT_FILES) ;
+potfiles: $(POT_FILES)
+	$(msg) "--- Cleaning up pot files ..."
+	$(cmd) find pot $(file_predicates) | \
+	while read potfile; do \
+		potfile=$${potfile#pot/}; srcfile=src/$${potfile%.pot}.xml \
+		test -e $${srcfile} || rm -f $${potfile}; \
+	done
 
 
 ########################################################################
@@ -468,7 +477,8 @@
 	$(cmd) test -s $< && cat $<
 
 # HIDE FROM AUTOMAKE #define MAKE_XMLLINT_RULES
-# HIDE FROM AUTOMAKE #log/$(1)-xmllint.log: log $$($(1)_XML_FILES)
+# HIDE FROM AUTOMAKE #log/$(1)-xmllint.log: $$($(1)_XML_FILES)
+# HIDE FROM AUTOMAKE #	$$(cmd) $$(call make_target_dir,$$(@))
 # HIDE FROM AUTOMAKE #	$$(cmd) if type $$(XMLLINT) >/dev/null 2>&1; then \
 # HIDE FROM AUTOMAKE #		echo "*** Validating XML ($(1)) ... "; \
 # HIDE FROM AUTOMAKE #		$$(XMLLINT) $$(XMLLINTFLAGS) --xinclude xml/$(1)/gimp.xml \
@@ -626,7 +636,10 @@
 ########################################################################
 
 preview-xml/%.xml: xml/%.xml stylesheets/drafthtml.xsl
-	$(cmd) id=`sed -e 's/.*id=.//; tmatch; d; :match; s/["'"'"'].*//; q' $<`; \
+	$(cmd) id=`$(SED) -e 's/.*id=.//' -e tmatch \
+	                  -e d -e :match \
+			  -e 's/["'"'"'].*//' \
+			  -e q $<`; \
 	test -n "$${id}" || id=noname; \
 	lang=$(shell echo $< | sed -e 's,^xml/,,; s,/.*,,'); \
 	destdir=html/$${lang}; \
@@ -645,11 +658,13 @@
 	    $(srcdir)/stylesheets/drafthtml.xsl \
 	    $<
 
-preview-po/%.po: preview-xml/%.xml ;
-
 preview-src/%.xml: $(foreach lang,$(LANGUAGES),preview-xml/$(lang)/%.xml)
 	$(msg) "(Remember that links won't work in a draft file.)"
 
+preview-po/%.po:
+	@echo >&2 "After merging pofiles this feature does not work any more."
+	@echo >&2 "Use 'make ... preview-xml/$*.xml'."
+
 # For backward compatibility:
 
 xml/%.draft: preview-xml/%.xml

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Mon Feb  2 21:38:50 2009
@@ -164,9 +164,6 @@
 ** See the file 'INSTALL' for more help.])
 fi
 
-MSGINITFLAGS="--no-translator"
-AC_SUBST(MSGINITFLAGS)
-
 
 AC_PATH_PROG(MSGMERGE, msgmerge)
 if test -z "$MSGMERGE" && test "x$enable_build" = "xyes"; then

Modified: trunk/tools/get_po_status.pl
==============================================================================
--- trunk/tools/get_po_status.pl	(original)
+++ trunk/tools/get_po_status.pl	Mon Feb  2 21:38:50 2009
@@ -49,7 +49,7 @@
 use File::Find;
 
 my $PROG = $0;
-my $VERSION = 0.01;
+my $VERSION = 0.02;
 
 my %Languages = (
 	de => "German",
@@ -158,33 +158,36 @@
 		my $statistics = `msgfmt --statistics $_ 2>&1`;
 		# TODO: better do regex matching here?
 		chomp $statistics;
-		print "$_ $statistics\n";
+		my $filesize = (lstat())[7] || 0;
+		print "$_ $filesize $statistics\n";
 	}
 	close STDOUT or die "ERROR: Cannot close pipe (w): $!\n";
 	exit;
 }
 
 # Parent process
-my ($translated, $fuzzy, $untranslated) = (0, 0, 0);
+my ($translated, $size, $fuzzy, $untranslated) = (0) x 4;
 my $msg_re = qr/^   (\S+) \s                     # $1 = filename
-                    (\S+) \s translated   \D+    # $2 = translated msgs.
-                (?: (\S+) \s fuzzy        \D+ )? # $3 = fuzzy msgs.
-                (?: (\S+) \s untranslated \D+ )? # $4 = untranslated msgs.
+                    (\d+) \s                     # $2 = filesize
+                    (\S+) \s translated   \D+    # $3 = translated msgs.
+                (?: (\S+) \s fuzzy        \D+ )? # $4 = fuzzy msgs.
+                (?: (\S+) \s untranslated \D+ )? # $5 = untranslated msgs.
                 $/ix;
 while (<MSGFMT>) {
 	m/$msg_re/ or die("ERROR matching msgfmt output '$_'\n");
-	my ($n, $t, $f, $u) = ($1, $2, $3 || 0, $4 || 0);
-	print_file_statistics($n, $t, $f, $u);
+	my ($n, $s, $t, $f, $u) = ($1, $2, $3, $4 || 0, $5 || 0);
+	print_file_statistics($n, $s, $t, $f, $u);
 }
 close MSGFMT or die "ERROR: Cannot close pipe (r): $!\n";
-print_summary($translated, $fuzzy, $untranslated);
+print_summary($translated, $fuzzy, $untranslated, $size);
 
 
 # ------------------------------------------------------
 sub print_file_statistics
 # ------------------------------------------------------
 {
-	my ($n, $t, $f, $u) = @_;
+	my ($n, $s, $t, $f, $u) = @_;
+        $size += $s;
 	$translated += $t;
 	$untranslated += $u;
 	$fuzzy += $f;
@@ -197,18 +200,15 @@
 sub print_summary
 # ------------------------------------------------------
 {
-	my ($translated, $fuzzy, $untranslated) = @_;
+	my ($translated, $fuzzy, $untranslated, $size) = @_;
 	my $total = $translated + $fuzzy + $untranslated;
 
         if ($Print_summary) {
 		print "\n" if $Print_file_list;
-		print
-		    "total: ", $total, " strings in ",
-		    scalar @Pofiles, " files:\n    ",
-		    "translated=", $translated, " ",
-		    "fuzzy=", $fuzzy, " ",
-		    "untranslated=", $untranslated, " ",
-		    "\n";
+                printf "total: %d strings in %d files (%d Bytes):\n" .
+                       "    translated=%d fuzzy=%d untranslated=%d\n",
+                       $total, scalar @Pofiles, $size,
+                       $translated, $fuzzy, $untranslated;
 	}
 
 	if ($Print_progress) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]