parseMessageFile method
Implementation
MessagesWithMetadata parseMessageFile(
Map<String, dynamic> arb,
AssetId assetId, [
String inferredLocale = 'en_US',
]) {
final locale = arb['@@locale'] as String?;
final context = arb['@@context'] as String?;
final referencePath = arb['@@x-reference'] as String?;
final messagesWithKeys = arb.keys
.where((key) => !key.startsWith('@'))
.map((key) => (key, parseMessage(arb, key, '${context}_$locale')))
.toList();
messagesWithKeys.sort((a, b) => a.$1.compareTo(b.$1));
final messages = messagesWithKeys.map((e) => e.$2).toList();
return MessagesWithMetadata(
messages,
locale ?? inferredLocale,
context,
referencePath,
getHash(arb),
arb.keys.any((key) => key.startsWith('@') && !key.startsWith('@@')),
assetId,
);
}