We have known that Misago have supported i18n well. However, I found an interesting problem on time displaying today. For example, the time string "Friday, 9:33 p.m." will show in en_US locale and in zh_CN locale it will be "星期五,9:33 p.m.". It is an absolute right expression, is it ? However, maybe "星期五,下午9:33" is more reasonable for chinese. I think it will be an issue in many countries.
So, I start to review Misago's codes. Finally, I found that it's not Misago's fault but Django's. Because it does not translate 'p.m.' into '下午' in locale/zh_CN/LC_MESSAGES/django.po
.
However, Misago can fix it and does better.
misago/utils/datesformats.py
# Build date formats
formats = {
'DATE_FORMAT': '',
'DATETIME_FORMAT': '',
'TIME_FORMAT': '',
'YEAR_MONTH_FORMAT': '',
'MONTH_DAY_FORMAT': '',
'SHORT_DATE_FORMAT': '',
'SHORT_DATETIME_FORMAT': '',
}
for key in formats:
formats[key] = get_format(key).replace('P', 'g:i a')
In above codes which locate in misago/utils/datesformats.py
, it just replaced 'P'
into 'g:i a'
of format string. An simple approach is using 24-hour time format to display can work well according to my proposed. For example, formats[key] = get_format(key).replace('P', 'G:i')
.
I recommend that admin can easily define date & time format string in Admin Control Panel.