Shared
- class appstream_python.Shared.TranslateableTag
Represents a translatable tag
- get_default_text() → str
Returns the untranslated text
- Return type:
str
- set_default_text(text: str) → None
Sets the untranslated text
- Parameters:
text (str)
- Return type:
None
- get_translated_text(lang: str) → str | None
Returns the translated text
- Parameters:
lang (str)
- Return type:
str | None
- get_translated_text_default(lang: str | None) → str | None
Returns the translated text. Returns the default text, if the translation does not exists
- Parameters:
lang (str | None)
- Return type:
str | None
- set_translated_text(lang: str, text: str) → None
Sets the translated text
- Parameters:
lang (str)
text (str)
- Return type:
None
- get_available_languages() → list[str]
Returns a list with all languages of the tag
- Return type:
list[str]
- load_tags(tag_list: list[_Element]) → None
Load a list of Tags
- Parameters:
tag_list (list[_Element])
- Return type:
None
- write_tags(parent_tag: _Element, tag_name: str) → None
Writes a Tag
- Parameters:
parent_tag (_Element)
tag_name (str)
- Return type:
None
- clear() → None
Resets all data
- Return type:
None
- class appstream_python.Shared.TranslateableList
Represents a translatable list
- get_default_list() → list[str]
Returns a list with the default items
- Return type:
list[str]
- get_translated_list(lang: str | None) → list[str]
Returns the translated list for the given language
- Parameters:
lang (str | None)
- Return type:
list[str]
- load_tag(tag: _Element) → None
Loads an Tag. Only for internal use.
- Parameters:
tag (_Element)
- Return type:
None
- write_all_tag(parent_tag: _Element, tag_name: str) → None
Writes the XML tags. Onnly for internal use.
- Parameters:
parent_tag (_Element)
tag_name (str)
- Return type:
None
- write_untranslated_tags(parent_tag: _Element, tag_name: str) → None
Writes the untranslated XML tags. Onnly for internal use.
- Parameters:
parent_tag (_Element)
tag_name (str)
- Return type:
None
- write_translated_tags(parent_tag: _Element, tag_name: str, lang: str) → None
Writes the translated XML tags. Onnly for internal use.
- Parameters:
parent_tag (_Element)
tag_name (str)
lang (str)
- Return type:
None
- clear() → None
Resets all data
- Return type:
None
- class appstream_python.Shared.DescriptionItem
The Interface for a Description Item
- get_type() → Literal['paragraph', 'unordered-list', 'ordered-list']
Retutns the Type of the Item
- Return type:
Literal[‘paragraph’, ‘unordered-list’, ‘ordered-list’]
- load_tags(tag_list: list[_Element]) → None
Loads teh XML tags into the Elemnt. Only for internal use.
- Parameters:
tag_list (list[_Element])
- Return type:
None
- get_tags(parent_tag: _Element) → None
Get the XML Tag from the Element. Only for internal use.
- Parameters:
parent_tag (_Element)
- Return type:
None
- get_translated_tag(lang: str | None) → _Element
Loads the tag for a given language
- Parameters:
lang (str | None)
- Return type:
_Element
- to_plain_text(lang: str | None = None) → str
Returns the content as plain text
- Parameters:
lang (str | None)
- Return type:
str
- class appstream_python.Shared.DescriptionParagraph
Represents a paragraph <p> in the Description
- content
The Text of the Paragraph
- get_type() → Literal['paragraph', 'unordered-list', 'ordered-list']
Retutns the Type of the Item
- Return type:
Literal[‘paragraph’, ‘unordered-list’, ‘ordered-list’]
- load_tags(tag_list: list[_Element]) → None
Loads teh XML tags into the Elemnt. Only for internal use.
- Parameters:
tag_list (list[_Element])
- Return type:
None
- get_tags(parent_tag: _Element) → None
Get the XML Tag from the Element. Only for internal use.
- Parameters:
parent_tag (_Element)
- Return type:
None
- get_translated_tag(lang: str | None) → _Element
Loads the tag for a given language
- Parameters:
lang (str | None)
- Return type:
_Element
- to_plain_text(lang: str | None = None) → str
Returns the content as plain text
- Parameters:
lang (str | None)
- Return type:
str
- class appstream_python.Shared.DescriptionList(list_type: str)
Represents a list <ul>/<ol> in the Description
- Parameters:
list_type (str)
- content: TranslateableList
The list
- get_type() → Literal['paragraph', 'unordered-list', 'ordered-list']
Returns the Type of the Item
- Return type:
Literal[‘paragraph’, ‘unordered-list’, ‘ordered-list’]
- load_tags(tag_list: _Element | list[_Element]) → None
Loads the XML tags into the Elemnt. Only for internal use.
- Parameters:
tag_list (_Element | list[_Element])
- Return type:
None
- get_tags(parent_tag: _Element) → None
Get the XML Tag from the Element. Only for internal use.
- Parameters:
parent_tag (_Element)
- Return type:
None
- get_translated_tag(lang: str | None = None) → _Element
Loads the tag for a given language
- Parameters:
lang (str | None)
- Return type:
_Element
- to_plain_text(lang: str | None = None) → str
Returns the content as plain text
- Parameters:
lang (str | None)
- Return type:
str
- class appstream_python.Shared.Description
Represents a <description> tag
- items: list[DescriptionItem]
All Description Items
- load_tags(tag: _Element) → None
Load a XML tag. Onyl for internal use.
- Parameters:
tag (_Element)
- Return type:
None
- get_tags(parent_tag: _Element) → None
Writes a Description tag. Only for internal use.
- Parameters:
parent_tag (_Element)
- Return type:
None
- to_html(lang: str | None = None) → str
Get the HTML code of the description in the given language
- Parameters:
lang (str | None)
- Return type:
str
- to_plain_text(lang: str | None = None) → str
Converts the Description into Plain Text
- Parameters:
lang (str | None) – The language
- Returns:
The Description
- Return type:
str