Comments (2)
Im just looking into custom validators, which got me thinking.
Wrap each provided validator you need, and before the buildMessage function is called you can intercept the message and provide your own language based one.
For example, 'isOne' maps to messages.js, so you could have 'isOneENG' , 'isOneFR' etc...
import buildMessage from 'ember-changeset-validations/utils/validation-errors';
// validators/custom.js
export default function validateIsOne(options) {
return (key, newValue, oldValue, changes, content) => {
return newValue === 1 || buildMessage(key, 'isOne', newValue, options);
}
}
from ember-changeset-validations.
I would very much like to see this as well. Not even for localization, but in many cases the propertyName doesnt normalize to something user friendly, such a foobarId
foreign key type property.
from ember-changeset-validations.
Related Issues (20)
- async validator is called multiple times with the same value HOT 2
- Date validator does not respect 'rawOutput' option HOT 2
- async validators can complete out of order HOT 4
- Documentation for rawOutput
- (Octane) skipValidate=true in helper does not work HOT 2
- (Octane) Documentation update suggestion: passing the validation instance HOT 1
- ember inspector silently polluting `changes`? HOT 1
- Button attribute not updating using classic components syntax HOT 1
- Access Service from validator class
- Freezed value in Input HOT 5
- Update to ember-validates v4 is breaking change HOT 2
- allowBlank doesn't work with validateFormat() HOT 1
- [Proposal] Use isEmpty for the date validator's allowBlank alike the other validators
- Use of `assign` has been deprecated
- [rfc]: Externalize schema validation HOT 4
- Strange behavior with an array of objects HOT 2
- Dependent field validation capability
- Docs pages are missing
- `description` option type missing for validators
- Provided description for validation not passed in rawOutput for buildMessage
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ember-changeset-validations.