Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Tagged: 

This topic contains 2 replies, has 2 voices.

Last updated by jamesI 6 months ago.

Assigned support staff: Bruno.

Author Posts
February 13, 2020 at 1:35 pm #5486559

jamesI

Hi,

Within each WooCommerce single product I have edited the theme file to add in a button and form as you can see here hidden link I need to be able to translate the button text can you let me know how to do this please?

The code added to the theme file is below the wording I need translated is 'Contact us about this aircraft'.

<?php echo do_shortcode('[fusion_button link="#" text_transform="uppercase" title="" target="_self" link_attributes="" alignment="" modal="enquire-now-form" hide_on_mobile="small-visibility,medium-visibility,large-visibility" class="" id="" color="default" button_gradient_top_color="" button_gradient_bottom_color="" button_gradient_top_color_hover="" button_gradient_bottom_color_hover="" accent_color="" accent_hover_color="" type="" bevel_color="" border_width="" border_radius="" border_color="" border_hover_color="" size="xlarge" stretch="yes" icon="" icon_position="left" icon_divider="no" animation_type="" animation_direction="left" animation_speed="0.3" animation_offset="" fusion_global="308"]Contact us about this aircraft[/fusion_button]'); ?>

Thanks in advance.

James Isles

February 13, 2020 at 7:55 pm #5489667

Bruno

Hi,

Thank you for contacting us. You can follow the steps below:

- Use these lines to add the shortcode:

$stringButton = __( 'Contact us about this aircraft', 'avada' );
echo do_shortcode( sprintf( '[fusion_button link="#" text_transform="uppercase" title="" target="_self" link_attributes="" alignment="" modal="enquire-now-form" hide_on_mobile="small-visibility,medium-visibility,large-visibility" class="" id="" color="default" button_gradient_top_color="" button_gradient_bottom_color="" button_gradient_top_color_hover="" button_gradient_bottom_color_hover="" accent_color="" accent_hover_color="" type="" bevel_color="" border_width="" border_radius="" border_color="" border_hover_color="" size="xlarge" stretch="yes" icon="" icon_position="left" icon_divider="no" animation_type="" animation_direction="left" animation_speed="0.3" animation_offset="" fusion_global="308"]%s[/fusion_button]', $stringButton ) );

- Click on the WPML > Theme and plugins localization
- Select the Avada theme
- Click on the "Scan selected themes for strings" button
- Click on the WPML > String Translation
- Search and translate the desired strings

Notes:
- In the lines above, I changed the shortcode to use "%s" in place on the button label;
- The "%s" will be replaced by the button label;
- The button label is using a gettext function to be translatable;

Please, let me know if I can help with any other questions you may have about it. I'll be happy to help.

Thank you.

February 14, 2020 at 6:28 pm #5496369

jamesI

That worked thank you very much for the code.