Skip Navigation

[Resolved] Translate button text

This support ticket is created 3 years, 6 months ago. 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 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 1 reply, has 2 voices.

Last updated by Christian Cox 3 years, 5 months ago.

Assisted by: Christian Cox.

Author
Posts
#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;
}