parseFile method

  1. @override
MessagesForLocale parseFile(
  1. String content,
  2. {MessageGeneration generation}
)
override

Implementation

@override
MessagesForLocale parseFile(
  String content, {
  MessageGeneration generation,
}) {
  Map<String, BasicTranslatedMessage> messagesFromJson(
    Map<String, dynamic> data,
  ) {
    final translations = <String, BasicTranslatedMessage>{};

    data.forEach((id, messageData) {
      final message = recreateIntlObjects(id, messageData);
      if (message != null) {
        translations[id] = message;
      }
    });

    return translations;
  }

  final data = _jsonDecoder.decode(content);
  final messages = messagesFromJson(data);
  return MessagesForLocale(messages, locale: data['@@locale']);
}