overrideTranslationsFromMap method
Overrides existing translations of locale
with new ones from the map
.
If isFlatMap
is true, then the keys of the map are interpreted as paths.
E.g. {'myPath.toKey': 'Updated Text'}
If isFlatMap
is false, then the structure is like a parsed json.
Checkout overrideTranslations for more documentation.
Please do a try-catch to prevent app crashes!
Implementation
void overrideTranslationsFromMap({
required E locale,
required bool isFlatMap,
required Map map,
}) {
final currentMetadata = translationMap[locale]!.$meta;
translationMap[locale] = utils.buildWithOverridesFromMap(
locale: locale,
isFlatMap: isFlatMap,
map: map,
cardinalResolver: currentMetadata.cardinalResolver,
ordinalResolver: currentMetadata.ordinalResolver,
);
if (locale == currentLocale) {
updateProviderState(locale);
}
}