## GspellLanguageChooser

GspellLanguageChooser — Interface to choose a GspellLanguage

## Functions

const GspellLanguage * | gspell_language_chooser_get_language ()
void | gspell_language_chooser_set_language ()
const gchar * | gspell_language_chooser_get_language_code ()
void | gspell_language_chooser_set_language_code ()

## Properties

GspellLanguage * | language | Read / Write
char * | language-code | Read / Write

## Types and Values

| GspellLanguageChooser

## Object Hierarchy

        GInterface
        ╰── GspellLanguageChooser

## Prerequisites

GspellLanguageChooser requires GObject.

## Known Implementations

GspellLanguageChooser is implemented by GspellLanguageChooserButton and GspellLanguageChooserDialog.

## Includes

    #include <gspell/gspell.h>

## Description

GspellLanguageChooser is an interface that is implemented by widgets for choosing a GspellLanguage.

There are two properties: “language” and “language-code”. They are kept in sync. The former is useful, for example, to bind it to the GspellChecker's language property with `g_object_bind_property()`. The latter is useful to bind it to a GSettings key with `g_settings_bind()`.

When setting the language, `NULL` or the empty string can be passed to pick the default language. In that case, the “language-code” property will contain the empty string, whereas the “language” property will contain the actual GspellLanguage as returned by `gspell_language_get_default()`. If the user launches the GspellLanguageChooser and chooses explicitly a language, then the “language-code” property will no longer be empty, even if it is the same language as the default language.

Note that if an explicit language (non-`NULL` or not the empty string) is set to the GspellLanguageChooser, then the “language-code” property will not be empty, it will contain the language code of the passed language, even if the language is the same as the default language.

Thus, a good default value for a GSettings key is the empty string. That way, the default language is picked, and can change depending on the locale. But once the user has chosen a language, that language is kept in the GSettings key.

## Functions

### gspell_language_chooser_get_language ()

    const GspellLanguage *
    gspell_language_chooser_get_language (GspellLanguageChooser *chooser);

#### Parameters

chooser | a GspellLanguageChooser. |

#### Returns

the selected GspellLanguage, or `NULL` if no dictionaries are available.

[nullable]

### gspell_language_chooser_set_language ()

    void
    gspell_language_chooser_set_language (GspellLanguageChooser *chooser,
                                          const GspellLanguage *language);

Sets the selected language.

#### Parameters

chooser | a GspellLanguageChooser. |
language | a GspellLanguage or `NULL` to pick the default language. | [nullable]

### gspell_language_chooser_get_language_code ()

    const gchar *
    gspell_language_chooser_get_language_code
                                   (GspellLanguageChooser *chooser);

#### Parameters

chooser | a GspellLanguageChooser. |

#### Returns

the “language-code”. It cannot be `NULL`.

### gspell_language_chooser_set_language_code ()

    void
    gspell_language_chooser_set_language_code
                                   (GspellLanguageChooser *chooser,
                                    const gchar *language_code);

#### Parameters

chooser | a GspellLanguageChooser. |
language_code | a language code, or the empty string or `NULL` to pick the default language. | [nullable]

## Types and Values

### GspellLanguageChooser

    typedef struct _GspellLanguageChooser GspellLanguageChooser;

## Property Details

### The `“language”` property

      “language”                 GspellLanguage *

The selected GspellLanguage.

Owner: GspellLanguageChooser

Flags: Read / Write

### The `“language-code”` property

      “language-code”            char *

The empty string if the default language was set and the selection hasn't changed. Or the language code if an explicit language was set or if the selection has changed.

Owner: GspellLanguageChooser

Flags: Read / Write

Default value: ""

## See Also

GspellLanguage, GspellLanguageChooserButton, GspellLanguageChooserDialog