[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: locale settings by language
From: David Faure <faure () kde ! org>
Date: 2005-07-26 0:32:55
Message-ID: 200507260232.55825.faure () kde ! org
[Download RAW message or body]
On Tuesday 26 July 2005 01:31, Tomasz Grobelny wrote:
> Is it possible to get locale settings for a given language? For example I want
> to format date in English while my current locale is Polish. If there is no
> appropriate function would such a code be safe (if it works at all):
> QString oldlang=KGlobal::locale()->language();
> KGlobal::locale()->setLanguage("en");
> QString dateInEnglish=KGlobal::locale()->formatDate(qdate);
> KGlobal::locale()->setLanguage(oldlang);
This isn't C, no need to set/reset a global state when you can instanciate a class ;-)
KLocale englishLanguage("en");
QString dateInEnglish = englishLanguage.formatDate(qdate);
should work. KSpread does something similar IIRC, to allow spreadsheet
documents to use a different locale from the KDE-global locale.
--
David Faure, faure@kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic