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 thread is resolved. Here is a description of the problem and solution.

Problem: I have customised a couple of woocommerce checkout LABELS, but they do not appear in the string translations. I need to translate those labels, but I cannot find them in the string translation panel. Solution: All you have to do is wrap the string in gettext as explained here https://wpml.org/faq/language-setup/

This topic contains 2 replies, has 2 voices.

Last updated by francoP-4 3 months, 1 week ago.

Assigned support staff: Radu.

Author Posts
July 3, 2019 at 10:59 am #4135167

francoP-4

I have customised a couple of woocommerce checkout LABELS, but they do not appear in the string translations. I have followed the woocommerce recommended filters, such as:

// Hook in
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
// Our hooked in function - $fields is passed via the filter!
function custom_override_checkout_fields( $fields ) {
$fields['order']['order_comments']['placeholder'] = 'My new placeholder';
$fields['order']['order_comments']['label'] = 'My new label';
return $fields;
}

I need to translate those labels, but I cannot find them in the string translation panel. What do I need to do, please?

I have also installed the woocommerce multilingual plugin, but I am not sure how to use it.

Best regards

Franco

July 3, 2019 at 11:57 am #4135673

Radu
Supporter

Languages: English (English )

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

Hey Franco,

Thank you for reaching out the WPML support!

I think that all you have to do is wrap the text in gettext. You can find a few more details about this right here https://wpml.org/faq/language-setup/. Basically, you should change the string from your code from

'My new placeholder'
'My new label'

to

__( 'My new placeholder', 'text-domain' )
__( 'My new label', 'text-domain' )

Can you give this a try and tell me if the strings appear now in WPML → String translation, please?

Thanks,
Radu

July 3, 2019 at 12:58 pm #4136591

francoP-4

My issue is resolved now (I should have known it). Thank you!