localization best practices in tornado

410 views
Skip to first unread message

Burak DEDE

unread,
Feb 8, 2012, 3:36:10 PM2/8/12
to python-...@googlegroups.com
Hi everyone,

I want to ask what is the best practices for localization in tornado. I have already builted a website in english but I want to provide turkish localization for users. How can I handle this in tornado via tornad.locale module ? csv file or another way ?

--
Burak DEDE
www.burakdede.com
www.twitter.com/burakdede

Ben Darnell

unread,
Feb 9, 2012, 12:42:03 AM2/9/12
to python-...@googlegroups.com
The CSV format used by tornado.locale is simple, but there's not a lot
of tool support for it so you might be better off using the gettext
.po/.mo format. Using gettext, the process is something like this:

1) Mark up your source and templates by wrapping all
internationalizable strings in the _() function
2) Run xgettext to generate an initial .po file
3) (On the second and subsequent runs, when you've already got a
partial translation) Use msgmerge to combine the new .po file with the
old translations
4) Translate the .po files using a .po editor
5) Run msgfmt on the .po files to create .mo files that can be loaded
by tornado.locale.load_gettext_translations.

There is a little documentation at
http://www.tornadoweb.org/documentation/locale.html#tornado.locale.load_gettext_translations
with some command-line examples.

-Ben

Taba Tabaa

unread,
Aug 6, 2013, 6:45:28 AM8/6/13
to python-...@googlegroups.com, b...@bendarnell.com
How about Babel?
Reply all
Reply to author
Forward
0 new messages