knicola / yup-password

Yup, dead simple password validation.
MIT License
48 stars 6 forks source link

Any plans for i18n support? #4

Closed christoph-kluge closed 5 months ago

christoph-kluge commented 2 years ago

Do you plan to add global i18n message support?

Yup.setLocale({
  string: {
    minLowercase: '${path} must contain at least ${length} lowercase letters',
    minUppercase: ({path, min, length}) => {
      if (length > 1) {
        return '${path} must contain at least ${length} uppercase letters'
      }
      return '${path} must contain at least ${length} uppercase letter'
    },
    // minNumbers: ...,
    // minSymbols: ...,
    // minRepeating: ...
    // minWords: ...
  }
})
knicola commented 2 years ago

I can certainly look into it

knicola commented 2 years ago

Unfortunately, yup does not seem to provide a way for 3rd party methods to extend the locale object. There's a PR https://github.com/jquense/yup/pull/936 attempting to address the issue :crossed_fingers:

knicola commented 5 months ago

message localization support added in v0.4.0