Extra characters from .toLocaleCurrencyString()
-
Hi,
I'm working on a QML application that needs to display prices in various languages. When someone chooses a language, I use qsTr() to translate text strings, which works great. When I go to display prices, I want to use the .toLocaleCurrencyString() feature, but it's doing something confusing:
If I want to display in US English, I can say:
priceButton.text = qsTr("Regular (%1)").arg(Number(5.0).toLocaleCurrencyString(Qt.locale("en_US")))
... and I get a properly formatted "$5.00" ... so far so good. If I want to display in Greek, I can say
priceButton.text = qsTr("Regular (%1)").arg(Number(5.0).toLocaleCurrencyString(Qt.locale("el_GR")))
... and I get "5,00 €" ... also good. Likewise French: with "fr_FR" I see the same "5,00 €". Now what about Canada? I say
priceButton.text = qsTr("Regular (%1)").arg(Number(5.0).toLocaleCurrencyString(Qt.locale("fr_CA")))
... now I see "5,00 k$". Same with es_US: I get "5.00 K $" ... even es_MX gives me "5,00 k$" (same as fr_CA, not es_US)
Does anyone know where this extra character might be coming from? Do I have the wrong language codes or something?
Thanks!
-
Hi,
What version of Qt are you using ?
On what platform ? -
Can you provide a complete minimal compilable example that shows that behaviour ?