Multilingual categories

Last modified: September 25, 2008 - 10:44

With the internationalization module, it will be possible to set a language for vocabularies or terms. In addition, when the translation module is enabled, translations can be created for taxonomy terms.

When a language is set for a vocabulary or term, only ones that match the the current language will appear in taxonomy listings and when creating and editing nodes. If the language is set for a vocabulary, all the terms in that vocabulary will be automatically set to that language.

Creating terms with language is simple with the internationalization package. For example, we created the vocabulary 'colours,' which has no language assigned to it, thus allowing terms in multiple languages within the same vocabulary.
Creating multilingual terms
Figure 1: Creating a taxonomy term with English language.

Then we created the terms 'red', 'green', and 'blue' in English and 'rojo', 'verde', and 'azul' in Spanish. If we go to the 'translation' tab and click on add translation, we can choose a term for each language that will be part of this translation.
Translating terms
Figure 2: Creating term translations.

If we repeat this process for the three terms, we can see all the translations in the Translation tab
Term translation tab
Figure 3: Term translations.

Once we have terms and translations, only the correct terms for each language will show up while browsing the site. When we are editing a node, the terms for that node's language will be available.

Categories and I18n

franrein - September 30, 2007 - 16:19

If you want to add the translation flags to your site, make sure you pick the Translation flag and not the Language Switcher since this block won´t work appropriately.

This may not be what you really want

mr.j - January 29, 2008 - 00:44

Drupal 5.x
I have just figured out that doing it this way creates entirely separate, unrelated categories for each translation.

So for example, assign a Story to the "Red" category and it will not show up when listing articles in the "Rojo" category, even if you have enabled fallback support to the default language.

So any English nodes which have not yet been translated to Spanish will not show up in the Spanish categories, even if you want them to.

If you would like this functionality, then a different way to translate categories is to use the localization interface to just translate the category strings.
First enable string translation on your vocabularies by going to:
Administer > Multilingual System > Translation > Vocabulary Translation

Then go to:
Administer > Localization > Manage Strings

and maintain translations for the category names there.

 
 

Drupal is a registered trademark of Dries Buytaert.