Internationalization and Localization of Your Plone Site


Internationalization and localization are very different beasts, and neither is akin to translation, which is a common misconception . For example, you can have a translated website, but it might not be an internationalized or a localized site ”just a translated site. Internationalization occurs at the application level as a preparatory step toward possible application localization. During the internationalization phase of application development, the primary occurrence is that all strings, icons, graphics, and any other modifiable elements are externalized . To externalize means to separate these elements from the core of your application so that they can be easily changed per locale, which is the process of localization.

A locale is essentially a grouping of the translated strings, graphics, text, and formatting conventions that are used in the application or website to be localized. These groupings are usually referred to by the name of the pervasive language of the application, such as the German locale. Although it might be obvious that the German locale includes text translated into German, it does not mean that the website is applicable only to people in Germany: Austrians who speak German would probably utilize a localized German website, but it would not be referred to as the Austrian locale.

Plone is already an internationalized application, meaning that it is ready and waiting to be localized. This application also ships with an add-on (installed by default) called PlacelessTranslationService, which handles the interplay between localized strings, images, and other items, and the base Plone templates. The "translation" in this case is the interpretation by Placeless Translation Service of the matching ID and strings in a message map file. The list of standard message map files includes numerous languages, from Afrikaans to Turkish and everything in between. You can view the list of installed message maps in the ZMI by selecting Control Panel from the navigation pane and then clicking on the Placeless Translation Service icon.


Message map files are modified and new languages are added all the time. To get the newest versions of files or add new languages to your Plone installation, visit the Plone Collective at http:// sourceforge .net/projects/collective. If you are a language expert and want to create your own message maps or contribute to those already in the collective, see for information on how these files are created and compiled.

In the next section, you install the PloneLanguageTool and learn how to localize your Plone site.

Localizing Your Plone Site

The PloneLanguageTool is an exceptional add-on that enables you to set the base language and character set, customize the available localizations , and provide easy access for users to view localized content. The PloneLanguageTool is found in the Collective and can be installed as you learned in Chapter 4, "Additional Plone Elements," or via the ZMI. You've worked in the ZMI for most of this chapter, and you can use it to install the PloneLanguageTool as well.

First, download the latest version of PloneLanguageTool from the Collective, and extract the contents of the zipped file to the Data/Products subfolder in your Plone installation directory. Restart Zope and Plone by going to the Control Panel in the ZMI navigation pane and pressing the Restart button. Wait for Zope and Plone to restart, and then access your Plone instance, also in the navigation pane of the ZMI.

Next, click on the portal_quickinstaller object in the workspace pane of the ZMI. You will see a list of add-ons that can be installed and that have already been installed. PloneLaguageTool should be in the list of items ready to be installed; select its check box and press the Install button. Assuming that it installs without a hitch and displays the "OK" text, you can use this tool to localize your Plone site.

Click on your Plone instance in the navigation pane to see the objects in its root folder. One of these objects should be called portal_languages . Click on this object to see what is essentially a localization menu, shown in Figure 5.15.

Figure 5.15. The PloneLanguageTool menu.

The first item is a drop-down menu that represents your selection of a default language. In this example, English is the default language used for the localized elements. The drop-down list of default languages changes, depending on the languages you select in the next form field, Allowed Languages . The Allowed Languages field displays all the different languages in which character encoding or message strings are found. If you check the box beneath the Allowed Languages field to allow combined languages, the list becomes even longer.


Combined languages include all the variations per country of a given language. For example, en_us represents English as used in the United States, whereas en_uk represents English as used in the United Kingdom. Other languages have variations as well, all of which are listed in the Allowed Languages drop-down list.

The remaining form fields on this menu are various check box options related to content negotiation and control. The default settings are appropriate for a standard Plone site, but feel free to select options that you feel are appropriate to your installation. After you have configured your options, press the Save button. You will see your changes immediately in your Plone site. Figure 5.16 shows an example of localization in action; Japanese is selected here as the working language.

Figure 5.16. Localized Plone site, Japanese style.

As you can see, all of the standard Plone tabs, links, actions, footnote text, and so on ”items in the core Plone template ”are presented in Japanese. A Language slot is present at the left side of the template and contains a drop-down list of the Allowed Languages selected from the PloneLanguageTool menu.


If you select a small number of languages (five or less, usually), the languages are displayed as text-based links with a corresponding flag icon. The user -selected language is bold. In this example, the drop-down list is used because a larger number of allowable languages was chosen via the ZMI.

The user is in control of selecting the localized site to use, so you can imagine that the user would select one that his or her web browser can actually interpret. However, if you are testing your localization selections and notice that your language isn't changing when you make a selection, it's for a simple reason: Your browser does not contain the language accessories needed to view the translated text. For example, if you select Japanese but your operating system and browser are in English and you have not installed Japanese fonts or selected support for Japanese character sets, you won't see a Japanese Plone template. You'll learn more about character sets in the next section.

International Character Sets

Character sets are referred to as single-byte or multibyte character sets, corresponding to the number of bytes needed to define a relationship with a character that is used in a language. English, German, and French are examples of single-byte languages: Only 1 byte is necessary to represent a character such as the letter a or the number 9. Single-byte code sets have, at most, 256 characters, including the entire set of ASCII characters , accented characters, and other characters necessary for formatting.

However, multibyte code sets have more than 256 characters, including all single-byte characters as a subset. Multibyte languages include Chinese, Japanese, Korean, Thai, Arabic, Hebrew, and so on. The common thread is that these languages require more than 1 byte to represent a character. For example, consider the word Tokyo (the capital of Japan). In English, it is spelled with four different characters, using a total of 5 bytes. However, in Japanese, the word is represented by two syllables, tou and kyou , each of which uses 2 bytes, for a total of 4 bytes used.

The relevance of this information is that, to properly interpret and display the text of web pages in their intended language, the application needs to tell the web browser which character set to use, using content headers. When a language is selected via the PloneLanguageTool, the proper headers are sent for the selected language.

In the localized Plone site, you'll notice that plenty of content is not translated. This is content added by the user, in the user's language (in this case, English). Custom content does not appear in message map files and, thus, is not translated. However, if you are creating content in the language that you have chosen, your content is displayed as such. For example, suppose that your Plone site is for a German company, and the allowed languages are German and English. It's quite likely that any content added to the Plone site ”folders, documents, events, and so on ”will be in German. Your custom tabs would say Startseite instead of Home and Informationstechnologie instead if IT. When the folder and tab are created for IT, if you're in Germany and your audience is German, you'll name it something in German! Thus, when the localized site is viewed in English, all of the standard Plone elements will be in English, but the content entered in German ”such as the custom tabs and folders ”will remain in German.

Plone Content Management Essentials
Plone Content Management Essentials
ISBN: 0672326876
EAN: 2147483647
Year: 2003
Pages: 107
Authors: Julie Meloni © 2008-2017.
If you may any questions please contact us: