Opened 12 years ago

Closed 6 years ago

#424 closed defect (wontfix)

Blog calendar with international locale

Reported by: osimons Owned by: John Hampton
Priority: normal Component: TracBlogPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.9


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 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 = # 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 12 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 12 years ago by Noah Kantrowitz

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 6 years ago by Ryan J Ollos

Resolution: wontfix
Status: newclosed

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.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain John Hampton.
The resolution will be deleted.

Add Comment

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

Note: See TracTickets for help on using tickets.