addTranslations method
void
addTranslations(})
Stores a set of translations in the set of gettext catalogs.
final translations = {
"myContext": {
"hello": {
"msgstr": ["hola"]
}
}
}
gt.addTranslations('es-ES', translations, domain: 'messages')
Params:
locale
A locale string
domain
A domain name
translations
An object of gettext-parser JSON shape
Implementation
void addTranslations(
String locale,
Map<String, dynamic> translations, {
String domain = 'messages',
}) {
final catalog = catalogs[locale] ?? Catalog({});
catalog.addTranslations(domain, Translations.fromJson(translations));
setCatalog(locale, catalog);
if (_locale.isEmpty) this.locale = locale;
}