bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: [Translation-i18n] Handling qt-format in gettext tools (was: Updatin


From: Chusslove Illich
Subject: Re: [Translation-i18n] Handling qt-format in gettext tools (was: Updating qt-format handling?)
Date: Tue, 11 Sep 2007 01:36:48 +0200
User-agent: KMail/1.9.5

> [: Bruno Haible :]
> I don't understand it, nor the comment [...]
> [...]
> Does KDE something different? If so, can you point me to the source code,
> please?

The code is at
http://websvn.kde.org/trunk/KDE/kdelibs/kdecore/localization/klocalizedstring.cpp
method KLocalizedStringPrivate::substituteSimple, but the blasted web access
is down at the moment. On the other hand, I'm the maintainer of that
particular piece of code, so I know precisely what it does.

It seems to me that pure Qt, where a raw string from gettext call would be
directly routed to a QString and then arg() methods invoked, cannot use
gettextn properly -- precisely for the reason of not being able to
gracefully handle the case when number directive is omitted. Qt's native
translation system (Qt Linguist etc.) simply does not have plural handling.

Thus, in KDE3, there was a special %n (literal character n) placeholder
which KDE itself was either replacing with a plural-deciding number or not
complaining if omitted, and only then passing the result to QString. This
gave us problems with unwarranted c-format detection, actually making KDE
strings format on their own (we never could run msgfmt -c on KDE3 POs).

In KDE4, %n was thrown out to leverage the qt-format of Gettext, such that
i18n calls now handle directive substitution completely by themselves,
rather than letting QString's arg() methods muck around. And one feature is
that of allowing the number directive in a plural call to be missing,
without complaints.

I realize that, strictly speaking, KDE format is thus still not quite
qt-format. However, since KDE is by far the greatest user of Gettext in
combination with Qt (pure Qt projects usually use native Qt translation), I
thought that laxing a bit the qt-format specification on plural messages
would be acceptable. Or other way around, any project which wants Gettext
plurals with Qt, would have to come up with its own way of handling omitted
number directive.

-- 
Chusslove Illich (Часлав Илић)

Attachment: pgpGye_TnJ9A3.pgp
Description: PGP signature


reply via email to

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