説明

wpforms_stripe_api_payment_intents_filter_config_element_locale フィルターを使用すると、Stripe Payment Element フィールドの言語ロケールを定義できます。デフォルトでは、Stripe はブラウザの言語を使用しますが、このフィルターを使用すると、ロケールを特定の 2 文字のコード(endefr など)にあらかじめ設定できます。

Stripe Elements はロケールコードを自動的に検証します。WPForms には、ロケールが無効な 2 文字の文字列の場合に auto にデフォルトするフォールバックが含まれています。このフィルターを使用して、ユーザーのブラウザ言語に関係なく、一貫したローカライゼーションを強制できます。

パラメータータイプ説明
$locale文字列言語ロケールコード。デフォルトは空文字列で、auto(ブラウザ検出)にフォールバックします。

ソース

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

// 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' );

参考記事