Description

The wpforms_stripe_api_payment_intents_filter_config_element_locale filter lets you define the language locale for the Stripe Payment Element field. By default, Stripe uses the browser’s language, but with this filter you can pre-set the locale to a specific two-letter code (such as en, de, fr).

Stripe Elements validates locale codes automatically. WPForms includes a fallback that defaults to auto if the locale is not a valid two-character string. You can use this filter to enforce consistent localization regardless of the user’s browser language.

parametertypedescription
$localestringThe language locale code. Default is an empty string which falls back to auto (browser detection).

Source

wpforms\src\Integrations\Stripe\Api\PaymentIntents.php

Example

// Force Stripe field placeholders to display in German.
function wpf_stripe_locale_de() {
    return 'de';
}
add_filter( 'wpforms_stripe_api_payment_intents_filter_config_element_locale', 'wpf_stripe_locale_de' );

Reference Article