loadTranslation method

void loadTranslation(
  1. SupportedTranslation translation
)

Loads a specific translation, adding its content to the internal map of localized strings.

Implementation

void loadTranslation(SupportedTranslation translation) {
  logger.log("Loading translation: ${translation.name}");
  rootBundle.loadString(translation.path).then((data) {
    Map<String, dynamic> jsonMap = json.decode(data);
    _localizedStrings
        .addAll(jsonMap.map((key, value) => MapEntry(key, value.toString())));
    _includedTranslations.add(translation.name);
    logger.log("Translation loaded: ${translation.name}");
  });
}