Interface: I18nCallback()
Callback function type for internationalization translation.
This function is responsible for translating validation message keys into localized strings. It receives a message term (like 'string.min') and should return the translated message in the appropriate language.
Example
typescript
const translateToSpanish: I18nCallback = (term: string) => {
const translations = {
"string.base": "debe ser una cadena de texto",
"number.min": "debe ser mayor o igual a {{#limit}}",
};
return translations[term] || term;
};ts
I18nCallback(term: string): string;Parameters
| Parameter | Type | Description |
|---|---|---|
term | string | The message key to translate (e.g., 'string.base', 'number.min') |
Returns
string
The translated message string, or the original term if translation fails