mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
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:
parent
da139c1777
commit
4015667bbe
@ -26,28 +26,30 @@ AC_PROG_SED
|
|||||||
AC_PATH_PROG(XGETTEXT, xgettext, [no])
|
AC_PATH_PROG(XGETTEXT, xgettext, [no])
|
||||||
if test "x$XGETTEXT" = "xno"; then
|
if test "x$XGETTEXT" = "xno"; then
|
||||||
AC_MSG_ERROR([xgettext not found, install gettext])
|
AC_MSG_ERROR([xgettext not found, install gettext])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_PATH_PROG(MSGFMT, msgfmt, [no])
|
AC_PATH_PROG(MSGFMT, msgfmt, [no])
|
||||||
if test "x$MSGFMT" = "xno"; then
|
if test "x$MSGFMT" = "xno"; then
|
||||||
AC_MSG_ERROR([msgfmt not found, install gettext])
|
AC_MSG_ERROR([msgfmt not found, install gettext])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_PATH_PROG(MSGINIT, msginit, [no])
|
AC_PATH_PROG(MSGINIT, msginit, [no])
|
||||||
if test "x$MSGINIT" = "xno"; then
|
if test "x$MSGINIT" = "xno"; then
|
||||||
AC_MSG_ERROR([msginit not found, install gettext])
|
AC_MSG_ERROR([msginit not found, install gettext])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_PATH_PROG(MSGMERGE, msgmerge, [no])
|
AC_PATH_PROG(MSGMERGE, msgmerge, [no])
|
||||||
if test "x$MSGMERGE" = "xno"; then
|
if test "x$MSGMERGE" = "xno"; then
|
||||||
AC_MSG_ERROR([msgmerge not found, install gettext])
|
AC_MSG_ERROR([msgmerge not found, install gettext])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_PATH_PROG(MSGCMP, msgcmp, [no])
|
AC_PATH_PROG(MSGCMP, msgcmp, [no])
|
||||||
if test "x$MSGCMP" = "xno"; then
|
if test "x$MSGCMP" = "xno"; then
|
||||||
AC_MSG_ERROR([msgcmp not found, install gettext])
|
AC_MSG_ERROR([msgcmp not found, install gettext])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
AC_PATH_PROG(TX, tx, [/usr/bin/tx])
|
||||||
|
|
||||||
AC_ARG_WITH([gettext_domain],
|
AC_ARG_WITH([gettext_domain],
|
||||||
[AS_HELP_STRING([--with-gettext-domain=name],
|
[AS_HELP_STRING([--with-gettext-domain=name],
|
||||||
[set the name of the i18n message catalog])],
|
[set the name of the i18n message catalog])],
|
||||||
|
@ -15,6 +15,7 @@ MSGFMT = @MSGFMT@
|
|||||||
MSGINIT = @MSGINIT@
|
MSGINIT = @MSGINIT@
|
||||||
MSGMERGE = @MSGMERGE@
|
MSGMERGE = @MSGMERGE@
|
||||||
MSGCMP = @MSGCMP@
|
MSGCMP = @MSGCMP@
|
||||||
|
TX = @TX@
|
||||||
|
|
||||||
DOMAIN = @GETTEXT_DOMAIN@
|
DOMAIN = @GETTEXT_DOMAIN@
|
||||||
MSGMERGE_UPDATE = $(MSGMERGE) --update
|
MSGMERGE_UPDATE = $(MSGMERGE) --update
|
||||||
@ -80,7 +81,7 @@ $(po_files): $(DOMAIN).pot
|
|||||||
$(MSGINIT) --locale $$lang --no-translator -i $(DOMAIN).pot -o $@; \
|
$(MSGINIT) --locale $$lang --no-translator -i $(DOMAIN).pot -o $@; \
|
||||||
fi; \
|
fi; \
|
||||||
echo Merging $(DOMAIN).pot into $@; \
|
echo Merging $(DOMAIN).pot into $@; \
|
||||||
$(MSGMERGE) $@ -o $@ $(DOMAIN).pot
|
$(MSGMERGE) --no-fuzzy-matching -o $@ $@ $(DOMAIN).pot
|
||||||
|
|
||||||
create-po: $(DOMAIN).pot
|
create-po: $(DOMAIN).pot
|
||||||
@for po_file in $(po_files); do \
|
@for po_file in $(po_files); do \
|
||||||
@ -91,6 +92,10 @@ create-po: $(DOMAIN).pot
|
|||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
pull-po:
|
||||||
|
cd ../..; $(TX) pull -f
|
||||||
|
|
||||||
update-po: update-pot
|
update-po: update-pot
|
||||||
$(MAKE) $(po_files)
|
$(MAKE) $(po_files)
|
||||||
|
|
||||||
@ -134,17 +139,16 @@ msg-stats:
|
|||||||
printf "%s\n", groups[2];}'` ; \
|
printf "%s\n", groups[2];}'` ; \
|
||||||
echo "$(DOMAIN).pot has $$pot_count messages. There are $(po_count) po translation files." ; \
|
echo "$(DOMAIN).pot has $$pot_count messages. There are $(po_count) po translation files." ; \
|
||||||
for po_file in $(po_files); do \
|
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 \
|
$(AWK) -v po_file=$$po_file -v pot_count=$$pot_count -v pot_file=$(DOMAIN).pot \
|
||||||
'BEGIN {po_untranslated=0; undefined=0; \
|
'BEGIN {po_name = gensub(/\.po$$/, "", 1, po_file);} \
|
||||||
po_name = gensub(/.po$$/, "", 1, po_file)} \
|
match($$0, /([[:digit:]]+) translated/, group) {translated = group[1]} \
|
||||||
/this message is untranslated/ {po_untranslated++} \
|
match($$0, /([[:digit:]]+) untranslated/, group) {untranslated = group[1]} \
|
||||||
/this message is used but not defined/ {undefined++} \
|
match($$0, /([[:digit:]]+) fuzzy/, group) {fuzzy = group[1]} \
|
||||||
END {untranslated = po_untranslated+undefined; \
|
END {pot_untranslated = pot_count - translated; \
|
||||||
translated = pot_count - untranslated; \
|
ratio = sprintf("%d/%d", translated, pot_count); \
|
||||||
ratio = sprintf("%d/%d", translated, pot_count); \
|
printf "%-7s %11s %5.1f%% %5d untranslated, %5d fuzzy\n", \
|
||||||
printf "%-7s %9s %5.1f%% %4d po untranslated, %4d missing, %4d untranslated\n", \
|
po_name ":", ratio, translated/pot_count*100.0, pot_untranslated, fuzzy;}'; \
|
||||||
po_name ":", ratio, translated/pot_count*100.0, po_untranslated, undefined, untranslated;}'; \
|
|
||||||
done
|
done
|
||||||
|
|
||||||
mo-files: $(mo_files)
|
mo-files: $(mo_files)
|
||||||
|
Loading…
Reference in New Issue
Block a user