mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
Support translation contexts
This commit is contained in:
parent
b0a8f3e2f5
commit
0e33ce190d
6 changed files with 55 additions and 31 deletions
|
@ -48,12 +48,9 @@ class Item(AstNode):
|
|||
|
||||
def emit_xml(self, xml: XmlEmitter):
|
||||
value = self.children[Value][0]
|
||||
translatable = isinstance(value, TranslatedStringValue)
|
||||
xml.start_tag("item", translatable="true" if translatable else None)
|
||||
if translatable:
|
||||
xml.put_text(value.string)
|
||||
else:
|
||||
value.emit_xml(xml)
|
||||
attrs = value.attrs if isinstance(value, TranslatedStringValue) else {}
|
||||
xml.start_tag("item", **attrs)
|
||||
value.emit_xml(xml)
|
||||
xml.end_tag()
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue