Passer la navigation

[Résolu] Translate button text

This support ticket is created Il y a 4 years. 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Fuseau horaire du supporter : America/New_York (GMT-04:00)

Ce sujet contient 1 reply, a 2 voix.

Dernière mise à jour par Christian Cox Il y a 4 years.

Assisté par: Christian Cox.

Auteur
Publications
#2154683
Screenshot 2021-08-29 at 4.14.14 PM.png
Screenshot 2021-08-29 at 5.34.50 PM.png

Dear Sir/Madam,

I have an add post form containing file upload element, my site's default language is Traditional Chinese, please advise how I can translate the text from the button.

Best regards,

Kelvin.

#2155323

You can add the following custom code snippet and translate this text:

add_filter( 'gettext', 'func_change_forms_upload_button_texts', 20, 3 );
function func_change_forms_upload_button_texts( $translated_text, $untranslated_text, $domain ) {
  
    if ( !is_admin() ) {
  
      if( $untranslated_text== 'Upload or select image' && $domain == 'wp-cred' ) {
             $translated_text = 'traslated text for Upload or select file goes here';
        }
  
    }
  
    return $translated_text;
}