decompiler: Force newline before translator comments

The decompiler does not insert newlines and so relies on the formatter
to format its output. The previous commit however broke translator
comments, as they are now assumed to be inline.

Therefore, make sure the decompiler forces a newline before a translator
comment. We could special case such a comment in the formatter, but this
might be difficult if #202 gets resolved, whereas in the decompiler we
already know exactly when a comment is a translator comment.
This commit is contained in:
Matthijs Velsink 2025-06-12 19:22:09 +02:00
parent ed867269dd
commit dc71762c9c

View file

@ -375,7 +375,7 @@ def decompile_translatable(
comments = ""
else:
comments = comments.replace("/*", " ").replace("*/", " ")
comments = f"/* Translators: {comments} */"
comments = f"\n/* Translators: {comments} */"
if context is not None:
return comments, f"C_({escape_quote(context)}, {escape_quote(string)})"