Modify ↓
#11984 closed defect (fixed)
Date/time in commit history table is not localized
Reported by: | 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
Cc: | Ryan J Ollos Jun Omae added; anonymous removed |
---|---|
Keywords: | i18n datetime added |
Trac Release: | 1.0 → 0.12 |
comment:2 follow-up: 4 Changed 10 years ago by
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: 29 29 from trac.util.datefmt import from_utimestamp as from_timestamp 30 30 except ImportError: 31 31 from trac.util.datefmt import from_timestamp 32 try: 33 from trac.util.datefmt import user_time 34 except 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) 32 39 33 40 from i18n_domain import _, N_, add_domain, gettext, tag_ 34 41 … … class TicketlogModule(Component): 181 188 revision = { 182 189 'rev': rev, 183 190 '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)), 186 193 } 187 194 if self.max_message_length \ 188 195 and len(message) > self.max_message_length:
comment:3 Changed 10 years ago by
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 Changed 10 years ago by
Replying to jun66j5:
In Trac 1.0 and later,
format_datetime
should be used withuser_time
helper. Could you please try the following patch?
Change looks good to me. Please feel free to commit it.
comment:6 Changed 10 years ago by
Owner: | changed from Richard Liao to Jun Omae |
---|
Note: See
TracTickets for help on using
tickets.
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.