[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-i18n-doc
Subject:    Re: RFC: Out with %n in KDE4
From:       Nicolas Goutte <nicolasg () snafu ! de>
Date:       2006-07-15 14:09:19
Message-ID: 200607151609.19830.nicolasg () snafu ! de
[Download RAW message or body]

On Saturday 15 July 2006 15:32, Nicolas Goutte wrote:
> On Saturday 15 July 2006 14:32, Chusslove Illich wrote:
> > > [: Nicolas Goutte :]
> > > No please. %1 is Qt and not standard Gettext for plurals
> > >
> > > So again this would be a KDE-ism (and not even a Qt-ism) and therefore
> > > you would again need a translation tools that knows about KDE. [...]
> >
> > Actually, in standard Gettext there is no concept of placeholder for
> > plurals. Using pure Gettext calls, one has to specify plural-deciding
> > argument separately from placeholder arguments, eg:
> >
> > printf(gettextn("%d file in %s.\n", "%d files in %s.\n", nfiles),
> >        nfiles, dirpath);
> >
> > (note nfiles repeated twice, once to choose plural form, then to
> > substitute the placeholder).
> >
> > Gettext however knows about several forms of placeholders, in order to do
> > matching checks. Among them there is also qt-format, which will be set
> > for messages with %number if xgettext is run with option -qt.
> >
> > So, by having only %numbers in messages, we would gain extra support from
> > Gettext.
>
> What I mean is that we must be very careful.
>
> GNU uses plural with printf, so perhaps some translation programs could
> assume that too. And especially as we do not know the state of KBabel
> (which is currently at 0% usability on KDE4, if nothing has changed in the
> meanwhile).
>
> Also from the point of view of the translators, Gettext examples of plurals
> are with %d. And the more KDE4 has differences, the more we would have to
> explain.
>
> Another point is that developer will continue to write "One item", "%n
> items" (be %n now be written %1 or %d in KDE4) like now, so that you do not
> have the %1 anymore. (How does msgfmt --check react with such a qt-format
> entry?)
>

Too bad! I have some quick tests and msgfmt --check is really a problem here.

It complains on something like:

#, qt-format
msgid "One entry"
msgid_plural "%1 entries"
msgstr[0] "One entry"
msgstr[1] "%1 entries"

as %1 does not appear in all translations

However with c-format, something like that is possible.

#, c-format
msgid "One entry"
msgid_plural "%d entries"
msgstr[0] "One entry"
msgstr[1] "%d entries"

That is quite an example of what kind of subtle problems that we might have if 
we would choose not to use %d (or %n).

However, as far as I have understood,, complete support of msgfmt --check in 
KDE4 was very welcomed by the translators.

(...)

Have a nice day!
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic