Include localization for jQuery Validation

Support General Include localization for jQuery ValidationResolved

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #33077
    SIWSIW
    Participant

    The jQuery Validation plugin contains localization for many languages (https://github.com/jquery-validation/jquery-validation/tree/master/src/localization). Would you consider loading those (based on the locale) in MetaBox?

    #33091
    Long NguyenLong 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
    SIWSIW
    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 NguyenLong Nguyen
    Moderator

    Hi,

    Thanks for your feedback.

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

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