Search code examples
magentotagstranslatemultilingual

Magento translate tags


i have a magento installation wich works pretty well. So far so good, i've set up different Store Views to manage the store in different languages. Now, i have the following problem: I've set up tags from the administration and assigned them to the different products in the different store views (let's say i assign the tag "Buch" to a Product in the german store view, i assign the tag "Book" to the same product in the english store view. If then a user clicks on one of the tag-names it shows the list of products with the same tag. But if he changes store-view then, magento keeps the same tag and says that there are no products with that tag. This seems quite logically, because tags (as far as i understood) are not translatable. What i want magento to do, is that if a user changes store-view in the list with the products, use a translation of the tag (lets say, a user sees all the products with the tag "buch" and changes the view to english, he sees all the products with the tag "book", or, if that is not possible, when changing store-view, that he always goes to the store homepage.

Thanks 100000 times in advance =)


Solution

  • The only solution I see is to translate tags manually. To do this you have to modify all occurrences of your tags in your templates. For example in template/tag/cloud.phtml replace

    <?php echo $this->htmlEscape($_tag->getName()) ?>
    

    with

    <?php echo $this->htmlEscape($this->__($_tag->getName())) ?>
    

    And then add the translation for each tag into app/design/frontend/[your-interface]/[your-theme]/locale/de_DE or any other language.

    As an alternative solution you can create a custom module which will override $_tag->getName() function and add $this->__() in there.