Ticket #8607 (closed Bug: fixed)
event_view.pt: start/end time not localized if start date equals end date (suggested fix included)
| Reported by: | kleist | Owned by: | calvinhp |
|---|---|---|---|
| Priority: | major | Milestone: | 3.3 |
| Component: | Infrastructure | Keywords: | TuneUpJan9, blackbelt, python, i18n, l10n, tocommit |
| Cc: | grahamperrin |
Description
Plone 3.1.6
In "Products/CMFPlone/skins/plone_content/event_view.pt", the block "tal:sameday" doesn't use toLocalizedTime() as the block "tal:differentday" does.
Suggested fix:
92c92,94 < tal:replace="python:test(ampm, here.start().AMPMMinutes(), here.start().TimeMinutes())">Start Time</span> --- > class="explain" > tal:content="python:here.toLocalizedTime(here.start(), > long_format=1).split()[1]">Start Date Time</span> 106c108,110 < tal:replace="python:test(ampm, here.end().AMPMMinutes(), here.end().TimeMinutes())">End Time</span> --- > class="explain" > tal:content="python:here.toLocalizedTime(here.end(), > long_format=1).split()[1]">End Date Time</span>
I'm not the man to say if the use of split() and slicing is robust enough to extract just the time in all locales. Is it RTL safe?
Aside: It would really be nice if toTocalizedTime() had a parameter to return the time only.
Attachments
Change History
comment:2 Changed 3 years ago by tomster
- Status changed from new to closed
- Resolution set to wontfix
I can't see any fault in the current implementation. Afterall, these two types of events *do* require different treatment. For an event that begins and ends on the same day, we only need to display the time for the ending, whereas for a multi-day event we need the full date/time info for start and end.
comment:4 Changed 3 years ago by kleist
- Status changed from closed to reopened
- Resolution wontfix deleted
I failed to describe the bug clearly:
When start and end date are the same, the start/end times are not localized. For example: on a German Plone site, "1.23 PM" is rendered instead of the excepted "13:23".
comment:5 Changed 3 years ago by tomster
- Status changed from reopened to new
- Owner set to tomster
gotcha. (i tested with an english locale, so everything seemed right to me). i'll take another look.
comment:7 Changed 3 years ago by gabdavhp
- Keywords TuneUpDec5, greenbelt added; TuneUpDec5 removed
- Owner tomster deleted
comment:8 Changed 3 years ago by bandigarf
- Keywords blackbelt, python, i18n, l10n added; greenbelt removed
Changed 3 years ago by jnelson
-
attachment
add-localized-time.diff
added
Patch to add localized time capabilities
comment:9 Changed 3 years ago by jnelson
- Keywords l10n, tocommit added; l10n removed
I've attached a patch to allow the getLocalizedTime() function to provide just the localized time if the 'time_only' flag is set.
Tested, working on 3.2 dev buildout.
Changed 3 years ago by jnelson
-
attachment
add-localized-time-v2.diff
added
Updated patch to use propertiestool for default time
comment:10 Changed 3 years ago by jnelson
Propertiestool code works - languages without a defined localized time get the format specified in the propertiestool.
comment:13 Changed 3 years ago by calvinhp
- Status changed from new to closed
- Resolution set to fixed
(In [24257]) * Added time_only for use with toLocalizedTime so that event_view now localizes the start/end times if the start/end dates are the same.
- Added migration for 3.2 to 3.2.1 to add new property to the propery tool.
- Added new time_format id to the po files to support the new time_only fix
- thx jnelson, fixes #8607
comment:14 Changed 3 years ago by calvinhp
(In [24290]) merged r24256:24257 from the 3.2 branch down to trunk, thx jnelson, refs #8607
comment:15 Changed 3 years ago by calvinhp
(In [24291]) merged r24256:24257 from the 3.2 branch down to trunk, thx jnelson, refs #8607
comment:16 Changed 3 years ago by calvinhp
(In [24292]) merged r24256:24257 from the 3.2 branch down to trunk, thx jnelson, refs #8607
comment:17 Changed 3 years ago by vincentfretin
- Priority changed from minor to major
- Status changed from closed to reopened
- Resolution fixed deleted
The migration profile 3.2 -> 3.2.1 don't work, python code is missing to activate this migration profile I think. So after portal_migration, you don't have localTimeOnlyFormat property in site_properties, and so viewing an event fail with AttributeError: localTimeOnlyFormat.
Changed 3 years ago by vincentfretin
-
attachment
plone-3.2-to-3.2.1-migration.patch
added
Fix migration to Plone 3.2.1
comment:18 Changed 3 years ago by vincentfretin
Please apply the patch as soon as possible. :-)
Changed 3 years ago by vincentfretin
-
attachment
plone.app.layout-toLocalizedTime-context-argument.patch
added
fix toLocalizedTime call in DocumentBylineViewlet viewlet (plone.app.layout egg)
comment:19 Changed 3 years ago by vincentfretin
There is another problem in the DocumentBylineViewlet viewlet included at the top of each page. The viewlet call toLocalizeTime with as third argument the context, but now the third argument is time_only! So we need to specify a named argument for the context here. Please see the patch.
comment:20 Changed 3 years ago by MatthewWilkes
Split the migration issue out into #8939 as it's critical. The DocumentBylineViewlet is less serious and does fit in this trac, imo.
comment:21 Changed 3 years ago by encolpe
Ok guys, I add this last patch. Now, if you have a new bug it is better to provide a test (functional or unit) than a patch.
comment:22 Changed 3 years ago by vincentfretin
- Status changed from reopened to closed
- Resolution set to fixed
comment:23 Changed 3 years ago by hannosch
- Component changed from Calendar and time to Infrastructure
