Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Change language of date
Forum Updated to NodeBB v4.3 + New Features

Change language of date

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
qmldatelanguage
1 Posts 1 Posters 982 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    helenebro
    wrote on 15 Feb 2016, 09:00 last edited by helenebro
    #1

    Hi,
    I want display an date on a app but the language isn't correct.

    
    var dateProgramme = Date.fromLocaleString(Qt.locale("en_US"), previewInfo.dataCurrentItem.dateDiffusion, "dd/MM/yyyy")
    console.log(dateProgramme); // Display date in french : "lun. févr. 15 00:00:00 2016 GMT+0100"
    

    I have tried to change qlocale language on main.cpp but it change nothing. (It seems language is only change on cpp).

    QLocale curLocale(QLocale("en_US"));
    QLocale::setDefault(curLocale);
    QDate date = QDate::currentDate();
    QString dateString = QLocale().toString(date);
    qDebug() << dateString; //Display date in english:  "Monday, February 15, 2016" 
    

    How can I change language on qml ?

    1 Reply Last reply
    0

    1/1

    15 Feb 2016, 09:00

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved