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

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

Handling qt-format in gettext tools


From: Chusslove Illich
Subject: Handling qt-format in gettext tools
Date: Wed, 11 Jul 2007 11:21:04 +0200
User-agent: KMail/1.9.5

(Posted before, but without gettext in the subject, stupid as it may be :)

----

The messages with placeholders (format strings) in KDE4 are going to be
proper qt-format (to the point of its own well-definedness), so we'd like to
have the POs pass msgfmt -c in the future.

However, qt-format specs in Gettext are a bit outdated, probably due to its
low usage (KDE didn't use it before, and there is also the native QtLinguist
format for pure Qt apps).

The current specifications for placeholder replacement in QString are given
here:

http://doc.trolltech.com/4.3/qstring.html#arg
http://doc.trolltech.com/4.3/qstring.html#arg-2

As I read (and tested), it is that:

1. The limit on placeholder numbers are no longer 1-9, but 1-99.

2. There is no special requirement on all placeholders being unique. Equal-
numbered placeholders are allowed, and will be substituted with the same
argument.

Points 1 and 2 are there to amend the following assertion by the Gettext
manual:

"...a directive consists of a `%' followed by a digit. The same directive
cannot occur more than once in a format string."

And now suggestions for some heuristics:

3. Since same-numbered placeholders represent same piece of data, I would
not insist on strict congruence between the number of same-numbered
placeholders in msgid and msgstr. It may be that the msgid uses %1 twice due
to sentence structure, whereas the translation can get away with a single %1
and a pronoun -- or vice versa. It is enough if each placeholder number from
msgid exists in msgstr at least once.

4. How about letting qt-format use the same heuristic for plural messages as
the c-format? Eg. not having to mention the placeholder in msgstr[x], if [x]
is used only for the case strictly n==1.

The four points above are what is needed to support KDE4 apps by msgfmt -c.
I think none of them is against (a bit loose) Qt specs, and KDE4 apps should
be by far the biggest user of qt-format.

---

(The attached patch executes these points and modifies test cases, but
doesn't update the docs/changelog and whatever else is needed.)

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

Attachment: qt-format-update.diff
Description: Text Data


reply via email to

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