Custom Fields
Re-Envisioned
Support General Include localization for jQuery Validation

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
    Replies
  • #33091
    Long Nguyen
    Moderator

    Hi,

    When creating the validation message for the field, you can use the function gettext to make the message translatable. For example:

    'validation' => [
        'rules'  => [
            'field_id' => [
                'required'  => true,
            ],
        ],
        'messages' => [
            'field_id' => [
                'required'  => __( 'Password is required', 'your-text-domain' )
            ],
        ],
    ],

    Refer to the documentation https://codex.wordpress.org/I18n_for_WordPress_Developers

    #33101
    SIW
    Participant

    Hi, thanks for your reply. I know I can do it this way, but that means that for every field I have to define the validation, even for fields that have default validations like required, email or number. By loading the localization files this is not necessary.

    #33111
    Long Nguyen
    Moderator

    Hi,

    Thanks for your feedback.

    I will inform the development team to consider supporting this feature request.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.