Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Locale is not working. #427

Open
prince17dec opened this issue Oct 11, 2022 · 0 comments
Open

Custom Locale is not working. #427

prince17dec opened this issue Oct 11, 2022 · 0 comments

Comments

@prince17dec
Copy link
Contributor

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>
@prince17dec prince17dec changed the title Custom Locale is not wrking Custom Locale is not working. Oct 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant