From: Bruno Haible Date: Sat, 20 Oct 2007 19:59:34 +0000 (+0000) Subject: Improve checking in the case of absent plural expression. X-Git-Tag: v0.17~100 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=91742a913ffce2dbab2c68c426be58525b212092;p=thirdparty%2Fgettext.git Improve checking in the case of absent plural expression. --- diff --git a/gettext-tools/src/ChangeLog b/gettext-tools/src/ChangeLog index 538d5dd8a..c6fba9cc9 100644 --- a/gettext-tools/src/ChangeLog +++ b/gettext-tools/src/ChangeLog @@ -1,3 +1,9 @@ +2007-10-20 Bruno Haible + + * msgl-check.c (check_plural): If there is no header entry, or if the + header entry does not contain plural= and nplurals=, return a plural + distribution corresponding to the Germanic plural. + 2007-10-20 Bruno Haible * format.h (check_msgid_msgstr_format): Add plural_distribution_length diff --git a/gettext-tools/src/msgl-check.c b/gettext-tools/src/msgl-check.c index 0baee307f..3da11ff13 100644 --- a/gettext-tools/src/msgl-check.c +++ b/gettext-tools/src/msgl-check.c @@ -420,12 +420,22 @@ check_plural (message_list_ty *mlp, max_nplurals = n = min_nplurals. */ } } + else + goto no_plural; } - else if (has_plural != NULL) + else { - po_xerror (PO_SEVERITY_ERROR, has_plural, NULL, 0, 0, false, - _("message catalog has plural form translations, but lacks a header entry with \"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\"")); - seen_errors++; + if (has_plural != NULL) + { + po_xerror (PO_SEVERITY_ERROR, has_plural, NULL, 0, 0, false, + _("message catalog has plural form translations, but lacks a header entry with \"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\"")); + seen_errors++; + } + no_plural: + /* By default, the Germanic formula (n != 1) is used. */ + distribution = XCALLOC (2, unsigned char); + distribution[1] = 1; + distribution_length = 2; } /* distribution is not needed if we report errors.