setLocalizations method

  1. @override
Future<bool> setLocalizations(
  1. Locale locale,
  2. Map<String, dynamic> localizations
)
override

Set localization mapping for the specified locale.

Locale json is named according to the locale languageCode. For example, the Danish translation is named da

Returns true if successful, false otherwise.

Implementation

@override
Future<bool> setLocalizations(
    Locale locale, Map<String, dynamic> localizations) async {
  _assertCarpService();
  info(
      'Setting language locale from path : ${_getLocalizationsPath(locale)}');

  DocumentReference reference =
      CarpService().document(_getLocalizationsPath(locale));
  await reference.get(); //check if this already exists
  await reference.setData(localizations);

  return true;
}