Skip to content

Custom Locale is not working. #427

Description

@prince17dec

When I try to use locale which the library supports, the locale is not working for example for English I got the proper message.
"The username field is required." but in the case of another language "Fält :attribut krävs.'," basically here field name is missing which is username.

Am using the Swedish locale.

import SimpleReactValidator from 'simple-react-validator';
import 'simple-react-validator/dist/locale/sv';

const validator = useRef(new SimpleReactValidator({locale: 'sv'}));

<label>
  {t('username')}
  <input
	  id="username"
	  type="text"
	  name="username"
	  value={username}
	  onChange={event => setUsername(event.target.value)}
	  onBlur={()=>validator.current.showMessageFor('username')}
  />
  {validator.current.message('username', username, 'required|email')}
  </label>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions