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.
This commit is contained in:
John Dennis 2011-08-17 18:27:45 -04:00 committed by Martin Kosek
parent da139c1777
commit 4015667bbe
2 changed files with 21 additions and 15 deletions

View File

@ -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])],

View File

@ -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)