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

List:       kde-core-devel
Subject:    Re: Fwd: Using multiple klocales uses stale translations
From:       Stephen Kelly <steveire () gmail ! com>
Date:       2010-11-08 23:29:13
Message-ID: iba14d$sk$1 () dough ! gmane ! org
[Download RAW message or body]

Chusslove Illich wrote:

>> [: Stephen Kelly :]
>> Clearly someone decided that should be commented out. Should what I am
>> trying work already, or does that need to be uncommented?
> 
> It was I who both added and later commented out that code. As per the
> note, I commented it out because I didn't think of the use case, even
> though KLocalizedString::toString methods advertise the capability :) So
> it should be uncommented, but let me first check what it will do to
> performance.

The use cases I'm trying to satisfy are where you need to create content in 
multiple locales, such as a mail-merge where the targets are in different 
locales and the content should be localized.

> 
>>   KLocale de("kwrite", "de");
>>   [...]
>>   kDebug() << de.formatDate(now, KLocale::ShortDate);
>>   kDebug() << fr.formatDate(now, KLocale::ShortDate);
>>
>> I always get the date in the system locale instead of de or fr. Shouldn't
>> that work?
> 
> The second argument to KLocale constructor is the language, whereas the
> date is determined by country, which is the third parameter. If the
> country parameter is left out, it is fetched from "the system" (whatever
> that means), hence what you are seeing.
> 

Thanks for that.

It took me a while to figure out that the country must be in lower case.

KLocale de_DE("kwrite", "de", "DE"); // does not work
KLocale de_DE("kwrite", "de_DE"); // does not work
KLocale de_DE("kwrite", "de_DE.UTF-8"); // does not work
KLocale de_DE("kwrite", "de", "de"); // works!

All the best,

Steve.

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

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