mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-06-21 23:19:24 -04:00
scale: Decompile non-translatable labels too
While working on the previous commit, I noticed Gtk.Scale specially handles translator comments, but more importantly, that it does not put non-translatable labels in its decompiled output. This is wrong, as it's not unlikely that Gtk.Scale marks would use a purely numeric string, which should not be lost upon decompilation. Add a test for this case too.
This commit is contained in:
parent
dc71762c9c
commit
e16e723a81
3 changed files with 7 additions and 5 deletions
|
@ -167,8 +167,11 @@ def decompile_mark(
|
|||
comments=None,
|
||||
context=None,
|
||||
):
|
||||
comments, translatable = decompile_translatable(
|
||||
cdata, translatable, context, comments
|
||||
)
|
||||
if comments is not None:
|
||||
ctx.print(f"/* Translators: {comments} */")
|
||||
ctx.print(comments)
|
||||
|
||||
text = f"mark ({value}"
|
||||
|
||||
|
@ -177,10 +180,7 @@ def decompile_mark(
|
|||
elif cdata:
|
||||
text += f", bottom"
|
||||
|
||||
if truthy(translatable):
|
||||
comments, translatable = decompile_translatable(
|
||||
cdata, translatable, context, comments
|
||||
)
|
||||
if cdata:
|
||||
text += f", {translatable}"
|
||||
|
||||
text += "),"
|
||||
|
|
|
@ -4,6 +4,7 @@ Scale {
|
|||
marks [
|
||||
mark (-1, bottom),
|
||||
mark (0, top, _("Hello, world!")),
|
||||
mark (1, bottom, "1"),
|
||||
mark (2),
|
||||
]
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ corresponding .blp file and regenerate this file with blueprint-compiler.
|
|||
<marks>
|
||||
<mark value="-1" position="bottom"></mark>
|
||||
<mark value="0" position="top" translatable="yes">Hello, world!</mark>
|
||||
<mark value="1" position="bottom">1</mark>
|
||||
<mark value="2"></mark>
|
||||
</marks>
|
||||
</object>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue