Semantic-ui: Form Validation 路 Prompt Translation

Created on 20 Jan 2017  路  3Comments  路  Source: Semantic-Org/Semantic-UI

I need to know if there are already translations for form validation messages or what is the recommended way to do this.

I found these lines in the semantic.js but I do not know are just these...

text: {
    unspecifiedRule  : 'Please enter a valid value',
    unspecifiedField : 'This field'
},

prompt: {
    empty                : '{name} must have a value',
    checked              : '{name} must be checked',
    email                : '{name} must be a valid e-mail',
    url                  : '{name} must be a valid url',
    regExp               : '{name} is not formatted correctly',
    integer              : '{name} must be an integer',
    decimal              : '{name} must be a decimal number',
    number               : '{name} must be set to a number',
    is                   : '{name} must be "{ruleValue}"',
    isExactly            : '{name} must be exactly "{ruleValue}"',
    not                  : '{name} cannot be set to "{ruleValue}"',
    notExactly           : '{name} cannot be set to exactly "{ruleValue}"',
    contain              : '{name} cannot contain "{ruleValue}"',
    containExactly       : '{name} cannot contain exactly "{ruleValue}"',
    doesntContain        : '{name} must contain  "{ruleValue}"',
    doesntContainExactly : '{name} must contain exactly "{ruleValue}"',
    minLength            : '{name} must be at least {ruleValue} characters',
    length               : '{name} must be at least {ruleValue} characters',
    exactLength          : '{name} must be exactly {ruleValue} characters',
    maxLength            : '{name} cannot be longer than {ruleValue} characters',
    match                : '{name} must match {ruleValue} field',
    different            : '{name} must have a different value than {ruleValue} field',
    creditCard           : '{name} must be a valid credit card number',
    minCount             : '{name} must have at least {ruleValue} choices',
    exactCount           : '{name} must have exactly {ruleValue} choices',
    maxCount             : '{name} must have {ruleValue} or less choices'
},

...

error: {
    identifier : 'You must specify a string identifier for each field',
    method     : 'The method you called is not defined.',
    noRule     : 'There is no rule matching the one you specified',
    oldSyntax  : 'Starting in 2.0 forms now only take a single settings object. Validation settings converted to new syntax automatically.'
}

I'm starting with Semantic UI and really very happy with it.

Thank you.

Usage Question

All 3 comments

Well. I just published an example in the Brazilian Portuguese language in https://gist.github.com/natanfelles/3467aea2251574b2e60d95bef30ea10c.

@natanfelles

Glad you liked it! Your example is a fine working solution, and I did something similar in the past. The following is a standard response.

Please use the Gitter chatroom, the official forums or StackOverflow to ask usage questions; see the contributing guidelines for more information on what kind of posts should find themselves into the GitHub Issues board.

Now it can be configured with $.fn.form.settings.prompt.<ruleName> = 'message' - reference.

I copied the @natanfelles messages (thanksss) to this solution on this gist

Was this page helpful?
0 / 5 - 0 ratings