gform_moderation_locale

Description

The gform_moderation_locale filter lets you override the default locale used for moderation analysis.

Usage

add_filter( 'gform_moderation_locale', 'your_function_name', 10, 2 );

Parameters

ParameterTypeDescription
$localestringThe locale being filtered.
$entryarrayDuring a form submission, contains the current Entry Object.

The $locale parameter supports the following locales and any prefixed with these strings:

ar
zh
cs
nl
en
fr
de
hi
id
it
ja
ko
pl
pt
ru
es
sv

Examples

Set specific form to use Spanish locale

This example runs moderation based on the Spanish language when entry is submitted from Form ID 4.

add_filter( 'gform_moderation_locale', function( $locale, $entry ) {

    if ( rgar( $entry, 'form_id' ) == '4' ) {
        return 'es_ES';
    }

    return $locale;

}, 10, 2 );

Placement

This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.

See also the PHP section in this article: Where Do I Put This Code?

Since

This filter was added in Gravity Forms Moderation version 1.0.

Source Code

This filter is located in gravityformsmoderation/class-gf-moderation.php