While trying to extract add-on message for translations, I ran into a few issues.
- In multi-file modules, the script would crash because it tried to write to the dir instead of a translations.py file;
- the add-on message extraction works by enabling the add-on, getting all messages; disabling the add-on, getting all messages; then comparing the two message sets. But often a bug happens where a class gets a description from somewhere else in memory. I couldn’t debug that, so a workaround is to check that the message isn’t a corrupted one before removing it;
- printf() doesn't exist in Python and would crash the script;
- self.src[self.settings.PARSER_PY_ID] can be replaced by self.py_file in class I18n, since a property exists to do that;
- at one point a generator was printed instead of its values, so let's unpack the generator to get the values. Maybe the print could be deleted entirely;
- use SPDX license identifier instead of GPL license block, to be more in line with other scripts from the codebase.
@Bastien Montagne (mont29) If that’s too much I can separate this into several diffs.