compile method

String compile()

Implementation

String compile() {
  final blocks = <StringBuffer>[];

  if (table.translations[''] != null && table.translations['']![''] != null) {
    blocks.add(
      _drawBlock(
        table.translations['']![''] as Map<String, dynamic>,
        msgstr: [generateHeader(table.headers)],
      ),
    );
  }

  table.translations.forEach((msgctx, messages) {
    if (msgctx == '') {
      messages = Map.of(messages)..remove('');
    }

    blocks.addAll(
      messages.values.whereType<Map<String, dynamic>>().cast<Map<String, dynamic>>().map(_drawBlock),
    );
  });

  return blocks.join('\n\n');
}