7

I have a Drupal site in English which has content i.e. nodes & taxonomy in English. Now I want to convert all content to Spanish. I want to retain the English content as well.

For taxonomy translation, I installed Locale and i18n module. I searched all taxonomy and added their Spanish translation. However, when I switch the default language of site to Spanish, the taxonomy continue to show up in English.

Any ideas or suggestion?

Loveleen Kaur
  • 993
  • 4
  • 16
  • 36
  • Have you looked through ALL the taxonomy terms and set their language to english? – DrColossos Dec 31 '10 at 12:13
  • Im using the 'localize' mode for the vocabulary. However I set the English and Spanish translations via the translation interface. However it still doesnt work. – Loveleen Kaur Jan 04 '11 at 08:53
  • Steps I followed are 1. installed i18. 2. Added Spanish Language 3. Kept default language as English 4. Set the Vocabulary mode to Localize terms. 5. Added translations as per instructions 6.Now when I make the default language of site as Spanish and try printing the taxonomy terms using t($taxonomyterm, array(), $language->language), it doesnt work.Kindly let me know if Im missing out on something – Loveleen Kaur Jan 04 '11 at 08:54

1 Answers1

5

To translate taxonomy terms you should use the Taxonomy translation module (part of the Internationalization package). There are three translation mode for taxonony vocabularies and their terms. If you want to keep the same terms but translate their titles (and description), you should set your vocabulary mode to Localize terms. When doing this, enter each term in the site default language (probably Egnlish in your case). Then, using the translate strings interface, you can provide translations.

Check the Multilingual Taxonomy handbook page for more information.

The Taxonomy translation module should handle standard term displays so they will use translations. If you need to retrieve a term's name and description for output in some custom code, you will have to use i18ntaxonomy_localize_terms to get the translations. Passing the term's name or description to l() won't work.

Pierre Buyle
  • 4,883
  • 2
  • 32
  • 31
  • Thanks @mongolito404. I followed all your instructions i.e. 1. installed i18. 2. Added Spanish Language 3. Kept default language as English 4. Set the Vocabulary mode to Localize terms. 5. Added translations as per instructions 6.Now when I make the default language of site as Spanish and try printing the taxonomy terms using t($taxonomyterm, array(), $language->language), it doesnt work.(Note I have declared $language as global) – Loveleen Kaur Jan 04 '11 at 08:47
  • The output is still the original terms – Loveleen Kaur Jan 04 '11 at 08:51
  • See the added section about i18ntaxonomy_localize_terms in the original response. – Pierre Buyle Jan 04 '11 at 09:11
  • The following code should ideally print the spanish terms (when I change the default language to Spanish) in array but it doesnt. – Loveleen Kaur Jan 07 '11 at 00:50
  • $vid = 1; $items = array(); $terms = taxonomy_get_tree($vid); if (module_exists('i18ntaxonomy')) $termsnew = i18ntaxonomy_localize_terms($terms, array('name', 'description')); print "
    ";
    print_r($termsnew);
    print "
    ";
    – Loveleen Kaur Jan 07 '11 at 00:50