Skip Navigation

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

Problem: Translate Custom theme strings

Solution: If you are following WordPress localization standards, then you can scan for the plugins/theme strings from WPML>>Themes & localization and translate them from WPML>>String Translation. Please refer to the following documentation for more details.

In case of trying to translate dynamic custom strings, you can use *wpml_register_single_string* and wpml_translate_single_string for registering and retrieving the translation. Please refer to the following documentation for more details.

Relevant Documentation: https://clivern.com/how-to-internationalize-your-wordpress-plugin/

https://wpml.org/documentation/getting-started-guide/string-translation/finding-strings-that-dont-appear-on-the-string-translation-page/#scanning-for-hard-coded-strings

https://wpml.org/wpml-hook/wpml_register_single_string/

https://wpml.org/wpml-hook/wpml_translate_single_string/

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

Last updated by kellyL-9 1 year, 10 months ago.

Assisted by: Bigul.

Author Posts
June 6, 2022 at 3:40 pm #11397477

kellyL-9

I want to create my custom strings translatable in WPML? Do I have to create the whole?PO/.MO files and register everything or there is a simpler way to do it with WPML?

Thank you

June 6, 2022 at 4:08 pm #11397713

Bigul
Supporter

Languages: English (English )

Timezone: Europe/Vienna (GMT+02:00)

Hello,

Welcome to the WPML support forum. I will do my best to help you to resolve the issue.

If you are following WordPress localization standards, then you can scan for the plugins/theme strings from WPML>>Themes & localization and translate them from WPML>>String Translation. Please refer to the following documentation for more details.

hidden link

https://wpml.org/documentation/getting-started-guide/string-translation/finding-strings-that-dont-appear-on-the-string-translation-page/#scanning-for-hard-coded-strings

If you are trying to translate dynamic custom strings, you can use *wpml_register_single_string* and wpml_translate_single_string for registering and retrieving the translation. Please refer to the following documentation for more details.

https://wpml.org/wpml-hook/wpml_register_single_string/

https://wpml.org/wpml-hook/wpml_translate_single_string/

--
Thanks!

Bigul

June 6, 2022 at 6:42 pm #11398589

kellyL-9

Thank you, Bigul! Couldn't test it yet but it looks exactly what I was looking for!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.