yup-locale-ja

Japanese localization for yup

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. 25
  26. 26
  27. 27
  28. 28
  29. 29
  30. 30
  31. 31
  32. 32
  33. 33
  34. 34
  35. 35
  36. 36
  37. 37
  38. 38
  39. 39
  40. 40
  41. 41
  42. 42
  43. 43
  44. 44
  45. 45
  46. 46
  47. 47
  48. 48
  49. 49
  50. 50
  51. 51
  52. 52
# yup-locale-ja

[![npm](https://img.shields.io/npm/v/yup-locale-ja)](https://www.npmjs.com/package/yup-locale-ja)
[![Automated Tests Status](https://img.shields.io/github/actions/workflow/status/pocka/yup-locale-ja/test.yml?branch=master&label=test&logo=github)](https://github.com/pocka/yup-locale-ja/actions?query=workflow%3ATest)
[![Automated Publish Status](https://img.shields.io/github/actions/workflow/status/pocka/yup-locale-ja/publish.yml?label=publish&logo=github)](https://github.com/pocka/yup-locale-ja/actions?query=workflow%3APublish)

Japanese localization for [yup](https://github.com/jquense/yup) messages, with translation flavors.

[README (日本語)](./README_ja.md)

## Getting Started

```sh
$ yarn add yup yup-locale-ja

# or...
$ npm i yup yup-locale-ja
```

then, set a locale object as yup's default message dictionary with `setLocale` function.

```js
import { setLocale } from "yup";
import * as ja from "yup-locale-ja";

setLocale(ja.suggestive);
```

For more info, see [yup's README](https://github.com/jquense/yup#using-a-custom-locale-dictionary).

## Translation Flavors

This package comes with two flavors: **descriptive** and **suggestive**.
**descriptive** is such like "~です" ("... is ...") form, which simply describe the field's attribute.
In contrast, **suggestive** messages show a user an action to fix the error, such as "~してください" ("Please do ...").

```js
import * as ja from "yup-locale-ja";

ja.suggestive; // suggestive messages
ja.descriptive; // descriptive messages
```

## How to show a field label?

Add a label by calling [`.label`](https://github.com/jquense/yup#mixedlabellabel-string-schema) method on the field.
This package omits a field path unless a label is set.

## Similar Projects

- [loicmahieu/yup-locales](https://github.com/loicmahieu/yup-locales) ... `fr`, `nl`, `nb`, `de`, `ar`
- [arfurlaneto/yup-locale-pt](https://github.com/arfurlaneto/yup-locale-pt) ... `pt` with three translation flavors