Modify

Opened 8 years ago

Closed 22 months ago

#424 closed defect (wontfix)

Blog calendar with international locale

Reported by: simon-code@… Owned by: pacopablo
Priority: normal Component: TracBlogPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.9

Description

My apache/mod_python setup is configured to use Norwegian for all time and date display. This is fine for all uses (basically timestamps), but when using the calendar it does not display correctly.

What should be 'lø' and 'sø' becomes 'l?' and 's?' as the calendar module seems to use ASCII encoding only. Probably a way around this somehow, but likely a problem for many others as well.

Anyway, as my installation apart from date & time is english, I actually would like to use english for the blog calendar as well - all default Trac is english, and as the blog calender acts as navigation it really looks best with that in english as well.

I have made some simple changes to web_ui.py that allows a custom locale for calendar rendering - for me it solves the encoding problem + gives me the language I want.

    def _generate_calendar(self, req, tallies):
        """Generate data necessary for the calendar"""

        import locale
        current_locale = locale.getlocale(category=locale.LC_TIME)
        locale.setlocale(locale.LC_TIME, 'en')
        now = datetime.datetime.now() # start of existing code
        ....
        ....
        locale.setlocale(locale.LC_TIME, current_locale) # added a reset
        pass # could probably be dropped from existing code...

Might I suggest yet another setting in trac.ini/webadmin for locale setting - if empty, don't run the locale switch code, if specified (like en here) then switch.

Attachments (0)

Change History (3)

comment:1 Changed 8 years ago by jon.ekdahl@…

This would be an appreciated improvement, we're using Swedish right now and suffer from the same problem.

However, in our case it would be sufficient if the calendar module created it's output in UTF-8 like the rest of Trac seems to do.

comment:2 Changed 8 years ago by coderanger

Trac already handles this. By default it takes on the locale the web server is running under, but you can override this with the TRAC_LOCALE environment variable (or PythonOption TracLocale for mod_python).

comment:3 Changed 22 months ago by rjollos

  • Resolution set to wontfix
  • Status changed from new to closed

TracBlogPlugin is only for 0.10, as noted on the wiki page. Trac 0.10 is dead now. For blog support, see FullBlogPlugin, which works for Trac 0.11 and later.

Add Comment

Modify Ticket

Action
as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from pacopablo. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.