Ticket #8607 (closed Bug: fixed)

Opened 8 years ago

Last modified 7 years ago

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: General Version:
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

add-localized-time.diff Download (78.9 KB) - added by jnelson 8 years ago.
Patch to add localized time capabilities
add-localized-time-v2.diff Download (80.5 KB) - added by jnelson 8 years ago.
Updated patch to use propertiestool for default time
plone-3.2-to-3.2.1-migration.patch Download (2.3 KB) - added by vincentfretin 7 years ago.
Fix migration to Plone 3.2.1
plone.app.layout-toLocalizedTime-context-argument.patch Download (778 bytes) - added by vincentfretin 7 years ago.
fix toLocalizedTime call in DocumentBylineViewlet viewlet (plone.app.layout egg)

Change History

comment:1 Changed 8 years ago by garbas

  • Keywords TuneUpNov14 added

comment:2 Changed 8 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:3 Changed 8 years ago by grahamperrin

  • Cc grahamperrin added

comment:4 Changed 8 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 8 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:6 Changed 8 years ago by gabdavhp

  • Keywords TuneUpDec5 added; TuneUpNov14 removed

comment:7 Changed 8 years ago by gabdavhp

  • Owner tomster deleted
  • Keywords TuneUpDec5, greenbelt added; TuneUpDec5 removed

comment:8 Changed 8 years ago by bandigarf

  • Keywords blackbelt, python, i18n, l10n added; greenbelt removed

Changed 8 years ago by jnelson

Patch to add localized time capabilities

comment:9 Changed 8 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 8 years ago by jnelson

Updated patch to use propertiestool for default time

comment:10 Changed 8 years ago by jnelson

Propertiestool code works - languages without a defined localized time get the format specified in the propertiestool.

comment:11 Changed 8 years ago by gabriellehp

  • Keywords TuneUpJan9, added; TuneUpDec5, removed

comment:12 Changed 8 years ago by calvinhp

  • Owner set to calvinhp

comment:13 Changed 8 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 8 years ago by calvinhp

(In [24290]) merged r24256:24257 from the 3.2 branch down to trunk, thx jnelson, refs #8607

comment:15 Changed 8 years ago by calvinhp

(In [24291]) merged r24256:24257 from the 3.2 branch down to trunk, thx jnelson, refs #8607

comment:16 Changed 8 years ago by calvinhp

(In [24292]) merged r24256:24257 from the 3.2 branch down to trunk, thx jnelson, refs #8607

comment:17 Changed 7 years ago by vincentfretin

  • Status changed from closed to reopened
  • Priority changed from minor to major
  • 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 7 years ago by vincentfretin

Fix migration to Plone 3.2.1

comment:18 Changed 7 years ago by vincentfretin

Please apply the patch as soon as possible. :-)

Changed 7 years ago by vincentfretin

fix toLocalizedTime call in DocumentBylineViewlet viewlet (plone.app.layout egg)

comment:19 Changed 7 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 7 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 7 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 7 years ago by vincentfretin

  • Status changed from reopened to closed
  • Resolution set to fixed

comment:23 Changed 7 years ago by hannosch

  • Component changed from Calendar and time to Infrastructure

comment:24 Changed 7 years ago by hannosch

  • Milestone changed from 3.x to 3.3

comment:25 Changed 4 years ago by davisagli

  • Component changed from Infrastructure to General
Note: See TracTickets for help on using tickets.