Personal tools
You are here: Home Documentation Tutorials RichDocument: Creating content types the Plone 2.1 way Multilingual content
Support

Get Help

Join our chat rooms or support forums if you have more specific questions.

Plone Training
Learn how to design, build, and deploy a website in Plone through one of the numerous Plone training sessions around the world.
Find Plone training…
 
Document Actions

Multilingual content

How to make RichDocument translatable through LinguaPlone

Martin Aspeli

This tutorial will teach you how to create content types the Plone 2.1 way, using the ATContentTypes library, by following the example of RichDocument, an extension of Plone's standard Page/Document type.
Page 8 of 17.

Plone supports multi-lingual content using LinguaPlone. Adding multilingual support to your content is surprisingly easy. LinguaPlone defines some extensions to some of Archetypes' internals. By conditionally importing from LinguaPlone instead of Archetypes, you can ensure that you will get the LinguaPlone extensions where available, and still work if LinguaPlone is not installed.

All of ATContentTypes is already LinguaPlone aware. To add LinguaPlone support to RichDocument, all that is needed is to add the following to content/richdocument.py and content/attachments.py :

 try:
   from Products.LinguaPlone.public import *
 except ImportError:
   # No multilingual support
   from Products.Archetypes.public import *

This tries to import LinguaPlone's version of Archetypes' public module, and if it fails, falls back on Archetypes' default version. When LinguaPlone is installed, RichDocument will gain the translate menu and become translatable.

Finally, the two fields displayImages and displayAttachments are actually language-independent - they do not need to be translated. Hence, we set languageIndependent=1 in the RichDocument schema for these fields.

 
by Martin Aspeli last modified September 24, 2005 - 10:18 All content is copyright Plone Foundation and the individual contributors.

For any issues with the web site functionality, please file a ticket.

Please consult the policy on plone.org content if you want your content published on this site.

Servers and hosting by