mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
decompiler: Fix translator comments in properties
This commit is contained in:
parent
a12ac1b976
commit
25d9826aea
4 changed files with 23 additions and 4 deletions
|
@ -391,9 +391,6 @@ def decompile_property(
|
||||||
context=None,
|
context=None,
|
||||||
):
|
):
|
||||||
name = name.replace("_", "-")
|
name = name.replace("_", "-")
|
||||||
if comments is not None:
|
|
||||||
ctx.print(f"/* Translators: {comments} */")
|
|
||||||
|
|
||||||
if cdata is None:
|
if cdata is None:
|
||||||
ctx.print(f"{name}: ")
|
ctx.print(f"{name}: ")
|
||||||
ctx.end_block_with(";")
|
ctx.end_block_with(";")
|
||||||
|
|
6
tests/samples/translator_comments.blp
Normal file
6
tests/samples/translator_comments.blp
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
using Gtk 4.0;
|
||||||
|
|
||||||
|
Label {
|
||||||
|
/* Translators: This is a test comment. */
|
||||||
|
label: C_("test", "Hello, world!");
|
||||||
|
}
|
12
tests/samples/translator_comments.ui
Normal file
12
tests/samples/translator_comments.ui
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
DO NOT EDIT!
|
||||||
|
This file was @generated by blueprint-compiler. Instead, edit the
|
||||||
|
corresponding .blp file and regenerate this file with blueprint-compiler.
|
||||||
|
-->
|
||||||
|
<interface>
|
||||||
|
<requires lib="gtk" version="4.0"/>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="label" translatable="yes" comments="This is a test comment." context="test">Hello, world!</property>
|
||||||
|
</object>
|
||||||
|
</interface>
|
|
@ -206,6 +206,9 @@ class TestSamples(unittest.TestCase):
|
||||||
"unchecked_class",
|
"unchecked_class",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Decompiler-only tests
|
||||||
|
SKIP_COMPILE = ["translator_comments"]
|
||||||
|
|
||||||
SKIP_DECOMPILE = [
|
SKIP_DECOMPILE = [
|
||||||
# Not implemented yet
|
# Not implemented yet
|
||||||
"action_widgets",
|
"action_widgets",
|
||||||
|
@ -225,6 +228,7 @@ class TestSamples(unittest.TestCase):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
with self.subTest(sample):
|
with self.subTest(sample):
|
||||||
|
if sample not in SKIP_COMPILE:
|
||||||
self.assert_sample(sample, skip_run=sample in SKIP_RUN)
|
self.assert_sample(sample, skip_run=sample in SKIP_RUN)
|
||||||
|
|
||||||
with self.subTest("decompile/" + sample):
|
with self.subTest("decompile/" + sample):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue