Navigation überspringen

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

This support ticket is created vor 1 year, 2 months. There's a good chance that you are reading advice that it now obsolete.

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 -

Zeitzone des Unterstützers: Asia/Kolkata (GMT+05:30)

Dieses Thema enthält 5 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von Minesh vor 1 year, 2 months.

Assistiert von: Minesh.

Author
Artikel
#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
Unterstützer

Sprachen: Englisch (English )

Zeitzone: 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
Unterstützer

Sprachen: Englisch (English )

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

Yes - that should work.

#2761882

Can I combine the two? How would this be?

#2761894

Minesh
Unterstützer

Sprachen: Englisch (English )

Zeitzone: 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!!