dschnelldavis / angular2-json-schema-form

Angular 2 JSON Schema Form builder
MIT License
285 stars 177 forks source link

Support for custom locale validation messages #310

Open neil-coutinho opened 6 years ago

neil-coutinho commented 6 years ago

Issue type

I'm submitting a (check one): [ ] Bug report [x] Feature request [ ] Regression (something that used to work, but stopped working in a newer version) [x] Support request [ ] Documentation issue or request

Prerequisites

Before posting, make sure you do the following (check all): [x] Confirm you are using the latest versions of all necessary packages (or if not, explain why not) [x] Search GitHub for a similar issue or PR [x] If submitting a Support request, also search Stack Overflow for similar issues Note: Please cross-post GitHub support requests to Stack Overflow, and include a link in your GitHub issue to your Stack Overflow question. We do currently respond to support requests on GitHub, but we eventually expect to stop, and will then refer all support questions exclusively to Stack Overflow.

Current behavior

Currently, we have support English and French validation messages. In addition, we can provide validation messages by using one of the 3 available methods i.e.

Is there an option where in my custom widget component I can subscribe to a language change event and trigger and update to update the layoutNode's validationMessages?

Trying to support Spanish and a few other custom languages in my forms

 this.languageSwitch.currentLang
        .subscribe(data => {

         this.options.validationMessages.required = 'CUSTOM_LANGUAGE_STRING

      });

Expected behavior

IMPORTANT: How can we reproduce your problem?

Environment

OS name & version: Browser name & version: Angular version: Angular JSON Schema Form version(s): Other relevant software or packages:

Any other relevant information

In my custom widget I am subscribed to a language Subject Observable. When the SUBJECT emit's a new value I want to change the validation message to a custom string based on the emitted language code