• Resolved Gioweb

    (@gioweb)


    Hi Maxime! I just discovered that sublanguage translates Woocommerce! I’m excited: D I’m doing tests.

    I created an attribute for a product. I’ve been able to translate attribute values but not the attribute name.

    Going to “Sublanguage Settings”> “Translate Taxonomies”> Product Diameter Clicking on “Options” displays the following message: You do not have permission to access this page.

    Where can I intervene?
    Thank you!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hello,

    Sure, Sublanguage can translate WooCommerce basic things right out of the box. But for specific stuffs you need to add some patches.

    Unfortunately, WooCommerce stores those attribute names in a custom database table, so there is no nice way of translating it. Here is a very raw solution. Lets say you created 2 attributes “chease” and “car”, and you want to translate into french and italian:

    
    add_filter( 'woocommerce_attribute_label', function($label, $name, $product) {
      global $sublanguage;
    
      if (isset($sublanguage)) {
    
        $language = $sublanguage->get_language();
    
        if ($language->post_name === 'fr') { // French
      
          if ($name === 'chease') {
        
            return 'fromage';
        
          } else if ($name === 'car') {
      
            return 'voiture';
      
          } // etc.
      
        } else if ($language->post_name === 'it') { // Italian
      
          if ($name === 'chease') {
        
            return 'formaggio';
        
          } else if ($name === 'car') {
      
            return 'macchina';
      
          } // etc.
      
    
        } // etc.
    
      }
    
      return $label;
    
    }, 10, 3 );
    

    (you should put this snippet in your child-theme’s function.php)

    The “You do not have permission to access this page” is a small bug, I’ll correct it. But anyway you wouldn’t have anything to set even if the page displayed correctly.

    Please tell me if it helps.

    Thread Starter Gioweb

    (@gioweb)

    Hi Maxime, thank you for your support, I have found that I can translate almost all of the products but not the management part as email. For the moment leave this solution. Thank you very much, I use your plugin for the blog. Thank you

    The part of email is easy to translate.

    If you have not solved, let me know.

    Saludos.

    Hi Marcelo!
    I would like to translate the email section, do you know how to do it?
    Best

    • This reply was modified 7 years, 1 month ago by bababoom.
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Sublanguage & Woocommerce’ is closed to new replies.