summaryrefslogtreecommitdiffstats
path: root/install
diff options
context:
space:
mode:
authorJohn Dennis <jdennis@redhat.com>2011-08-17 18:27:45 -0400
committerMartin Kosek <mkosek@redhat.com>2011-08-18 14:25:58 +0200
commit4015667bbe9672df5099a58537f2f9fd0bc1e317 (patch)
tree5d7b363b2439aa0c10a707d1c3800776c123701a /install
parentda139c17778ce19614d4559882e9390fb5b7d5eb (diff)
downloadfreeipa-4015667bbe9672df5099a58537f2f9fd0bc1e317.tar.gz
freeipa-4015667bbe9672df5099a58537f2f9fd0bc1e317.tar.xz
freeipa-4015667bbe9672df5099a58537f2f9fd0bc1e317.zip
ticket 1650 - compute accurate translation statistics
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.
Diffstat (limited to 'install')
-rw-r--r--install/configure.ac10
-rw-r--r--install/po/Makefile.in26
2 files changed, 21 insertions, 15 deletions
diff --git a/install/configure.ac b/install/configure.ac
index 8a1dac635..f5ddab791 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 176c29eaa..00ff9f97c 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)