• Resolved databell96

    (@databell96)


    I have some product tabs I created using Advanced Custom Fields and while the content inside of the fields is in the proper language (in my example URL: French), the title of the tab is still in English. Or “How to Use”. Obviously, this won’t work on a French-based site so how can I get my tabs to translate?

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Is the text for the tabs hardcoded in the php template file, or is it dynamic from a field in ACF? If it’s hardcoded, you can use get_locale() to determine if it’s French, and then change the text of the tabs accordingly.

    If it’s an ACF field, what happens when you switch from English to French tabs in the admin? It should let you change the text there.

    Thread Starter databell96

    (@databell96)

    Yes, it’s hardcoded into functions.php

    add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab2' );
    function woo_new_product_tab2( $tabs2 ) {
    	// Adds the new tab
    	$tabs2['htu_tab'] = array(
    		'title' 	=> __( 'How To Use', 'woocommerce' ), 
    		'priority' 	=> 150,
    		'callback' 	=> 'woo_new_product_tab_content2'
    	);
    	return $tabs2;
    }
    function woo_new_product_tab_content2() {
    	// The new tab content
    	echo '<p>' . get_field('how_to_use') . '</p>';
    }
    Thread Starter databell96

    (@databell96)

    Never mind. I found the solution. So for the About tab, you’d do this:
    $tabs['description']['title'] = __( '[:en]About[:fr]Sur[:]' );

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Translating Product Tabs into French’ is closed to new replies.