Skip Navigation

[Resolved] Split: How to translate all messages from the user forms? – how to translate — not set —

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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 5 replies, has 2 voices.

Last updated by Minesh 4 months ago.

Assisted by: Minesh.

Author
Posts
#2761854

Hi Minesh,
Ok, so you won't see it in the backend.
Other tranlation question, where can I translate --- not set --- and Please validate reCAPTCHA?
Cheers
Marco

#2761858

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Can you please try to use the following code in order to translate not set text:

add_filter('gettext', function($res, $text, $dom){
    if( $res == '--- not set ---' && $domain = 'wpv-views' ){
        $res = 'custom text not set';
    }
     
    
    return $res;
}, 10, 3);
#2761877

And the Please validate reCAPTCHA in the same way?

add_filter('gettext', function($res, $text, $dom){
    if( $res == 'Please validate reCAPTCHA' && $domain = 'wpv-views' ){
        $res = 'custom text Please validate reCAPTCHA';
    }
      
     
    return $res;
}, 10, 3);
#2761881

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Yes - that should work.

#2761882

Can I combine the two? How would this be?

#2761894

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

You can use it like as follows:

add_filter( 'gettext', 'func_translate_text', 20, 3 );
function func_translate_text( $res , $text, $domain ) {

  if( $res == '--- not set ---' && $domain == 'wpv-views' ){
        $res = 'custom text not set';
  }

  if( $res == 'Please validate reCAPTCHA' && $domain == 'wpv-views' ){
        $res = 'custom text Please validate reCAPTCHA';
  }
     
  return $res;
}
#2761895

Thanks Minesh!!