From kde-devel Tue Jul 26 13:00:30 2005 From: Tomasz Grobelny Date: Tue, 26 Jul 2005 13:00:30 +0000 To: kde-devel Subject: Re: locale settings by language Message-Id: <200507261500.30592.grotk () poczta ! onet ! pl> X-MARC-Message: https://marc.info/?l=kde-devel&m=112238290914673 Dnia Tuesday 26 of July 2005 02:32, David Faure napisał: > 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 ;-) > I felt it was not the best solution, that's why I asked. BTW, see kdepim/libkmime/kmime_util.cpp:715 > KLocale englishLanguage("en"); > QString dateInEnglish = englishLanguage.formatDate(qdate); > > should work. But it doesn't. Neither does my (previous) code. I have withhen sth like this: KLocale polishLanguage("pl_PL"); //"pl" doesn't work either ret = polishLanguage.formatDateTime(qdate, shortFormat, includeSecs); kdDebug()<> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<