## GtkSourceLanguage

GtkSourceLanguage — Represents a syntax highlighted language

## Functions

const gchar * | gtk_source_language_get_id ()
const gchar * | gtk_source_language_get_name ()
const gchar * | gtk_source_language_get_section ()
gboolean | gtk_source_language_get_hidden ()
const gchar * | gtk_source_language_get_metadata ()
gchar ** | gtk_source_language_get_mime_types ()
gchar ** | gtk_source_language_get_globs ()
const gchar * | gtk_source_language_get_style_name ()
gchar ** | gtk_source_language_get_style_ids ()
const gchar * | gtk_source_language_get_style_fallback ()

## Properties

gboolean | hidden | Read
gchar * | id | Read
gchar * | name | Read
gchar * | section | Read

## Types and Values

| GtkSourceLanguage

## Object Hierarchy

        GObject
        ╰── GtkSourceLanguage

## Includes

    #include <gtksourceview/gtksource.h>

## Description

GtkSourceLanguage encapsulates syntax and highlighting styles for a particular language. Use GtkSourceLanguageManager to obtain a GtkSourceLanguage instance, and `gtk_source_buffer_set_language()` to apply it to a GtkSourceBuffer.

## Functions

### gtk_source_language_get_id ()

    const gchar *
    gtk_source_language_get_id (GtkSourceLanguage *language);

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.

#### Parameters

language | a GtkSourceLanguage. |

#### Returns

the ID of `language` .

### gtk_source_language_get_name ()

    const gchar *
    gtk_source_language_get_name (GtkSourceLanguage *language);

Returns the localized name of the language. The returned string is owned by `language` and should not be freed or modified.

#### Parameters

language | a GtkSourceLanguage. |

#### Returns

the name of `language` .

### gtk_source_language_get_section ()

    const gchar *
    gtk_source_language_get_section (GtkSourceLanguage *language);

Returns the localized section of the language. Each language belong to a section (ex. HTML belogs to the Markup section). The returned string is owned by `language` and should not be freed or modified.

#### Parameters

language | a GtkSourceLanguage. |

#### Returns

the section of `language` .

### gtk_source_language_get_hidden ()

    gboolean
    gtk_source_language_get_hidden (GtkSourceLanguage *language);

Returns whether the language should be hidden from the user.

#### Parameters

language | a GtkSourceLanguage |

#### Returns

`TRUE` if the language should be hidden, `FALSE` otherwise.

### gtk_source_language_get_metadata ()

    const gchar *
    gtk_source_language_get_metadata (GtkSourceLanguage *language,
                                      const gchar *name);

#### Parameters

language | a GtkSourceLanguage. |
name | metadata property name. |

#### Returns

value of property `name` stored in the metadata of `language` or `NULL` if language does not contain the specified metadata property. The returned string is owned by `language` and should not be freed or modified.

[nullable][transfer none]

### gtk_source_language_get_mime_types ()

    gchar **
    gtk_source_language_get_mime_types (GtkSourceLanguage *language);

Returns the mime types associated to this language. This is just an utility wrapper around `gtk_source_language_get_metadata()` to retrieve the "mimetypes" metadata property and split it into an array.

#### Parameters

language | a GtkSourceLanguage. |

#### Returns

a newly-allocated `NULL` terminated array containing the mime types or `NULL` if no mime types are found. The returned array must be freed with `g_strfreev()`.

[nullable][array zero-terminated=1][transfer full]

### gtk_source_language_get_globs ()

    gchar **
    gtk_source_language_get_globs (GtkSourceLanguage *language);

Returns the globs associated to this language. This is just an utility wrapper around `gtk_source_language_get_metadata()` to retrieve the "globs" metadata property and split it into an array.

#### Parameters

language | a GtkSourceLanguage. |

#### Returns

a newly-allocated `NULL` terminated array containing the globs or `NULL` if no globs are found. The returned array must be freed with `g_strfreev()`.

[nullable][array zero-terminated=1][transfer full]

### gtk_source_language_get_style_name ()

    const gchar *
    gtk_source_language_get_style_name (GtkSourceLanguage *language,
                                        const gchar *style_id);

Returns the name of the style with ID `style_id` defined by this `language` .

#### Parameters

language | a GtkSourceLanguage. |
style_id | a style ID. |

#### Returns

the name of the style with ID `style_id` defined by this `language` or `NULL` if the style has no name or there is no style with ID `style_id` defined by this `language` . The returned string is owned by the `language` and must not be modified.

[nullable][transfer none]

### gtk_source_language_get_style_ids ()

    gchar **
    gtk_source_language_get_style_ids (GtkSourceLanguage *language);

Returns the ids of the styles defined by this `language` .

#### Parameters

language | a GtkSourceLanguage. |

#### Returns

a newly-allocated `NULL` terminated array containing ids of the styles defined by this `language` or `NULL` if no style is defined. The returned array must be freed with `g_strfreev()`.

[nullable][array zero-terminated=1][transfer full]

### gtk_source_language_get_style_fallback ()

    const gchar *
    gtk_source_language_get_style_fallback
                                   (GtkSourceLanguage *language,
                                    const gchar *style_id);

Returns the ID of the style to use if the specified `style_id` is not present in the current style scheme.

#### Parameters

language | a GtkSourceLanguage. |
style_id | a style ID. |

#### Returns

the ID of the style to use if the specified `style_id` is not present in the current style scheme or `NULL` if the style has no fallback defined. The returned string is owned by the `language` and must not be modified.

[nullable][transfer none]

Since: 3.4

## Types and Values

### GtkSourceLanguage

    typedef struct _GtkSourceLanguage GtkSourceLanguage;

## Property Details

### The `“hidden”` property

      “hidden”                   gboolean

Whether the language should be hidden from the user.

Flags: Read

Default value: FALSE

### The `“id”` property

      “id”                       gchar *

Language id.

Flags: Read

Default value: NULL

### The `“name”` property

      “name”                     gchar *

Language name.

Flags: Read

Default value: NULL

### The `“section”` property

      “section”                  gchar *

Language section.

Flags: Read

Default value: NULL

## See Also

GtkSourceLanguageManager