:right-sidebar: True Language =================================================================== .. currentmodule:: gi.repository.GtkSource .. class:: Language(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` Represents a syntax highlighted language. A ``GtkSourceLanguage`` represents a programming or markup language, affecting syntax highlighting and `context classes <./class.Buffer.html#context-classes>`__\. Use :obj:`~gi.repository.GtkSource.LanguageManager` to obtain a ``GtkSourceLanguage`` instance, and :obj:`~gi.repository.Buffer.set_language` to apply it to a :obj:`~gi.repository.GtkSource.Buffer`\. Methods ------- .. rst-class:: interim-class .. class:: Language :no-index: .. method:: get_globs() -> list[str] | None Returns the globs associated to this language. This is just an utility wrapper around :obj:`~gi.repository.Language.get_metadata` to retrieve the "globs" metadata property and split it into an array. .. method:: get_hidden() -> bool Returns whether the language should be hidden from the user. .. method:: get_id() -> str Returns the ID of the language. The ID is not locale-dependent.The returned string is owned by ``language`` and should not be freed or modified. .. method:: get_metadata(name: str) -> str | None :param name: metadata property name. .. method:: get_mime_types() -> list[str] | None Returns the mime types associated to this language. This is just an utility wrapper around :obj:`~gi.repository.Language.get_metadata` to retrieve the "mimetypes" metadata property and split it into an array. .. method:: get_name() -> str Returns the localized name of the language. The returned string is owned by ``language`` and should not be freed or modified. .. method:: get_section() -> str Returns the localized section of the language. Each language belong to a section (ex. HTML belongs to the Markup section). The returned string is owned by ``language`` and should not be freed or modified. .. method:: get_style_fallback(style_id: str) -> str | None Returns the ID of the style to use if the specified ``style_id`` is not present in the current style scheme. :param style_id: a style ID. .. method:: get_style_ids() -> list[str] | None Returns the ids of the styles defined by this ``language``\. .. method:: get_style_name(style_id: str) -> str | None Returns the name of the style with ID ``style_id`` defined by this ``language``\. :param style_id: a style ID. Properties ---------- .. rst-class:: interim-class .. class:: Language :no-index: .. attribute:: props.hidden :type: bool The type of the None singleton. .. attribute:: props.id :type: str The type of the None singleton. .. attribute:: props.name :type: str The type of the None singleton. .. attribute:: props.section :type: str The type of the None singleton.