QLocale's bcp47Name() behavior
I'm trying to use "QLocale::bcp47Name()":http://qt-project.org/doc/qt-5.0/qtcore/qlocale.html#bcp47Name in order to get the dash separated codes for language and country, for example "en-US". No matter how I construct the locale, I always get only the language code:
qDebug() << locale.bcp47Name(); //prints "en"
Am I missing something?
What version of Qt are you using ?
What OS are you running ?
Qt 4.8.5 (self-built) outputs "en-US"
Qt 5.1.0 or 5.1.1 (official binaries) outputs "en"
However, if I substitute QLocale::Australia or QLocale::Jamaica then the Qt5 output becomes "en-AU" or "en-JM" as expected. Perhaps there is some (annoying) default to US English going on here.
IIRC, there's ICU that is used in Qt 5 that can explain this
Right now I'm using Qt5.2 beta on OS X 10.9, but soon I'll have access to other OS /Qt combinations.
@ChrisW67: This weird behavior is the same for all languages with default country. Try Spanish with Unites States and then with Spain, or Greek with Greece and then with Cyprus.
The United States is hardly the home country of English ;)
[quote author="ChrisW67" date="1384490196"]The United States is hardly the home country of English ;)[/quote]
Very true, but still Qt thinks different :-) QLocale::UnitedKingdom outputs "en-GB".
So, should I report this as a bug?
I think you can yes, don't forget to post the link to the report here so others may follow it :-)