LogPOTVisitor function

void LogPOTVisitor (List<CommentStatement> comments, List<L10NStatement> statements)

Prints all the POT-Blocks

final List<Token> tokens = lexer.scan(source);

final List<Statement> statements = parser.parse(filename, tokens);
final List<POTBlock> blocks = collectPOTBlocks(statements);

pot.addBlocks(blocks);
pot.addBlocks(blocks);

pot.mergedBlocks.values.forEach((final MergedPOTBlock block) {
    block.visit(PrintPOTVisitor);
});

Implementation

void LogPOTVisitor(
    final List<CommentStatement> comments,
    final List<L10NStatement> statements) {

    final Logger _logger = new Logger("test.unit.parser._TestPrintPOTVisitor");

    comments.forEach((final CommentStatement statement) {
        final List<String> lines = statement.comment.split(new RegExp(r"\n"));
        lines.forEach((final String line) => _logger.fine("#. ${line.trimLeft()}"));
    });
    statements.forEach((final L10NStatement statement) {
        _logger.fine("#: ${statement.filename}:${statement.line}");
    });

    // All Statements have the same msgid - so we pick the first one
    final L10NStatement statement = statements.first;

    _logger.fine('msgid "${statement.msgid}"');
    if(statement.params.length > 1) {
        _logger.fine('msgid_plural "${statement.params[1]}"');
    }
    _logger.fine('msgstr ""');
    _logger.fine('');
}