QDateTimeParser::getAmPmText() use QLocale instead of tr()

I am not convinced toUpper/toLower is a generally sound solution here;
however, QLocale doesn't make the upper/lower case distinction this
parser does and a bug report shows tr() isn't doing an adequate job.

Task-number: QTBUG-47815
Change-Id: Iaf654d1d76d4c38d74fc647e168d50debb924a8f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Edward Welbourne 2016-04-04 11:19:53 +02:00 committed by Edward Welbourne
parent 3b0ea78603
commit 6c473b7e08

View File

@ -1712,11 +1712,9 @@ QDateTime QDateTimeParser::getMaximum() const
QString QDateTimeParser::getAmPmText(AmPm ap, Case cs) const QString QDateTimeParser::getAmPmText(AmPm ap, Case cs) const
{ {
if (ap == AmText) { const QLocale loc = locale();
return (cs == UpperCase ? tr("AM") : tr("am")); QString raw = ap == AmText ? loc.amText() : loc.pmText();
} else { return cs == UpperCase ? raw.toUpper() : raw.toLower();
return (cs == UpperCase ? tr("PM") : tr("pm"));
}
} }
/* /*