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

List:       kde-devel
Subject:    Re: How properly convert language codes from KGlobal::locale() into RFC 5646 (used in xml:lang attri
From:       John Layt <jlayt () kde ! org>
Date:       2012-01-28 18:06:30
Message-ID: CAM1DM6nJ-Ex+wLvYXMbXZQERgiLXcaFMrL2xALt2KF+gC_XSsg () mail ! gmail ! com
[Download RAW message or body]

> I'd like to write a patch that chooses proper name according to
> KGlobal::locale()->languageList() settings. But I met a problem:

> But KGlobal::locale()->languageList() returns language code in 'en_US' format
> (even do not know what RFC is that, google does not help ;-) )

That's the POSIX Locale Name standard that incorporates country and
optionally script.  The languageList() returns the preferred list of
languages the user has selected and it's almost certain you don't want
to be using that directly.  If you do need to extract the language
code only from the locale name then you need to use
QLocale::splitLocale() to separate the language name out.

If you're just wanting a translation into the users preferred locale
language of any language name then you want
KLocale::languageCodeToName().

John.

>> 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