I18n for content

10 views
Skip to first unread message

Werner F. Bruhin

unread,
Dec 31, 2009, 7:07:21 AM12/31/09
to web...@googlegroups.com
Hi everyone,

I am just starting to look at web2py to use it for my first web
application (currently doing stuff using Python/wxPython for a desk top
app), been looking at TurboGears 2 and Django.

The project I would like to do with web2py (or one of the others) should
run on GAE (which seems to eliminate TG) and I18n for all text is
required, especially content coming from the db.

I have looked through the archive of the gmane list and came across
Maximo's video (http://www.vimeo.com/7520812) and the thread on content
internationalization (started by Alex in Oct 2009).

With regards to the later I have some questions.

The sample model shown in that thread is the following.

db.define_table('book',
Field('isbn'))

db.define_table('book_translation',
Field('book',db.book),
Field('language'),
Field('title'),
Field('description'))

book = db.book.insert(isbn="1234567890")
db.book.translation.insert(
book=book,
language='en'
title = "web2py for Dummies",
description = "web2py described in simple words.")
db.book.translation.insert(
book=book,
language='pl'
title = "web2py opisane w prostych slowach")

How come the "translation" relation for "book" is "book.translation" and
not "book.book_translation"? Is the prefix "book_" just removed as it
matches the parent table name?

Is there any default magic going to happen when showing the content?
What I mean is that I do a select with preferred language set to e.g.
'fr', what would be shown assuming the db only contains the above data.

Is there somewhere a sample showing how this model is used on a view
(correct term?)?

Would like to wish everyone all the best for the New Year, especially
good health.

Werner

mdipierro

unread,
Dec 31, 2009, 11:01:21 AM12/31/09
to web2py-users
No. I think it is a problem with the video. Should have been:

db.book_translation.insert(


book=book,
language='en'
title = "web2py for Dummies",
description = "web2py described in simple words.")

db.book_translation.insert(


book=book,
language='pl'
title = "web2py opisane w prostych slowach")

Reply all
Reply to author
Forward
0 new messages