department-of-veterans-affairs / va-forms-system-core

VA Forms System Core will be a React library hosted in NPM that will allow engineers and designers to easily interact with Forms inside of vets-website.
https://department-of-veterans-affairs.github.io/va-forms-system-core/
6 stars 4 forks source link

Prepare error messages for internationalization #618

Open obliviga opened 2 years ago

obliviga commented 2 years ago

Description

According to our documentation, all error messaging should be internationalized. By default, error messages are generated in src/utils/validation.ts and are not translated. To improve accessibility, the default error messages should be placed in a translations file like src/messages/en.ts.

Potential solution

Add a variable to the string inside the translations file:

default: '{{ label }} is required',

And then modify the getMessage function from i18n to accept a second argument that's an object of template values.

Acceptance Criteria