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

List:       kde-i18n-doc
Subject:    Re: Plural handling
From:       Chusslove Illich <caslav.ilic () gmx ! net>
Date:       2006-03-23 21:06:44
Message-ID: 200603232206.44731.caslav.ilic () gmx ! net
[Download RAW message or body]


> [: Hasso Tepper :]
> 1) How to fix i18n() calls which have comment? As far as I can see,
> I have to choose - comment or plural handling.

At least, KDE4 will surely have a fourth i18n call, one with context and 
plural together.

> 2) What to do about stuff coming from *.ui files? Some of them handle 
> singular case in hackish way (for example with setSpecialValueText() in 
> case of QSpinBox), but that's not the correct way of course.

I haven't got a clue what practically needs to be done, but on the 
philosophical level, it is quite clear that every user visible piece of 
text needs to be retranslated whenever the attributes in its context 
change. Like the number and text in spinbox.

For KDE4, I am preparing a new class, KLocalizedString, which will stay 
"alive" after i18n call, unlike a "dead" QString that i18n calls return at 
the moment. In other words, KLocalizedString would have defered 
translations. Hypothetical K* widget could then use it for its context 
switching texts.

Eg. for widget needing shifts in plural, KLocalizedString could be used 
like this:

KLocalizedString msg = ki18np("1 day", "%n days"); // note missing number
KRandomWidget wiggy(..., msg, ...);

and somewhere in the widget, when number is switched:

d->msg.subs(d->value).toString(); // translation happens in toString()

This is one possible benefit of KLocalizedString, that just cropped up. It 
was designed to fix some latent bugs of current i18n system, have 
automatic localization of numbers, and, hopefully, the translation 
scripting we were talking about some months ago on this list :)

(For some reference, short porting guide will be: 
http://caslav.gmxhome.de/writings/kde4-porting-i18n.html )

-- 
Chusslove Illich (Часлав Илић)
Serbian KDE translation team

[Attachment #3 (application/pgp-signature)]

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

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