https://github.com/mirai-audio/ember-i18n-changeset-validations
ember-i18n support for ember-changeset-validations messages
https://github.com/mirai-audio/ember-i18n-changeset-validations
ember ember-addon ember-changeset i18n internationalization validation
Last synced: 2 days ago
JSON representation
ember-i18n support for ember-changeset-validations messages
- Host: GitHub
- URL: https://github.com/mirai-audio/ember-i18n-changeset-validations
- Owner: mirai-audio
- License: mit
- Created: 2018-01-07T16:52:30.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2021-05-06T17:11:48.000Z (about 5 years ago)
- Last Synced: 2026-06-11T18:24:13.104Z (4 days ago)
- Topics: ember, ember-addon, ember-changeset, i18n, internationalization, validation
- Language: JavaScript
- Size: 7.49 MB
- Stars: 10
- Watchers: 1
- Forks: 1
- Open Issues: 47
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# ember-i18n-changeset-validations
[](https://circleci.com/gh/mirai-audio/ember-i18n-changeset-validations)
[](https://coveralls.io/github/mirai-audio/ember-i18n-changeset-validations?branch=master)
[](https://www.npmjs.com/package/ember-i18n-changeset-validations)
[](https://emberjs.com/)
[](https://emberobserver.com/addons/ember-i18n-changeset-validations)
[](https://greenkeeper.io/)
_Adds support for ember-i18n to ember-changeset-validations_
`ember-i18n-changeset-validations` is a companion validation library to
`ember-changeset-validations`. This addon adds the ability to translate
`ember-changeset-validation` messages using the `ember-i18n` addon. Since
`ember-changeset` is required to use this addon, please see [documentation
there](https://github.com/poteto/ember-changeset) on how to use changeset.
## Usage
To install: `ember install ember-i18n-changeset-validations`.
This addon also provides `ember-changeset-validations` (and `ember-changeset`)
as dependencies.
Define `ember-i18n` translation files for the validation messages files in
`app/locales//validations.js` (where `LANG_CODE` is an ISO language
code).
An example of an `ember-i18n` translation file, showing a translation key
that will replace the default "between" message from
`ember-changeset-validations`.
```javascript
// app/locales/en/validations.js
export default {
/* overrides for ember-changeset-validation messages
* see: ember-changeset-validations/utils/messages
*/
between: "{description} must be between{min} and {max} characters",
};
```
An example of a Japanese validation message.
```javascript
// app/locales/ja/validations.js
export default {
/* overrides for ember-changeset-validation messages
* see: ember-changeset-validations/utils/messages
*/
between: "{description}は{min}〜{max}文字の間でなければなりません",
};
```
For each locale (en & ja in this example), import the validations translation
module into the main `ember-i18n` manifest, located in
`app/locales//translations.js`.
e.g English translations manifest file.
```javascript
// app/locales/en/validations.js
import validations from "./validations";
// other imports
export default {
// other translation objects
validations
};
```
e.g. Japanese translations manifest file.
```javascript
// app/locales/ja/validations.js
import validations from "./validations";
// other imports
export default {
// other translation objects
validations
};
```
## Contributing
See the [Contributing](CONTRIBUTING.md) guide for details.
## License
This project is licensed under the [MIT License](LICENSE).