ticket 1650 (https://fedorahosted.org/freeipa/ticket/1650) has
an extensive discussion of the issues, please refer to that.

This patch does the following:

* does not count fuzzy translations when computing translation
  statistics via the "msg-stats" make target in install/po

* adds a new make target called "pull-po" which pulls updated po files
  from Transifex (configure.ac includes some trailing whitespace fixes)

* turns off the generation of fuzzy translation suggestions during the
  message merge phase.

--
John Dennis <jden...@redhat.com>

Looking to carve out IT costs?
www.redhat.com/carveoutcosts/
From d37942656cd88744a60c1cb5986a76a5c58eb099 Mon Sep 17 00:00:00 2001
From: John Dennis <jden...@redhat.com>
Date: Wed, 17 Aug 2011 18:27:45 -0400
Subject: [PATCH 39/39] ticket 1650 - compute accurate translation statistics
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit

ticket 1650 (https://fedorahosted.org/freeipa/ticket/1650) has
an extensive discussion of the issues, please refer to that.

This patch does the following:

* does not count fuzzy translations when computing translation
  statistics via the "msg-stats" make target in install/po

* adds a new make target called "pull-po" which pulls updated po files
  from Transifex (configure.ac includes some trailing whitespace fixes)

* turns off the generation of fuzzy translation suggestions during the
  message merge phase.
---
 install/configure.ac   |   10 ++++++----
 install/po/Makefile.in |   26 +++++++++++++++-----------
 2 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/install/configure.ac b/install/configure.ac
index 8a1dac6..f5ddab7 100644
--- a/install/configure.ac
+++ b/install/configure.ac
@@ -26,28 +26,30 @@ AC_PROG_SED
 AC_PATH_PROG(XGETTEXT, xgettext, [no])
 if test "x$XGETTEXT" = "xno"; then
     AC_MSG_ERROR([xgettext not found, install gettext])
-fi                                                                       
+fi
 
 AC_PATH_PROG(MSGFMT, msgfmt, [no])
 if test "x$MSGFMT" = "xno"; then
     AC_MSG_ERROR([msgfmt not found, install gettext])
-fi                                                                       
+fi
 
 AC_PATH_PROG(MSGINIT, msginit, [no])
 if test "x$MSGINIT" = "xno"; then
     AC_MSG_ERROR([msginit not found, install gettext])
-fi                                                                       
+fi
 
 AC_PATH_PROG(MSGMERGE, msgmerge, [no])
 if test "x$MSGMERGE" = "xno"; then
     AC_MSG_ERROR([msgmerge not found, install gettext])
-fi                                                                       
+fi
 
 AC_PATH_PROG(MSGCMP, msgcmp, [no])
 if test "x$MSGCMP" = "xno"; then
     AC_MSG_ERROR([msgcmp not found, install gettext])
 fi
 
+AC_PATH_PROG(TX, tx, [/usr/bin/tx])
+
 AC_ARG_WITH([gettext_domain],
   [AS_HELP_STRING([--with-gettext-domain=name],
     [set the name of the i18n message catalog])],
diff --git a/install/po/Makefile.in b/install/po/Makefile.in
index 176c29e..00ff9f9 100644
--- a/install/po/Makefile.in
+++ b/install/po/Makefile.in
@@ -15,6 +15,7 @@ MSGFMT = @MSGFMT@
 MSGINIT = @MSGINIT@
 MSGMERGE = @MSGMERGE@
 MSGCMP = @MSGCMP@
+TX = @TX@
 
 DOMAIN = @GETTEXT_DOMAIN@
 MSGMERGE_UPDATE = $(MSGMERGE) --update
@@ -80,7 +81,7 @@ $(po_files): $(DOMAIN).pot
 	    $(MSGINIT) --locale $$lang --no-translator -i $(DOMAIN).pot -o $@; \
 	fi; \
 	echo Merging $(DOMAIN).pot into $@; \
-	$(MSGMERGE) $@ -o $@ $(DOMAIN).pot
+	$(MSGMERGE) --no-fuzzy-matching -o $@ $@ $(DOMAIN).pot
 
 create-po: $(DOMAIN).pot
 	@for po_file in $(po_files); do \
@@ -91,6 +92,10 @@ create-po: $(DOMAIN).pot
 	    fi; \
 	done
 
+
+pull-po:
+	cd ../..; $(TX) pull -f
+
 update-po: update-pot
 	$(MAKE) $(po_files)
 
@@ -134,17 +139,16 @@ msg-stats:
 	      printf "%s\n", groups[2];}'` ; \
 	echo "$(DOMAIN).pot has $$pot_count messages. There are $(po_count) po translation files." ; \
 	for po_file in $(po_files); do \
-	    $(MSGCMP) $$po_file $(DOMAIN).pot 2>&1 | \
+	    $(MSGFMT) --statistics $$po_file 2>&1 | \
 	    $(AWK) -v po_file=$$po_file -v pot_count=$$pot_count -v pot_file=$(DOMAIN).pot \
-                'BEGIN {po_untranslated=0; undefined=0; \
-	                po_name = gensub(/.po$$/, "", 1, po_file)} \
-                /this message is untranslated/ {po_untranslated++} \
-                /this message is used but not defined/ {undefined++} \
-                END {untranslated = po_untranslated+undefined; \
-	             translated = pot_count - untranslated; \
-	             ratio = sprintf("%d/%d", translated, pot_count); \
-                     printf "%-7s %9s %5.1f%% %4d po untranslated, %4d missing, %4d untranslated\n", \
-                     po_name ":", ratio, translated/pot_count*100.0, po_untranslated, undefined, untranslated;}'; \
+	        'BEGIN {po_name = gensub(/\.po$$/, "", 1, po_file);} \
+                 match($$0, /([[:digit:]]+) translated/,   group) {translated   = group[1]} \
+                 match($$0, /([[:digit:]]+) untranslated/, group) {untranslated = group[1]} \
+                 match($$0, /([[:digit:]]+) fuzzy/,        group) {fuzzy        = group[1]} \
+		 END {pot_untranslated = pot_count - translated; \
+		      ratio = sprintf("%d/%d", translated, pot_count); \
+		      printf "%-7s %11s %5.1f%% %5d untranslated, %5d fuzzy\n", \
+		          po_name ":", ratio, translated/pot_count*100.0, pot_untranslated, fuzzy;}'; \
 	done
 
 mo-files: $(mo_files)
-- 
1.7.4.4

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to