Search code examples
wordpresstranslationjigoshop

Translate product category|tag title for JigoShop with qTranslate


qTranslate creates additional language fields for products pages in JigoShop but not also for category|tags product as it does for posts.

If I put in the title of a menu item <!--:en-->title<!--:--><!--:fr-->title<!--:--> i'll get the translation I want. But when creting a new category|tag title the <!--:--> is striped out. How can I enable comments tags for cat|tag title?

Another option is to use [:en]Title[:fr]Titre in the same title field when creating a new category|tag product. On the admin panel I see the proper text for the language selected but for end user i see [:en]Title[:fr]Titre.

I found this link https://wordpress.stackexchange.com/questions/28165/translating-a-custom-taxonomy and according to this answer http://www.qianqin.de/qtranslate/forum/viewtopic.php? f=4&t=2045&start=0#p7380 I addet in functions.php

add_action('jigoshop_add_form', 'qtrans_modifyTermFormFor');
add_action('jigoshop_edit_form', 'qtrans_modifyTermFormFor');

Did not work. I don't see aditional translations fields for categories|tags in JigoShop.

The basic question is:

How do I translate product categories|tags in JigoShop using qTranslate?


Solution

  • Not the ideal solution but works.

    In JigoShop/edit product category/name:

    [:en] Big [:fr] Grand
    

    In functions.php

    function translate_q ($echo) {
        if (function_exists('qtrans_split')) {
            $selectLanguage = qtrans_split($echo);
            return $selectLanguage[qtrans_getLanguage()];
        } else {
            return $echo;
        }
    }
    

    qtrans_split and qtrans_getLanguage are functions created by qTranslate.

    From JigoShop plugin directory I opened jigoshop_template_functions.php, I grabbed from jigoshop_breadcrumb() function all the echos in $echo variable and at the end I have:

    echo function_exists('translate_q') ? translate_q($echo) : $echo;
    

    You will have to do the same thing in other places in JigoShop. I posted here to be a starting point.