parseFiles method

  1. @override
Future parseFiles(
  1. List<ReadableFile> files,
  2. {TranslationCatalog catalog}
)
override

Implementation

@override
Future parseFiles(
  List<ReadableFile> files, {
  TranslationCatalog catalog,
}) async {
  final messagesByLocale = <String, MessagesForLocale>{};

  // In order to group these by locale, to support multiple input files,
  // we're reading all the data eagerly, which could be a memory
  // issue for very large projects.
  for (final file in files) {
    final data = await file.readDataOfExactType<StringFileData>();
    final content = data.contents;
    final messages = parseFile(content, catalog.defaultLocale);
    messagesByLocale.addEntries(messages.map((e) => e.asEntry()));
  }

  catalog.translatedMessages = {};
  messagesByLocale.forEach((locale, messages) {
    catalog.translatedMessages[locale] = messages.messages.values.toList();
  });
}