O'Reilly logo

Plone 3 Products Development Cookbook by Marcos F. Romero, Juan Pablo Giménez

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding i18n support to any product

From what we have seen so far, we can now add translation facilities to any product as long as the text is in Python code. Using MessageFactory we can mark text as translatable.

Getting ready

The following example will modify the pox.banner package developed in Chapter 6. It's also available in this book's downloadable code.

How to do it...

Note

The following steps should have been taken during pox.banner package development. However, we waited to introduce them until now for clarity's sake.

From now on, every code we produce will be i18n-aware from scratch.

  1. Create a MessageFactory to be used in the whole package. Open pox/banner/__init__.py file to add the following lines:
    from zope.i18nmessageid import MessageFactory ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required