Translate "required fields" at form level

The company I work for deals with form submissions that need to be available in three languages. However, it’s only possible to change the “required fields” text globally, not on a per-form basis. Is it possible to customize the “required fields” text at the form level?

Hi there!

I can help you set up different “required fields” text for each of your forms in different languages.

Here’s how to create custom “required fields” text for each specific form:

add_filter( 'gform_required_legend', 'dynamic_required_legend', 10, 2 );
function dynamic_required_legend( $legend, $form ) {
    $form_id = $form['id'];
    
    // Change text based on which form is showing
    if( $form_id == 1 ) {
        return '<span class="gfield_required gfield_required_text">* Required fields (English)</span>';
    } 
    elseif( $form_id == 2 ) {
        return '<span class="gfield_required gfield_required_text">* Campos obligatorios (Spanish)</span>';
    }
    elseif( $form_id == 3 ) {
        return '<span class="gfield_required gfield_required_text">* Champs obligatoires (French)</span>';
    }
    // Default text for any other forms
    else {
        return '<span class="gfield_required gfield_required_text">* Required fields</span>';
    }
}

Screenshot:

To use this solution:

  1. Go to your WordPress dashboard
  2. Navigate to Appearance → Theme Editor (or use a code snippet plugin if you have one)
  3. Open your theme’s functions.php file
  4. Paste the code snippet at the end of the file
  5. Update/save the file

Important: Make sure to replace the form IDs (1, 2, 3) with your actual form IDs, which you can find in the Gravity Forms section of your dashboard.

This way, Form #1 will show the English text, Form #2 will show Spanish, and Form #3 will show French. Any other forms will show the default English message.

Give it a try, and let me know how that goes! :grinning_face_with_smiling_eyes: