Open hanssen opened 5 years ago
Experiencing the same, this is how I managed to get it working:
app/validators/messages.js
import ValidatorsMessages from 'ember-intl-cp-validations/validators/messages';
import { assign } from '@ember/polyfills';
export default ValidatorsMessages.extend({
getMessageFor(type, options = {}) {
return this._super(type, assign({ htmlSafe: false }, options));
}
});
app/services/intl.js
here we perform the suggested override to apply htmlSafe
to every translation
.....
// Overrides
t(key, options) {
return this._super(key, assign({ htmlSafe: true }, options));
}
.....
@ludalex approach worked fine for me, too.
If anyone wants to submit a PR, I'd happily review and merge.
I just added the
htmlSafe
flag by default as mentioned here. Then some of my validation message are broken:"undefined is invalid"
. It seemd the default messages likeblank
are broken, whereas custom messages still work.A workaround for me is disabling the
htmlSafe
flag for the validation messages, which I configured to haveprefix: 'forms.errors'
.