QLocale().toString in french canadian



  • Hello,
    i'm translating my app and trying to display number in the locale of the user. So I use

    QLocale().toString( aValue, 'f', mDecimals )

    If the locale is
    QLocale( QLocale::French, QLocale::France ) the numbers are displayed correctly ( colon before the decimals), however, its the locale is QLocale( QLocale::French, QLocale::Canada), the numbers are displayed using english settings. Is this a bug or am I misusing the toString function?

    Thanks


  • Lifetime Qt Champion

    Hi,

    Can you show how you create the QLocale object and use the numbers with it ?



  • Hi, I keep the default locale, so its just like the example in my previous post (aValue is a float or a double) :

    QLocale().toString( aValue, 'f', mDecimals )
    

    or

    QLocale().toString( aValue )
    

    Right now, i'm using this as a workaround :

    if( QLocale().language() == QLocale::French )
    {
        QLocale lLocale = QLocale( QLocale::French, QLocale::France ) ;
        QLocale::setDefault( lLocale );
    }

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.