Making accordion title translatable

Hi,

I tried to make accordion title translatable :

$accordion_title = _e( 'Delivery', 'woocommerce' );

    echo do_shortcode('[accordion id="delivery"] 
    [accordion_item title='." $accordion_title ".' parent_id="delivery"]
         SOME TEXT HERE
    [/accordion_item] 
    [/accordion]'
     );

But failed! the title escaped out of accordion box:
delivery-sc

Could you please guide me to modify it?

Thanks in advance

Hi @omid020,

Thank you for writing in, please see the Theme Translations documentation, there is a Single Sentence Translation guide in there as well.

Hope it helps,
Cheers!

Hi,
I tried Single Sentence Translation but didn’t work for me. Also I have more than two languages, does Single Sentence Translation may support more than two languages?

Hello Omid,

Are you using a plugin in translating your site? WPML is widely used and has been working great with the theme. To better assist you with your issue, kindly provide us access to your site so that we can check your settings. Please create a secure note with the following info:
– Link to your site
– WordPress Admin username / password

To know how to create a secure note, please check this out: How The Forum Works

Best Regards.

Yes, I use WPML and I found an alternative solution, I don’t know this method is available in your docs or not but if not please add it:

 /** acf pro in product page for Delivery **/ 
  
    $truck_icon = "<i class=\"x-icon-truck\" data-x-icon-s=\"&#xf0d1;\" aria-hidden=\"true\"></i>";
    $delivery_tehran = get_post_meta( get_the_ID(), 'delivery_date_tehran', true );
    $delivery_provinces = get_post_meta( get_the_ID(), 'delivery_date_provinces', true );
    $delivery_worldwide = get_post_meta( get_the_ID(), 'delivery_date_worldwide', true );

if (ICL_LANGUAGE_CODE == "en")
        echo do_shortcode('[accordion id="delivery"] [accordion_item title="Delivery Time" parent_id="delivery"]' ."<span>". $truck_icon ." &nbsp;". $delivery_tehran ."</span>"."<br><span>". $truck_icon ." &nbsp;". $delivery_provinces ."</span>"."<br><span>". $truck_icon ." &nbsp;". $delivery_worldwide ."</span>". '[/accordion_item] [/accordion]'
  );
elseif (ICL_LANGUAGE_CODE == "fa")
        echo do_shortcode('[accordion id="delivery"] [accordion_item title="زمان تحویل" parent_id="delivery"]' ."<span>". $truck_icon ." &nbsp;". $delivery_tehran ."</span>"."<br><span>". $truck_icon ." &nbsp;". $delivery_provinces ."</span>"."<br><span>". $truck_icon ." &nbsp;". $delivery_worldwide ."</span>". '[/accordion_item] [/accordion]'
  );
elseif (ICL_LANGUAGE_CODE == "tr")
      echo do_shortcode('[accordion id="delivery"] [accordion_item title="Teslimat süresi" parent_id="delivery"]' ."<span>". $truck_icon ." &nbsp;". $delivery_tehran ."</span>"."<br><span>". $truck_icon ." &nbsp;". $delivery_provinces ."</span>"."<br><span>". $truck_icon ." &nbsp;". $delivery_worldwide ."</span>". '[/accordion_item] [/accordion]'
  );
  ?>

Hey Omid,

We are just glad that you have figured it out a way to correct the said issue. It has been noted.
Thanks for letting us know!

Best Regards.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.