bug-gettext
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Question from Austin Group regarding standardization of msgfmt


From: Eric Blake
Subject: Question from Austin Group regarding standardization of msgfmt
Date: Wed, 12 Jan 2022 08:04:16 -0600
User-agent: NeoMutt/20211029-182-90c72c

The Austin Group (the standards body in charge of the POSIX document)
is trying to standardize the gettext(3) family of functions, as well
as command line tools such as gettext(1) and xgettext(1).  You can
track the efforts here, and if you have comments, I'm happy to relay
them back to the Austin Group:

https://posix.rhansen.org/p/gettext_draft

At the moment, there is a particular question about GNU msgfmt(1)
behavior.  The Austin Group has noted the current documented
behaviors, first with GNU xgettext having two two separate options, -c
and -v, which are currently orthogonal:

       -c, --check
              perform    all    the    checks   implied   by   --check-format,
              --check-header, --check-domain

       -v, --verbose
              increase verbosity level

and contrasting with Solaris msgfmt
(https://docs.oracle.com/cd/E36784_01/html/E36870/msgfmt-1.html),
which has no -c, but documents:

–v
–−verbose

    Verbose. Lists duplicate message identifiers if Solaris message
    catalog files are processed. Message strings are not redefined.

    If GNU-compatible message files are processed, this option detects
    and diagnoses input file anomalies which might represent
    translation errors. The msgid and msgstr strings are studied and
    compared. It is considered abnormal if one string starts or ends
    with a newline while the other does not. Also, if the string
    represents a format string used in a printf-like function, both
    strings should have the same number of % format specifiers, with
    matching types. If the flag c-format appears in the special
    comment '#' for this entry, a check is performed.

The question on the floor is whether GNU msgfmt would consider
tweaking behavior so that -v implies -c (that is, turning on verbosity
now also turns on format checking), so that there is one less option
letter to standardize, and so that users can just rely on 'msgfmt -v'
for message checking regardless of GNU or Solaris implementation.

Or put another way, the Austin Group would like to standardize only:

     -v    Verbose. If this option is specified, msgfmt shall detect and
    diagnose input file abnormalities which might represent
    translation errors. The msgid and msgstr strings shall be
    compared. It shall be considered abnormal if one string starts or
    ends with a <newline> while the other does not.  Also, if the flag
    c-format appears in a "#," comment for this entry, it shall be
    considered abnormal if the strings do not have the same number of
    '%' conversion specifiers, or if corresponding conversion
    specifiers take different argument types (see [xref to
    fprintf()]). If an abnormality is detected, the exit status shall
    be non-zero and a diagnostic message shall be output.

which would still leave -c as a GNU extension, but give users the
ability to get format checking across both implementations with just
-v.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org




reply via email to

[Prev in Thread] Current Thread [Next in Thread]