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 1 reply, has 2 voices.

Last updated by Noman 1 year, 1 month ago.

Assisted by: Noman.

Author Posts
October 12, 2023 at 2:03 pm

simeonN-2

Shortcode translation issues

October 12, 2023 at 2:45 pm
October 12, 2023 at 5:59 pm #14568071

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

I have wrapped the hardcoded strings in the gettext(__()) function to make them translatable. So here are the example steps that I followed to make hardcoded strings translatable:

1. Replaced the below code:

return'<a href="'.get_permalink( wc_get_page_id( 'cart' ) ).'">Warenkorb</a>';

With:

return'<a href="'.get_permalink( wc_get_page_id( 'cart' ) ).'">'.__('Warenkorb', 'themedomain').'</a>';

2. Scanned the child theme from WPML >> Theme and plugins localization page.

3. Searched for those strings and added the test translation. You can update it from here:
hidden link

You may follow the same steps for all your hardcoded strings.

Here are docs for more details:
https://developer.wordpress.org/reference/hooks/gettext/
https://wpml.org/documentation/support/translating-the-theme-you-created/

Please let me know if this resolves your issue or if you need further assistance.

Thank you

October 12, 2023 at 8:27 pm #14568877

simeonN-2

Thank you very much!

Now it's perfect! Honestly, I still don't understand this completely but I will take time to learn it!

Thank you again!