janezd / trubar

Utility for translation of strings and f-strings in Python files
MIT License
3 stars 2 forks source link

Test syntactic correctness after translation #38

Closed janezd closed 1 year ago

janezd commented 1 year ago

Currently, https://github.com/biolab/orange-translations runs a github action that

The second step wastes time (not all sources were changed) and, more importantly, could already be done by trubar after translation.

trubar should have an option (either in configuration, or command line (--nocheck), or both) to check sources after translation. To save time, check would only be run if target file was translated (not copied) and the translation differs from previous translation.

While implementing this, you can also improve the output by allowing different levels of verbosity. Report either

janezd commented 1 year ago

Translated source is generated by calling ASTs tree.code_for_node, which is unlikely to be syntactically incorrect. The only possible source of problem would be incorrect auto-import config option, but this is very unlikely to go undetected for long.

Neither trubar nor orange-translation need to check the syntax of the output.

It would be, however, beneficial to reduce the output clutter.