mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
language: Add translation-domain
This allows you to set the translation domain of a blueprint file.
This commit is contained in:
parent
c5fa33363f
commit
e261180dcc
6 changed files with 72 additions and 2 deletions
|
@ -26,6 +26,7 @@ from .gobject_object import Object
|
|||
from .gtk_menu import Menu, menu
|
||||
from .gtkbuilder_template import Template
|
||||
from .imports import GtkDirective, Import
|
||||
from .translation_domain import TranslationDomain
|
||||
|
||||
|
||||
class UI(AstNode):
|
||||
|
@ -34,6 +35,7 @@ class UI(AstNode):
|
|||
grammar = [
|
||||
GtkDirective,
|
||||
ZeroOrMore(Import),
|
||||
Optional(TranslationDomain),
|
||||
Until(
|
||||
AnyOf(
|
||||
Template,
|
||||
|
@ -75,6 +77,14 @@ class UI(AstNode):
|
|||
def gtk_decl(self) -> GtkDirective:
|
||||
return self.children[GtkDirective][0]
|
||||
|
||||
@property
|
||||
def translation_domain(self) -> T.Optional[TranslationDomain]:
|
||||
domains = self.children[TranslationDomain]
|
||||
if len(domains):
|
||||
return domains[0]
|
||||
else:
|
||||
return None
|
||||
|
||||
@property
|
||||
def contents(self) -> T.List[T.Union[Object, Template, Menu]]:
|
||||
return [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue