Adding Language to your Site.
First, have you created the site yet?
If you have do it: Go to Localizer at ZMI ( in your site) and select Languages tab. Select the language you want to add to the portal and click add button.
If not: Select the languages you must to have enabled in your site at the add site form.
Translating labels.
When you have enabled a language, you can translate the defined labels of your site. You can see these labels if you go to Localizer->Contents, and select a Message Catalog (typically default). here, you can easily find and change the values of any label.
But, what happen if I want to save these translations in my project? what happen if i want to define my own labels? The best way to do that is:
1. You must to have a i18n folder in your project. Remember How to Implement a Product or How to implement a new product with Eclipse and Subversion.
2. Create at least one *.po file to each of the languages. I.e: es.po to espanish language, en.po to english language...
3. It's so easy to declare labels and translate it:
en.po
msgid "my_own_label"
msgstr "My Own Label"
es.po
msgid "my_own_label"
msgstr "Mi Propia Etiqueta"
4. To import your internationalization files, go to Localizer in ZMI and select a Messages Catalog (typically default). On Import/Export Tab, browse to your *.po file and import it by selecting the correct language.
5. Well, now you can use your labels anywhere on your code. How can i do it??
Usually in zope page template, we use the next syntax:
<span i18n:translate="my_own_label">MY OWN LABEL</span>
Some advices:
If you put an i18n tag in a page template but you haven't declared the label on Localizer, then the server shows the html content, I mean, MY OWN LABEL in our example.
The right way is to write a descriptive content on this.
When you're going to write page templates, put all your labels on *.po files, to fill it later, if you prefer.
2 comments:
vegna ekki:)
how are you?
Definitely gonna recommend this post to a few friends
Post a Comment