Personal tools
You are here: Home / How to / Multilingual applications

Multilingual applications

How to build a Plomino application in a multilingual web site.

You have a multilingual web site where you want to add a Plomino application.

If the data stored in the database must be translate, the immediate and obvious solution is to produce several distinct databases (one per language).

But if the data has not to be translated (figures, names, phone numbers, etc.), it is not an ideal solution because it  requires much more work to maintain an update the data.

In that case, the best way is to build a unique database and make sure the produced screens are translated.

There are several approaches.

Distinct forms

You can create distinct forms (one per language) where the layout will contain the appropriate labels and text according the language.

To open documents with the proper form, you use the Form formula in your views:

lang = context.restrictedTraverse("@@plone_portal_state/language")()
return "frmhotel"+lang

or you use ?openwithform parameter in Redirect actions formulas (or anywhere else you produce URLs):

lang = context.restrictedTraverse("@@plone_portal_state/language")()
return context.doc_url()+"/EditDocument?openwithform=frmhotel"+lang

Unique form

You can also create one unique form, and in its layout replace all labels and text with computed for display fields which will produce the appropriate labels:

label = {'en': u"Title", 'es': u"Titulo", 'fr': u"Titre", 'nl': u"Titel"}
lang = context.restrictedTraverse("@@plone_portal_state/language")()
return label.get(lang, label['en'])
Document Actions