readModuleTranslationFile method
readModuleTranslationFile() Permits to load the content of the matching translation file asset from a given locale of a module.
Implementation
Future<void> readModuleTranslationFile(Locale locale, String package) async {
var path = '''$package'''
'''${KareeConstants.kApplicationLocalizationRessourcDir}'''
'''/${locale.toLanguageTag()}.json''';
try {
String translationString = await loadConfig(path);
if (translation == null) {
translation = jsonDecode(translationString);
} else {
translation!.addAll(jsonDecode(translationString));
}
} catch (e) {
_handleTranslationFileNotExists(locale, path, e as Error);
}
}