Hello,
The locale is based on the WordPress Installed site language set in Settings. There is a filter for that locale
in get_locale() function.
One possible way to work around this is to use the wp_enqueu_scripts
hook to add a filter and remove the filter. It could look like this:
/**
* Change the locale for just one form instead of the whole website
* Note that the action priority is important as this is what the
* plugin uses to enqueue scripts.
*
* @return void
*/
function custom_locale() {
add_filter( 'locale', 'update_locale' );
}
add_action( 'wp_enqueue_scripts', 'custom_locale', 50 );
/**
* Change the locale for just one form instead of the whole website
* Note that the action priority is important as this runs after the
* plugin enqueue scripts.
*
* @return void
*/
function remove_custom_locale() {
remove_filter( 'locale', 'update_locale' );
}
add_action( 'wp_enqueue_scripts', 'remove_custom_locale', 51 );
/**
* Change the locale
*
* @param String $locale
*
* @return Sting $locale
*/
function update_locale( $locale ) {
return 'uk_UA';
}
I’m not convinced yet that there is a good use-case for a filter hook in the “ReCaptcha v2 for Contact Form 7”. The forms inherit the same language that the website is set to. Since the reCaptcha script is only enqueued once, all forms would have to have the same locale. I personally believe that the best solution for this is to set the Site Language to the one you desire.
Hopefully, the above answers your question, but should you need anything else, please reply to this thread and we can assist you further. Have a wonderful rest of your week!