Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1271393
    warhost
    Participant

    Hey,

    I set up a WC Shop on my X-Theme page. I enabled cross- and up-sells. The headings for both of these were not translated initially, then I checked all WC/X related .po files and it was translated there. Still, in the browser it showed up in english. Now, I added a filter for the up-sells on the product page, like such:

    add_filter(‘gettext’, ‘translate_like’);
    add_filter(‘ngettext’, ‘translate_like’);
    function translate_like($translated) {
    $translated = str_ireplace(‘You may also like…’, ‘Das könnte dir auch gefallen…’, $translated);
    return $translated;
    }

    ——- EDIT:

    Fixed it, for everyone who checks this later, do this:
    Add another line for every line you want to translate, should work.

    add_filter(‘gettext’, ‘translate_like’);
    add_filter(‘ngettext’, ‘translate_like’);
    function translate_like($translated) {
    $translated = str_ireplace(‘You may also like…’, ‘Das könnte dir auch gefallen…’, $translated);
    $translated = str_ireplace(‘$translated = str_ireplace(‘You may also like…’, ‘Das könnte dir auch gefallen…’, $translated);

    return $translated;
    }

    #1271406
    Christopher
    Moderator

    Thanks for sharing.

  • <script> jQuery(function($){ $("#no-reply-1271393 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>