Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client created a custom plugin named 'Custom Woo Shipping Zones' to add state names in WooCommerce, as this functionality was not available by default.

Solution:
We recommend using the

gettext

function to translate hard-coded strings within the custom plugin. For guidance on how to implement this, please refer to our documentation on translating the theme you created.

After incorporating the

gettext

function into your plugin's code, you should navigate to WPML-> Theme and Plugins Localization to scan your custom plugin. Once scanned, you can translate the strings via WPML-> String Translation.

If this solution does not seem relevant to your issue, please open a new support ticket with us for further assistance.

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 Osama Mersal 1 year, 3 months ago.

Assisted by: Osama Mersal.

Author Posts
December 27, 2023 at 8:58 am #15131294

muhamedF

Hi Osama,

Thank you for your reply .. Below is my feedback:

2. I had to create a custom plugin myself to add the states names as this functionality is not available in Woocommerce .. The name of the plugin is (Custom Woo Shipping Zones), please see attached screenshot ..

December 27, 2023 at 9:07 am #15131302

Osama Mersal
WPML Supporter since 02/2020

Languages: English (English ) Arabic (العربية )

Timezone: Africa/Cairo (GMT+02:00)

Hi,

In order to translate the hard-codded strings, you need to use the get text function. Kindly check this guide. (https://wpml.org/documentation/support/translating-the-theme-you-created/)

I translated one string as a test, and it works correctly. (Kindly check the attached screenshot)

After changing the plugin code, please go to WPML-> Theme and Plugins Localization, scan your custom plugin, and translate the strings via WPML-> String Translation.

Best regards,
Osama

2023-12-27_11-01-39.jpg
December 27, 2023 at 5:04 pm #15132941

muhamedF

Issue was resolved once I replicated Osama's example