Skip to content

mod_translation_updater.py: Parses escape codes in .tr files incorrectly #1

@rubenwardy

Description

@rubenwardy

Minetest version

Minetest 5.9.0-dev

Summary

The script uses regex to parse translation lines, which is incorrect. Take the following example:

Something@@= Something@@

The script will ignore this line as it thinks the @ is escaping the =, but it is actually adding @. Another issue: the script ignores invalid lines without warning!

The script also assumes that a translation is only ever on one line. This is not the case, given @\n:

A @n newline = Une @
nouvelle ligne

Steps to reproduce

I've written my own Python .tr file parser with unit tests here. Unit tests should be added to mod_translation_updater.py, it's unacceptable to have a parser without tests.

My implemention throws a lot of information away (ie: comments) so couldn't be taken directly, but inspiration can be taken from the approach (which is based on the .cpp code)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions