I’m trying to use ng2-translate and ng-validation work together.
I’m creation the validation array like:
validationMessages = {
‘name’: {
‘required’: ‘El nombre es obligatorio ’,
‘pattern’: ‘El nombre es inválido ’,
‘maxlength’: ‘La longitud máxima del nombre es 30 ’,
},
‘sex’: {
‘required’: ‘El sexo es obligatorio ’,
},
‘birthdate’: {
‘required’: ‘La fecha de nacimiento es obligatoria ’,
}
};
I have the es.json and en.json files for spanish and english languages. How can I make the translation of the error messages? As I know the ng2-translate is async.
It may be fragile as you say, but at code level it’s simple. Don’t you think adding a subscription for each of the texts is excessive? How would you develop the example I’ve put with subscriptions in an easy way?