Saltar navegación

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

This support ticket is created hace 7 meses, 2 semanas. 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 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

Este tema contiene 5 respuestas, tiene 2 mensajes.

Última actualización por Minesh hace 7 meses, 2 semanas.

Asistido por: Minesh.

Autor
Mensajes
#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
Colaborador

Idiomas: Inglés (English )

Zona horaria: 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
Colaborador

Idiomas: Inglés (English )

Zona horaria: Asia/Kolkata (GMT+05:30)

Yes - that should work.

#2761882

Can I combine the two? How would this be?

#2761894

Minesh
Colaborador

Idiomas: Inglés (English )

Zona horaria: 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!!