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: Bruno Haible
Subject: Re: [Translation-i18n] Handling qt-format in gettext tools (was: Updating qt-format handling?)
Date: Tue, 11 Sep 2007 03:12:24 +0200
User-agent: KMail/1.5.4

Chusslove Illich wrote:
> 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.

Thanks. Using google codesearch, I found a copy at
  http://archive.ubuntu.com/ubuntu/pool/universe/k/kde4libs/

> 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.

Yup. That explains why they never encountered the warning...

> I realize that, strictly speaking, KDE format is thus still not quite
> qt-format.

Yes. Qt format strings support %0 and %04 etc, KDE4 format strings don't.
Qt format strings support at most %99, in KDE4 format strings the argument
number is unlimited. Qt format strings can use %1 %5 without %2 %3 %4, KDE4
format strings cannot. Etc...

A new format-kde flag is needed to support this. And xgettext need a --kde
option, similar to its --qt option.

But I'm glad that your implementation substitutes all argument strings
simultaneously into the string, so that it's safe when some of the argument
strings contain % signs.

> any project which wants Gettext plurals with Qt, would have to come up
> with its own way of handling omitted number directive.

Yes, I agree. There was no other solution than to define your own format
string semantics.

Bruno





reply via email to

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