>From 9e7ce93178ff0d10ce2bc9e69fb6cc8bd1c843c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81ngel=20Arruga=20Vivas?= Date: Mon, 21 Dec 2020 20:59:23 +0100 Subject: [PATCH 2/2] doc: Update plural form check documentation. * gettext-tools/doc/gettext.texi (Plural forms): Reference --check-format option of msgfmt. * gettext-tools/doc/msgfmt.texi (--check-format): Add anchor and add general documentation of the checks performed for plural forms. --- gettext-tools/doc/gettext.texi | 4 +++- gettext-tools/doc/msgfmt.texi | 12 +++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/gettext-tools/doc/gettext.texi b/gettext-tools/doc/gettext.texi index 90eba7997..3c347f18c 100644 --- a/gettext-tools/doc/gettext.texi +++ b/gettext-tools/doc/gettext.texi @@ -6656,7 +6656,9 @@ printf (ngettext ("%2$d file removed from directory %1$s", @end smallexample @noindent -See @ref{c-format} for details about this argument reordering syntax. +@xref{c-format} for details about this argument reordering syntax, and +@ref{option @option{--check-format} of msgfmt} for details about the +available checks for the translated messages. When you know that the value of @code{n} is within a given range, you can specify it as a comment directed to the @code{xgettext} tool. This diff --git a/gettext-tools/doc/msgfmt.texi b/gettext-tools/doc/msgfmt.texi index b5fd97f13..d7894d3ab 100644 --- a/gettext-tools/doc/msgfmt.texi +++ b/gettext-tools/doc/msgfmt.texi @@ -304,6 +304,7 @@ Perform all the checks implied by @code{--check-format}, @code{--check-header}, @code{--check-domain}. @item --check-format +@anchor{option @option{--check-format} of msgfmt} @opindex --check-format@r{, @code{msgfmt} option} @cindex check format strings Check language dependent format strings. @@ -311,12 +312,21 @@ Check language dependent format strings. If the string represents a format string used in a @code{printf}-like function both strings should have the same number of @samp{%} format specifiers, with matching types. If the flag -@code{c-format} or @code{possible-c-format} appears in the special +@code{c-format} or any other implemented syntax appears in the special comment @key{#,} for this entry a check is performed. For example, the check will diagnose using @samp{%.*s} against @samp{%s}, or @samp{%d} against @samp{%s}, or @samp{%d} against @samp{%x}. It can even handle positional parameters. +When the string is part of a plural form the check about the number of +specifiers is relaxed and the omission of one numeric format specifier +is allowed to allow clearer translations where the numeric identifier +can be redundant on any of the translated plural forms. Different +restrictions may apply depending on the format string syntax: +@code{printf}-like functions enforce that omitted parameter must be at +the end of the parameter list, and other formatting functions +(e.g. @pxref{python-format}) disallow the omission of any parameter. + Normally the @code{xgettext} program automatically decides whether a string is a format string or not. This algorithm is not perfect, though. It might regard a string as a format string though it is not -- 2.29.2