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.

This topic contains 3 replies, has 2 voices.

Last updated by Jamal 1 year, 4 months ago.

Assigned support staff: Jamal.

Author Posts
April 8, 2019 at 12:13 pm #3557515

francescoL-19

Hello,

I had to install this plug-in

hidden link

You are able to download the plug-in in that page.

I was able to translate everything, except the Fattura24 WooCommerce checkout placeholder!
Look at this picture.

hidden link

I tried everything, scan, admin strings... but... nothing! I'm not able to find these words! he "workaround I found was to hide the placeholder with a functions.php code but.. it's not very elegant solution...

hidden link

Could you help me?
Thank you =)

April 8, 2019 at 12:57 pm #3557871

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello,

Thank you for contacting WPML Support. I will be glad to help with this.

I did not test this solution yet, but you can force localization of the placeholder in the functions.php code that you have built. Here an example.

add_filter( 'woocommerce_checkout_fields' , 'override_billing_checkout_fields', 20, 1 );
function override_billing_checkout_fields( $fields ) {
    $fields['billing']['billing_phone']['placeholder'] = esc_html__( 'Phone', 'my-theme-domain' );
    $fields['billing']['billing_email']['placeholder'] = esc_html__( 'Email', 'my-theme-domain' );
    return $fields;
}

Then scan your theme files code and translate the registered strings in WPML->String Translation.

If you want, i can create a clean server, upload the Fattura24 plugin and let me see how i can resolve it. If i could not i will approach our compatibility team for further assistance.

In the meantime, i remain at your disposal.

Best regards,
Jamal
WPML Support

April 8, 2019 at 1:56 pm #3558357

francescoL-19

Hello Jamal,

thank you for our time.
Unfortunately, I'm very newbie an didn't understand well your answer /solution...

Could you explain me better, step-by-step?

Thank you ^__^

Francesco
---------------

April 9, 2019 at 10:31 am #3565405

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello Francesco,

Sure, i'll do my best.
The code i provided is just an example on how to use this function esc_html__( ); inside the code you are using in your functions.php file.
When we use esc_html__( 'Phone', 'my-theme-domain' );, WPML can scan the functions.php code and register the string 'Phone' under domain 'my-theme-domain', the string will then be available for translation in WPML->String Translation, and once translated it will be reflected for website visitors depending on the language they visit.

Basically you will need to adapt the code in screenshot hidden link to update handle all the fields using esc_html__ function.

For example in your functions.php file you are using this line in this :


$fields['billing']['billing_vatcode']['placeholder'] = '';

Change it to


$fields['billing']['billing_vatcode']['placeholder'] = esc_html__( 'Enter your VAT', 'my-theme-domain' );

Or


$fields['billing']['billing_vatcode']['placeholder'] = __( 'Enter your VAT', 'my-theme-domain' );

Then go to WPML->Theme & plugins localizations and scan your theme file, read this article for more details.
https://wpml.org/documentation/getting-started-guide/theme-localization/#scanning-themes-for-texts

Then the 'Enter your VAT' will be available in WPML->String Translation under domain name 'my-theme-domain'. Read more about it here
https://wpml.org/documentation/getting-started-guide/string-translation/

Once you translate it to italian it will be reflected in your website for visitors in italian checkout page.

I hope this helps, let me know if you have any doubts.

Best regards,
Jamal