diff options
author | Mike FABIAN <mike.fabian@basyskom.de> | 2010-06-21 15:41:38 +0200 |
---|---|---|
committer | Mike FABIAN <mike.fabian@basyskom.de> | 2010-06-21 17:56:00 +0200 |
commit | 128c7ea28e9796914883572d527f413774d77833 (patch) | |
tree | 3f812b019c1f4447c841028a2923f0db5180239a /demos | |
parent | a0df970d9dd26d0b37625cc26985c891faa4f391 (diff) |
Changes: document that formatDateTime() does not uppercase the first letter.
RevBy: Torsten Rahn, John Tapsell
Details:
MLocale’s formatDateTime() methods do not automatically uppercase the
first letter of the result because they cannot know in which context
the result will be used and depending on the context uppercasing maybe
correct or wrong.
Therefore it is left to the application to do the uppercasing if
needed.
Document this and give an example how an application could do the uppercasing
and put the sample code also in languagepage.cpp in widgetsgallery.
Diffstat (limited to 'demos')
-rw-r--r-- | demos/widgetsgallery/languagepage.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/demos/widgetsgallery/languagepage.cpp b/demos/widgetsgallery/languagepage.cpp index 34e80ec9..e0596bda 100644 --- a/demos/widgetsgallery/languagepage.cpp +++ b/demos/widgetsgallery/languagepage.cpp @@ -324,20 +324,25 @@ void LanguagePage::retranslateUi() labelHaveIcu->setText("ICU: " + qtTrId("qtn_comm_command_no")); #endif - QDate date(2008, 7, 21); - QTime time(14, 31, 0, 0); - QDateTime datetime(date, time, Qt::UTC); - //% "Number format example: %1\x9c!! Number example: %1\x9c!! Number: %1" labelExampleNumber->setText( qtTrId("xx_language_number_format") .arg(currentLocale.formatNumber(12345670.89))); + + QDate date(2008, 7, 21); + QTime time(14, 31, 0, 0); + QDateTime datetime(date, time, Qt::UTC); + QString formattedDateTime = + currentLocale.formatDateTime( + datetime, MLocale::DateFull, MLocale::TimeFull, + MLocale::GregorianCalendar); + if (!formattedDateTime.isEmpty()) + formattedDateTime[0] = formattedDateTime.at(0).toUpper(); + //% "Date and time format example: %1\x9c!! Date and time: %1\x9c!! Date: %1\x9c!! %1" labelExampleDateTime->setText( qtTrId("xx_langage_date_time_format") - .arg(currentLocale.formatDateTime( - datetime, MLocale::DateFull, MLocale::TimeFull, - MLocale::GregorianCalendar))); + .arg(formattedDateTime)); //% "Week number example: %1" labelExampleWeekNumber->setText( |