Why is QLocale.system() showing a different locale than one constructed from language code?

Viewed 27

My system locale is Portuguese (Brazil):

>>> sys_locale = QLocale.system()
>>> QLocale.languageToString(sys_locale.language())
'Portuguese'
>>> QLocale.countryToString(sys_locale.country())
'Brazil'

When comparing it to a QLocale constructed with the language code that represents it, the result is not equal:

>>> sys_locale == QLocale('pt_BR')
False

Constructing a QLocale with parameters from system locale works, though:

>>> pt_br = QLocale(sys_locale.language(), sys_locale.country())
>>> pt_br == QLocale('pt_BR')
True

Why is that?

0 Answers
Related