]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Make msgcmp's default behaviour more useful.
authorBruno Haible <bruno@clisp.org>
Wed, 4 Oct 2006 16:42:55 +0000 (16:42 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:14:04 +0000 (12:14 +0200)
NEWS
gettext-tools/doc/ChangeLog
gettext-tools/doc/msgcmp.texi
gettext-tools/src/ChangeLog
gettext-tools/src/msgcmp.c
gettext-tools/tests/ChangeLog
gettext-tools/tests/msgmerge-18

diff --git a/NEWS b/NEWS
index e270d8b0d396e4aec9b045ab00997b253ee814aa..ace4acd5aa6458aae12c5c1f707aac35885ef164 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,11 @@ Version 0.15.1 - October 2006
 * msgmerge is faster now on CPUs with multiple execution units, if compiled
   with GCC 4.2 or newer.
 
+* msgcmp now ignores fuzzy and untranslated messages in the PO file.
+  Previously it considered fuzzy and untranslated messages the same way as
+  translated messages, which was hardly useful.  The previous behaviour can
+  be obtained through the options --use-fuzzy --use-untranslated.
+
 * gettextize, when invoked without --intl option, now installs only the .m4
   files that are needed: gettext.m4, iconv.m4, lib-ld.m4, lib-link.m4,
   lib-prefix.m4, nls.m4, po.m4, progtest.m4.
index e49085448c39488d0fb2bdb2b6082852c01bbb83..0d6a6d3b086a94e2ecfed7fb77bab2329a2a5abb 100644 (file)
@@ -1,3 +1,7 @@
+2006-10-03  Bruno Haible  <bruno@clisp.org>
+
+       * msgcmp.texi: Document --use-fuzzy and --use-untranslated options.
+
 2006-10-01  Bruno Haible  <bruno@clisp.org>
 
        * gettext.texi (AM_GNU_GETTEXT): Mention the AM_GNU_GETTEXT_NEED
index b7f5a2a8b63dfe995fd79f03a3cc4b8370cec96c..3558a31bdd757ff08d4882c4116a07373c09882c 100644 (file)
@@ -40,6 +40,17 @@ searched relative to this list of directories.
 @opindex --multi-domain@r{, @code{msgcmp} option}
 Apply @var{ref}.pot to each of the domains in @var{def}.po.
 
+@item --use-fuzzy
+@opindex --use-fuzzy@r{, @code{msgcmp} option}
+Consider fuzzy messages in the @var{def}.po file like translated messages.
+Note that using this option is usually wrong, because fuzzy messages are
+exactly those which have not been validated by a human translator.
+
+@item --use-untranslated
+@opindex --use-untranslated@r{, @code{msgcmp} option}
+Consider untranslated messages in the @var{def}.po file like translated
+messages.  Note that using this option is usually wrong.
+
 @end table
 
 @subsection Input file syntax
index b4fcecadc7ad227eb35c6e12312a18f26136580f..a8ff9510a2a45d61c79d818bb34db8f97fdf1c29 100644 (file)
@@ -1,3 +1,11 @@
+2006-10-03  Bruno Haible  <bruno@clisp.org>
+
+       * msgcmp.c (include_fuzzies, include_untranslated): New variables.
+       (long_options): Add options --use-fuzzy, --use-untranslated.
+       (main): Handle them.
+       (usage): Document them.
+       (match_domain): Consider include_fuzzies and include_untranslated.
+
 2006-10-02  Bruno Haible  <bruno@clisp.org>
 
        * gettext-po.h.in (LIBGETTEXTPO_VERSION): Bump version number.
index 6d905d126f293d8921115e577ede5144c9becb95..662502339deb9cc624981e1e4ae3e654e3740360 100644 (file)
 /* Apply the .pot file to each of the domains in the PO file.  */
 static bool multi_domain_mode = false;
 
+/* Whether to consider fuzzy messages as translations.  */
+static bool include_fuzzies = false;
+
+/* Whether to consider untranslated messages as translations.  */
+static bool include_untranslated = false;
+
 /* Long options.  */
 static const struct option long_options[] =
 {
@@ -57,6 +63,8 @@ static const struct option long_options[] =
   { "multi-domain", no_argument, NULL, 'm' },
   { "properties-input", no_argument, NULL, 'P' },
   { "stringtable-input", no_argument, NULL, CHAR_MAX + 1 },
+  { "use-fuzzy", no_argument, NULL, CHAR_MAX + 2 },
+  { "use-untranslated", no_argument, NULL, CHAR_MAX + 3 },
   { "version", no_argument, NULL, 'V' },
   { NULL, 0, NULL, 0 }
 };
@@ -125,10 +133,18 @@ main (int argc, char *argv[])
        do_version = true;
        break;
 
-      case CHAR_MAX + 1: /* --stringtable-input */
+      case CHAR_MAX + 1:       /* --stringtable-input */
        input_syntax = syntax_stringtable;
        break;
 
+      case CHAR_MAX + 2:       /* --use-fuzzy */
+       include_fuzzies = true;
+       break;
+
+      case CHAR_MAX + 3:       /* --use-untranslated */
+       include_untranslated = true;
+       break;
+
       default:
        usage (EXIT_FAILURE);
        break;
@@ -209,6 +225,10 @@ Input file location:\n"));
 Operation modifiers:\n"));
       printf (_("\
   -m, --multi-domain          apply ref.pot to each of the domains in def.po\n"));
+      printf (_("\
+      --use-fuzzy             consider fuzzy entries\n"));
+      printf (_("\
+      --use-untranslated      consider untranslated entries\n"));
       printf ("\n");
       printf (_("\
 Input file syntax:\n"));
@@ -274,7 +294,22 @@ match_domain (const char *fn1, const char *fn2,
       /* See if it is in the other file.  */
       defmsg = message_list_search (defmlp, refmsg->msgctxt, refmsg->msgid);
       if (defmsg)
-       defmsg->used = 1;
+       {
+         if (!include_untranslated && defmsg->msgstr[0] == '\0')
+           {
+             (*nerrors)++;
+             po_gram_error_at_line (&defmsg->pos, _("\
+this message is untranslated"));
+           }
+         else if (!include_fuzzies && defmsg->is_fuzzy && !is_header (defmsg))
+           {
+             (*nerrors)++;
+             po_gram_error_at_line (&defmsg->pos, _("\
+this message needs to be reviewed by the translator"));
+           }
+         else
+           defmsg->used = 1;
+       }
       else
        {
          /* If the message was not defined at all, try to find a very
index 142399fdc7d51a00d671672e949fb01a619a92cc..9567ab7b7d16696151de4a427c891e9deccf39aa 100644 (file)
@@ -1,3 +1,8 @@
+2006-10-03  Bruno Haible  <bruno@clisp.org>
+
+       * msgmerge-18: Invoke msgcmp with options --use-fuzzy and
+       --use-untranslated.
+
 2006-10-01  Bruno Haible  <bruno@clisp.org>
 
        * xgettext-perl-6: New file.
index a4b6f946468b122f6c4c1c1901b8b89f0db98c14..de2197ce05a38c1afebe4ac6f677c592e2b9799c 100755 (executable)
@@ -117,7 +117,7 @@ msgstr ""
 EOF
 
 : ${MSGCMP=msgcmp}
-${MSGCMP} mm-test18.po mm-test18.pot 2>/dev/null
+${MSGCMP} --use-fuzzy --use-untranslated mm-test18.po mm-test18.pot 2>/dev/null
 test $? = 1 || { rm -fr $tmpfiles; exit 1; }
 
 tmpfiles="$tmpfiles mm-test18.new.po"
@@ -196,7 +196,7 @@ ${DIFF} mm-test18.ok mm-test18.new.po
 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
 
 : ${MSGCMP=msgcmp}
-${MSGCMP} mm-test18.new.po mm-test18.pot
+${MSGCMP} --use-fuzzy --use-untranslated mm-test18.new.po mm-test18.pot
 test $? = 0 || { rm -fr $tmpfiles; exit 1; }
 
 rm -fr $tmpfiles