setCustomErrorTranslations method

void setCustomErrorTranslations(
  1. String locale,
  2. FormErrorKey key,
  3. String message
)

Sets a custom translation for a specific error key and locale.

If a translation already exists for the given locale and key, it will be overwritten.

Usage:

localizations.setCustomErrorTranslations('fr', PredefinedFormErrorKey(PredefinedFormErrorType.required), 'Ce champ est obligatoire');

Implementation

void setCustomErrorTranslations(
    String locale, FormErrorKey key, String message) {
  _customTranslations.putIfAbsent(locale, () => {})[key] = message;
}