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.

This topic contains 1 reply, has 2 voices.

Last updated by Radu 3 months, 3 weeks ago.

Assigned support staff: Radu.

Author Posts
June 27, 2019 at 11:34 am #4099595

jerzyr-2

Hello,
I want to translate this text in my code:

// Compatibility
FLThemeCompat::init();

add_action( 'woocommerce_review_order_before_submit', 'add_privacy_checkbox', 9 );
function add_privacy_checkbox() {
woocommerce_form_field( 'privacy_policy', array(
'type' => 'checkbox',
'class' => array('form-row privacy'),
'label_class' => array('woocommerce-form__label woocommerce-form__label-for-checkbox checkbox'),
'input_class' => array('woocommerce-form__input woocommerce-form__input-checkbox input-checkbox'),
'required' => true,
'label' => 'He leído y acepto la <a href="hidden link">política de privacidad</a>' , 'textdomain',
));
}
add_action( 'woocommerce_checkout_process', 'privacy_checkbox_error_message' );
function privacy_checkbox_error_message() {
if ( ! (int) isset( $_POST['privacy_policy'] ) ) {
wc_add_notice( __( 'Debes aceptar la política de privacidad para realizar el pedido' ), 'error' );
}
}

The text is: He leído y acepto la <a href="hidden link">política de privacidad</a>

June 27, 2019 at 12:50 pm #4100057

Radu
Supporter

Languages: English (English )

Timezone: Europe/Bucharest (GMT+03:00)

Hey,

Thank you for reaching out the WPML support!

I think that you just forgot to use a GetText call for the text. So just simply replace this line:

'label' => 'He leído y acepto la <a href="<em><u>hidden link</u></em>">política de privacidad</a>' , 'textdomain',

with this one:

'label' => __('He leído y acepto la <a href="<em><u>hidden link</u></em>">política de privacidad</a>' , 'textdomain'),

and tell me how this works now.

Thanks,
Radu

The topic ‘[Closed] translate code’ is closed to new replies.