How to do l10n for dynamic strings in KDE4 ?

Andras Mantia amantia at kdewebdev.org
Sat Mar 4 13:46:38 GMT 2006


> Am Samstag, 4. März 2006 13:12 schrieb Nicolas Goutte:

> I knew somhow it could get misunderstood. No, actuallly I dindn't mean
> Babelfish lookup. ;-)
> I meant doing i18n() on a dynamic looked up string instead of a const
> char*, like:
>
> i18n( mixercontrol->getName() );        /* vs */        i18n("CD Audio");
You coudl mark the strings to be translated (either by defining dummy
QStrings like s=i18n("CD Audio"); s=i18n("Master Volume") or by using
I18N_NOOP) and later use

i18n(mixertcontrol->getName().utf8());

AFAIK it will not work with QString, you have to convert it to a UTF8 char*.

Of course, you can put the strings to an XML file as well and update the
messages target to extract the strings from there for translation.

We do all of the above in Quanta.

Andras




More information about the kde-core-devel mailing list