Support for internationalization in web2py wiki

130 views
Skip to first unread message

Daniel Gonzalez

unread,
May 28, 2013, 3:35:21 PM5/28/13
to web...@googlegroups.com
Hi,

I have started to use the web2py wiki module, but can not find any support for internationalization of the wiki pages. What I would like is to be able to select the language based on some query parameters or some configuration parameters. Of course, the pages must be already be saved in the desired language.

Is there any support for this built-in?

Thanks,
Daniel

Massimo Di Pierro

unread,
May 28, 2013, 4:29:27 PM5/28/13
to web...@googlegroups.com
There is not. The problem is that normal internationalization libraries are not appropriate for wiki pages. I would recommended using different pages for different languages. In your opinion, how should internationalization for wiki pages work?

Daniel Gonzalez

unread,
May 29, 2013, 2:29:13 AM5/29/13
to web...@googlegroups.com
In the same way as internationalization is handled in the T operator? That means that an "accept-language: it- it" would tell the wiki engine to look for pages corresponding to the URL which are marked in the database as being in italian. That means:
  1. a new field is needed in the database to mark the language the page is written in
  2. the wiki engine would select that page
  3. a fall back mechanism would return a page in a default language (english?)
  4. when creating new wiki entries, the support views would offer a drop-down to specifiy the language in which the page is being created (which would default to the accept-language setting)

Massimo Di Pierro

unread,
May 29, 2013, 10:03:13 AM5/29/13
to web...@googlegroups.com
I think you can do something like:

session.language = session.language or T.accepted_language
auth.settings.extra_field['wiki_page']=[Field('language',default=session.language)]
auth.define_tables(....)
auth.wiki(render=False)
db.wiki_page._common_filters.append(lambda q:db.wiki_page.language==session.language)

I am not sure this belongs in the wiki because I am not convince there is one way to do it that suits everybody.
Please check it. Perhaps you can help us make a web2pyslice.

Massimo 
Reply all
Reply to author
Forward
0 new messages