Home › Toolset Professional Support › [Resolved] Translate “Use my location” message on cred form
Problem:
I need to translate "Use my location" message on cred form, when i use an address field with google map. I don´t use WPML. Can i use a code in functions.php to translate
Solution:
You can translate the "Use my location" message with WordPress built-in filter hook gettext, for example, add below codes into your theme file functions.php:
add_filter( 'gettext', 'my_text_func', 20, 3 ); /** * @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext */ function my_text_func( $translated_text, $text, $domain ) { if($text == 'Use my location' && $domain = 'toolset-maps'){ $translated_text = "Use my location in your language"; } return $translated_text; }
Relevant Documentation:
https://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 9:00 – 13:00 | 9:00 – 13:00 | 9:00 – 13:00 | 9:00 – 13:00 | 9:00 – 13:00 | - |
- | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | - |
Supporter timezone: Asia/Hong_Kong (GMT+08:00)
Tagged: Content-submission forms, Toolset Forms
Related documentation:
This topic contains 2 replies, has 2 voices.
Last updated by selmoK 6 years, 8 months ago.
Assisted by: Luo Yang.
Hi,
I need to translate "Use my location" message on cred form, when i use an address field with google map. I don´t use WPML. Can i use a code in functions.php to translate, please?
Hello,
You can translate the "Use my location" message with WordPress built-in filter hook gettext, for example, add below codes into your theme file functions.php:
add_filter( 'gettext', 'my_text_func', 20, 3 ); /** * @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext */ function my_text_func( $translated_text, $text, $domain ) { if($text == 'Use my location' && $domain = 'toolset-maps'){ $translated_text = "Use my location in your language"; } return $translated_text; }
It worked fine!
Thank you!