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.

Tagged: 

This topic contains 1 reply, has 2 voices.

Last updated by Bigul 1 year, 4 months ago.

Assisted by: Bigul.

Author Posts
July 19, 2023 at 1:51 pm #14066823

simya-solutionsL

We're using Code Snippets. I created a custom element by echo a HTML. I wanted to use WPML translate the text. And I found this article. https://wpml.org/documentation/support/enabling-text-translation-for-themes-not-compatible-with-wpml/#3

I try to use PHP get text function with __(); or _e(); but it doesn't show a domain in WMPL translator.

Can you please tell me what is wrong?

Screen Shot 2566-07-19 at 20.50.02.png
Screen Shot 2566-07-19 at 20.45.47.png
July 20, 2023 at 8:54 am #14070519

Bigul
Supporter

Languages: English (English )

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

Hello,

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

This may be happening because of the dynamic code via snippets. So please use WPML hooks(wpml_register_single_string & wpml_translate_single_string) to register and retrieve the translation strings.

Please refer to the following documentation and ticket link for more details, and let us know your feedback.

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

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

https://wpml.org/forums/topic/translate-text-given-in-snippets-to-other-language/#post-11166303

--
Thanks!

Bigul