0.0.2 • Published 5 years ago

yup-locale-cs v0.0.2

Weekly downloads
16
License
MIT
Repository
github
Last release
5 years ago

Czech Translation of Yup Messages

This repository contains a single JavaScript file which exports Czech versions for Yup validation messages. (Only mixed.notType hasn't been translated as it would need a helper method that is not publicly exported by Yup.)

Another approach to localization of Yup messages would be to change the default messages to translation property keys and do the translation in the "UI part" of your app. See this Yup issue discussion for details.

Usage

Copy the file and use it however you like or "npm install" it directly from this Github repository.

Make sure to set your localized messages before any other calls to Yup, see yup#using-a-custom-locale-dictionary for details.

import * as yup from 'yup';
import yupLocaleCs from 'yup-locale-cs';

yup.setLocale(yupLocaleCs);

// Now use Yup schemas AFTER you defined your custom dictionary
const schema = yup.object().shape({
  name: yup.string(),
  age: yup.number().min(18),
});

NOTE: Translated copy of https://github.com/skress/yup-locale-de