load method
Load the CSV file and add translations per language.
Implementation
Future<CsvLocalizations> load(
Locale locale,
AssetBundle bundle,
String path,
) async {
_langTag = locale.toLanguageTag();
final csvDoc = await bundle.loadString(path);
final rows = CsvToListConverter(eol: eol).convert(csvDoc);
final languages = List<String>.from(rows.first);
_translationsMap.addEntries(languages.map((e) => MapEntry(e, {})));
for (int i = 0; i < languages.length; i++) {
final String languageCode = languages[i];
for (final List row in rows) {
final String key = row.first;
final String value = row[i];
_translationsMap[languageCode]![key] = value;
}
}
return this;
}