This is mainly based on the dicussion Translation Policy

What is translation tab

Translation tab, situated on each document portal type, allow you to specify the translation domain for each translatable property of the document

How to set a property translatable

Just edit the property sheet of the document and set the attribute translatable to a True value for the property. For example :

   _properties = (
        {   'id'          : 'title',
            'description' : '',
            'type'        : 'string',
            'default'     : '',
            'mode'        : 'w',
            'translatable': 1,
            },

Thus tree new accesors are created : getTranslatedProperty, getPropertyTranslationDomain and setPropertyTranslationDomain

How to define the translation domain

There is four way to define the translation domain for a property

Into the property sheet

Just add the attribute translation_domain with the domain value for the property. For example:

   _properties = (
        {   'id'          : 'title',
            'description' : '',
            'type'        : 'string',
            'default'     : '',
            'mode'        : 'w',
            'translatable': 1,
            'translation_domain': 'erp5_content',
            },

Using the translation tab

Go to you document portal type, select the translation tab and set the translation domain for the property

th_txn_tab.png view larger image

content_translation translation domain

If you set content_translation to translation_domain, then content translation function is enabled to the property. Content translation function allows you to store translation data into the document instead of Localizer's message catalog. Then every single document can have different translation per language.

And also special translation accessors are automatically created for languages enabled in Localizer. If Portuguese/Brazil(pt-BR), French(fr) are enabled on Localizer and content_translation is set to translation_domain on Person, then followings are created:

If you want to have special UI for these content translation accessors and searching feature, install erp5_content_translation business template. Then Translation tab appears on target portal type documents and you can enter translation text per language.

By overridding with a python script

Create a script named PortalType_getPropertyTranslationDomain, and return the domain as a string

Manually setting

You can use the accesor setPropertyTranslationDomain in a script to define it on the object

How the translation domain is looked up

When a translation is required for a property. ERP5 try to get the translation domain. Here is the order how this look up is perfomed :

at last, if no domain is defined, the translation is not performed

HowToUseTranslationTab (last edited 2010-04-27 03:29:19 by Yusei)