Approach for Internationalizing Schema Error Messages in Effect Typescript Library

What's the recommended approach to i18n of schema errors?
translating a string at most ${maxLength} character(s) long is complicated, would need to parse the message.

manually adding message annotations is tedious and doesn't really scale.

In this section of the docs, we start seeing some error "code" as "message": https://effect.website/docs/schema/error-messages/#compound-schemas
"error_max_length_field"
this however lacks the configured length of e.g 1.
if you inspect the annotations, you could use the json schema annotations to extract the number 1. (I haven't tried this in practice yet)

If you can somehow gather this data together, you can easily make translations or make programatic decisions:
{
  _tag: "MaxLengthError",
  maxLength: 1,
  value: "aa"
  message: "Expected a string at most 1 character(s) long, actual: aa"
}
Effect Documentation
Customize and enhance error messages for schema decoding with default, refined, and custom messages.
Error Messages
Was this page helpful?