mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-23 18:32:55 +00:00
correct date/time format parsing and adjust some test cases
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
parent
215ced5fb8
commit
a0d3ba069a
3 changed files with 547 additions and 556 deletions
|
@ -550,7 +550,7 @@ localedefaults = {
|
|||
'list_pattern_part_mid': "%1, %2",
|
||||
'list_pattern_part_end': "%1, %2",
|
||||
'list_pattern_part_two': "%1, %2",
|
||||
'short_date_format': 'd MMM yyyy',
|
||||
'short_date_format': 'd MMM yyyy', # default in CLDR is y-MM-dd
|
||||
'long_date_format': 'd MMMM yyyy',
|
||||
'short_time_format': 'HH:mm:ss',
|
||||
'long_time_format': 'HH:mm:ss z',
|
||||
|
@ -760,8 +760,7 @@ def readlocale(fromxml, tomap, isparent):
|
|||
if not calendartype == 'gregorian':
|
||||
# all values should be from gregorian calendar
|
||||
continue
|
||||
dateformat = calendar.find('./dateFormats/dateFormatLength')
|
||||
if dateformat is not None:
|
||||
for dateformat in calendar.findall('./dateFormats/dateFormatLength'):
|
||||
dateformattype = dateformat.get('type')
|
||||
if dateformattype == 'short':
|
||||
pattern = dateformat.find('./dateFormat/pattern')
|
||||
|
@ -770,8 +769,7 @@ def readlocale(fromxml, tomap, isparent):
|
|||
pattern = dateformat.find('./dateFormat/pattern')
|
||||
tomap[locale]['long_date_format'] = todatetimeformat(pattern.text)
|
||||
|
||||
timeformat = calendar.find('./timeFormats/timeFormatLength')
|
||||
if timeformat is not None:
|
||||
for timeformat in calendar.findall('./timeFormats/timeFormatLength'):
|
||||
timeformattype = timeformat.get('type')
|
||||
if timeformattype == 'short':
|
||||
pattern = timeformat.find('./timeFormat/pattern')
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1589,19 +1589,16 @@ void tst_QLocale::dateFormat()
|
|||
QCOMPARE(c.dateFormat(QLocale::NarrowFormat), c.dateFormat(QLocale::ShortFormat));
|
||||
|
||||
const QLocale nn("nn_NO");
|
||||
QCOMPARE(nn.dateFormat(QLocale::NarrowFormat), QLatin1String("dd.MM.yy"));
|
||||
QCOMPARE(nn.dateFormat(QLocale::ShortFormat), QLatin1String("dd.MM.yy"));
|
||||
QCOMPARE(nn.dateFormat(QLocale::LongFormat), QLatin1String("dddd d. MMMM yyyy"));
|
||||
QCOMPARE(nn.dateFormat(QLocale::NarrowFormat), QLatin1String("dd.MM.y"));
|
||||
QCOMPARE(nn.dateFormat(QLocale::ShortFormat), QLatin1String("dd.MM.y"));
|
||||
QCOMPARE(nn.dateFormat(QLocale::LongFormat), QLatin1String("d. MMMM y"));
|
||||
|
||||
const QLocale ca("en_CA");
|
||||
QCOMPARE(ca.dateFormat(QLocale::ShortFormat), QLatin1String("M/d/yy"));
|
||||
QCOMPARE(ca.dateFormat(QLocale::LongFormat), QLatin1String("dddd, MMMM d, yyyy"));
|
||||
QCOMPARE(ca.dateFormat(QLocale::ShortFormat), QLatin1String("y-MM-dd"));
|
||||
QCOMPARE(ca.dateFormat(QLocale::LongFormat), QLatin1String("MMMM d, y"));
|
||||
|
||||
const QLocale ja("ja_JP");
|
||||
QCOMPARE(ja.dateFormat(QLocale::ShortFormat), QLatin1String("yyyy/MM/dd"));
|
||||
|
||||
const QLocale ir("ga_IE");
|
||||
QCOMPARE(ir.dateFormat(QLocale::ShortFormat), QLatin1String("dd/MM/yyyy"));
|
||||
QCOMPARE(ja.dateFormat(QLocale::ShortFormat), QLatin1String("y/MM/dd"));
|
||||
}
|
||||
|
||||
void tst_QLocale::timeFormat()
|
||||
|
@ -1611,21 +1608,17 @@ void tst_QLocale::timeFormat()
|
|||
QCOMPARE(c.timeFormat(QLocale::NarrowFormat), c.timeFormat(QLocale::ShortFormat));
|
||||
|
||||
const QLocale nn("nn_NO");
|
||||
QCOMPARE(nn.timeFormat(QLocale::NarrowFormat), QLatin1String("HH:mm:ss"));
|
||||
QCOMPARE(nn.timeFormat(QLocale::NarrowFormat), QLatin1String("HH:mm"));
|
||||
QCOMPARE(nn.timeFormat(QLocale::ShortFormat), QLatin1String("HH:mm"));
|
||||
QCOMPARE(nn.timeFormat(QLocale::LongFormat), QLatin1String("'kl'. HH:mm:ss t"));
|
||||
QCOMPARE(nn.timeFormat(QLocale::LongFormat), QLatin1String("HH:mm:ss z"));
|
||||
|
||||
const QLocale id("id_ID");
|
||||
QCOMPARE(id.timeFormat(QLocale::ShortFormat), QLatin1String("HH.mm"));
|
||||
QCOMPARE(id.timeFormat(QLocale::LongFormat), QLatin1String("HH.mm.ss t"));
|
||||
const QLocale en("en_FJ");
|
||||
QCOMPARE(en.timeFormat(QLocale::ShortFormat), QLatin1String("h:mm a"));
|
||||
QCOMPARE(en.timeFormat(QLocale::LongFormat), QLatin1String("h:mm:ss a z"));
|
||||
|
||||
const QLocale cat("ca_ES");
|
||||
QCOMPARE(cat.timeFormat(QLocale::ShortFormat), QLatin1String("H.mm"));
|
||||
QCOMPARE(cat.timeFormat(QLocale::LongFormat), QLatin1String("H.mm.ss t"));
|
||||
|
||||
const QLocale bra("pt_BR");
|
||||
QCOMPARE(bra.timeFormat(QLocale::ShortFormat), QLatin1String("HH:mm"));
|
||||
QCOMPARE(bra.timeFormat(QLocale::LongFormat), QLatin1String("HH:mm:ss t"));
|
||||
QCOMPARE(cat.timeFormat(QLocale::ShortFormat), QLatin1String("H:mm"));
|
||||
QCOMPARE(cat.timeFormat(QLocale::LongFormat), QLatin1String("H:mm:ss z"));
|
||||
}
|
||||
|
||||
void tst_QLocale::dateTimeFormat()
|
||||
|
@ -1635,9 +1628,9 @@ void tst_QLocale::dateTimeFormat()
|
|||
QCOMPARE(c.dateTimeFormat(QLocale::NarrowFormat), c.dateTimeFormat(QLocale::ShortFormat));
|
||||
|
||||
const QLocale nn("nn_NO");
|
||||
QCOMPARE(nn.dateTimeFormat(QLocale::NarrowFormat), QLatin1String("d MMM yyyy HH:mm:ss"));
|
||||
QCOMPARE(nn.dateTimeFormat(QLocale::ShortFormat), QLatin1String("dd.MM.yy HH:mm"));
|
||||
QCOMPARE(nn.dateTimeFormat(QLocale::LongFormat), QLatin1String("dddd d. MMMM yyyy 'kl'. HH:mm:ss t"));
|
||||
QCOMPARE(nn.dateTimeFormat(QLocale::NarrowFormat), QLatin1String("dd.MM.y HH:mm"));
|
||||
QCOMPARE(nn.dateTimeFormat(QLocale::ShortFormat), QLatin1String("dd.MM.y HH:mm"));
|
||||
QCOMPARE(nn.dateTimeFormat(QLocale::LongFormat), QLatin1String("d. MMMM y HH:mm:ss z"));
|
||||
}
|
||||
|
||||
void tst_QLocale::monthName()
|
||||
|
|
Loading…
Add table
Reference in a new issue