arktype
arktype copied to clipboard
I18N error message customization
Ideally any error message should be specifiable as a Record of strings representing locale IDs to the translations in that locale, e.g:
const creditCard = type("number", {mustBe: "a valid credit card"})
// could also be
const creditCard2 = type("number", {mustBe: {
"en": "a valid credit card",
"fr": "une carte de credit"
}})
Then, locale could be specified at a config like like:
atconfig({
locale: "fr"
})
This feature would best be used with the global config option, which is planned here:
https://github.com/arktypeio/arktype/issues/691