Modify

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#11984 closed defect (fixed)

Date/time in commit history table is not localized

Reported by: t.riedel@… Owned by: Jun Omae
Priority: normal Component: TracTicketChangelogPlugin
Severity: normal Keywords: i18n datetime
Cc: Ryan J Ollos, Jun Omae Trac Release: 0.12

Description

For a trac displayed in german language the date/time in the table of commit history is not localized.

It displays 09/08/14 10:18:59 where I expect it to display 08.09.2014 10:18:59 like it is done when viewing the changeset in the svn browser of trac.

Attachments (0)

Change History (6)

comment:1 Changed 10 years ago by Steffen Hoffmann

Cc: Ryan J Ollos Jun Omae added; anonymous removed
Keywords: i18n datetime added
Trac Release: 1.00.12

Sure, this may count as a defect since this plugin advertized i18n support.

As seen in #11983 this has been done rather incompletely. Thanks for reporting, we'll fix the localized time formatting, and update the i18n support altogether too.

comment:2 Changed 10 years ago by Jun Omae

In Trac 1.0 and later, format_datetime should be used with user_time helper. Could you please try the following patch?

  • tracticketchangelogplugin/0.12/ticketlog/web_ui.py

    diff --git a/tracticketchangelogplugin/0.12/ticketlog/web_ui.py b/tracticketchangelogplugin/0.12/ticketlog/web_ui.py
    index 3a4982f..b0142ef 100644
    a b try: 
    2929    from trac.util.datefmt import from_utimestamp as from_timestamp
    3030except ImportError:
    3131    from trac.util.datefmt import from_timestamp
     32try:
     33    from trac.util.datefmt import user_time
     34except ImportError:
     35    def user_time(req, func, *args, **kwargs):
     36        if 'tzinfo' not in kwargs:
     37            kwargs['tzinfo'] = getattr(req, 'tz', None)
     38        return func(*args, **kwargs)
    3239
    3340from i18n_domain import _, N_, add_domain, gettext, tag_
    3441
    class TicketlogModule(Component): 
    181188            revision = {
    182189                'rev': rev,
    183190                'author': Chrome(self.env).format_author(req, author),
    184                 'time': format_datetime(from_timestamp(timestamp),
    185                                         tzinfo=req.tz)
     191                'time': user_time(req, format_datetime,
     192                                  from_timestamp(timestamp)),
    186193            }
    187194            if self.max_message_length \
    188195                    and len(message) > self.max_message_length:

comment:3 Changed 10 years ago by t.riedel@…

Applied the patch and tested it. Looks good: Timestamp is now formatted as expected:

08.09.2014 10:18:59

Thanks a lot.

comment:4 in reply to:  2 Changed 10 years ago by Ryan J Ollos

Replying to jun66j5:

In Trac 1.0 and later, format_datetime should be used with user_time helper. Could you please try the following patch?

Change looks good to me. Please feel free to commit it.

comment:5 Changed 10 years ago by Jun Omae

Resolution: fixed
Status: newclosed

In 14174:

TracTicketChangelogPlugin: (i18n) display localized date/time in commit history with Trac 1.0 and later (fixed #11984)

comment:6 Changed 10 years ago by Ryan J Ollos

Owner: changed from Richard Liao to Jun Omae

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jun Omae.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.