Setting the default locale (language) in TurboGears

The TurboGears documentation only mentions this en passant. It's easy to change the default locale (language) of your TG application.

In your project/controllers.py, in you can add:

def locale_pt():
return 'pt'

turbogears.config.update({'i18n.get_locale' : locale_pt})


I have this in the top namespace of my controllers.py file, not inside the Root class. I'm not sure if this is the prettiest way to make this work, but hey, it works for me. If you have any better suggestion, please leave a comment.

Popular posts from this blog

How to crack Windows Terminal Services 3 month trial

Caveats about Linux connection tracking and high traffic servers

How to install VirtualBox on Scaleway's x86_64 servers