3

I would like to make a label with the date written on it in many languages. How can I translate it from english to the choosen language? Like this:

English:Thursday, 1 January 1970

Arabic:۱۹۷۰ الخميس, ۱ يناير

The code I used to get the date is:

QLabel *Time = new QLabel(QDate::currentDate().toString(Qt::SystemLocaleLongDate));
TheGathron
  • 53
  • 1
  • 3
  • 12

1 Answers1

4

You should use QLocale in order to convert a QDate to string.
This could be acheived like this :

    QLocale locale = QLocale(QLocale::Arabic, QLocale::Egypt);
    QString arabicDate = locale.toString(QDate::currentDate());
mpromonet
  • 11,326
  • 43
  • 62
  • 91