We want to add a .locale("fieldname") method on s.object which set the field which defines the locale of an object. It will be used together with s.locale():
s.object({ title: s.string(), lang: s.locale("en_us", "fr_fr") }).locale("lang") // "lang" could be anything...
Full example will be something like this:
const schema = s.object({ title: s.string(), lang: s.locale("en_us", "fr_fr") }).locale("lang")
export default c.define("/test.val.ts", schema, {
title: "hello",
lang: "en_us"
})
We want to add a .locale("fieldname") method on
s.objectwhich set the field which defines the locale of an object. It will be used together with s.locale():Full example will be something like this: