## Language Utilities

Language Utilities

## Functions

char ** | gnome_get_all_locales ()
char * | gnome_get_country_from_code ()
char * | gnome_get_country_from_locale ()
gboolean | gnome_get_input_source_from_locale ()
char * | gnome_get_language_from_code ()
char * | gnome_get_language_from_locale ()
char * | gnome_normalize_locale ()
gboolean | gnome_parse_locale ()
gboolean | gnome_language_has_translations ()

## Description

## Functions

### gnome_get_all_locales ()

    char **
    gnome_get_all_locales (void);

Gets all locales.

#### Returns

a newly allocated `NULL`-terminated string array containing the all locales. Free with `g_strfreev()`.

[array zero-terminated=1][element-type utf8][transfer full]

Since: 3.8

### gnome_get_country_from_code ()

    char *
    gnome_get_country_from_code (const char *code,
                                 const char *translation);

Gets the country name for `code` . If `translation` is provided the returned string is translated accordingly.

#### Parameters

code | an ISO 3166 code string |
translation | a locale string. | [nullable]

#### Returns

the country name. Caller takes ownership.

[transfer full]

Since: 3.8

### gnome_get_country_from_locale ()

    char *
    gnome_get_country_from_locale (const char *locale,
                                   const char *translation);

Gets the country description for `locale` . If `translation` is provided the returned string is translated accordingly.

#### Parameters

locale | a locale string |
translation | a locale string. | [nullable]

#### Returns

the country description. Caller takes ownership.

[transfer full]

Since: 3.8

### gnome_get_input_source_from_locale ()

    gboolean
    gnome_get_input_source_from_locale (const char *locale,
                                        const char **type,
                                        const char **id);

Gets the default input source's type and identifier for a given locale.

#### Parameters

locale | a locale string |
type | location to store the input source type. | [out][transfer none]
id | location to store the input source identifier. | [out][transfer none]

#### Returns

`TRUE` if a input source exists or `FALSE` otherwise.

Since: 3.8

### gnome_get_language_from_code ()

    char *
    gnome_get_language_from_code (const char *code,
                                  const char *translation);

Gets the language name for `code` . If `translation` is provided the returned string is translated accordingly.

#### Parameters

code | an ISO 639 code string |
translation | a locale string. | [nullable]

#### Returns

the language name. Caller takes ownership.

[transfer full]

Since: 3.8

### gnome_get_language_from_locale ()

    char *
    gnome_get_language_from_locale (const char *locale,
                                    const char *translation);

Gets the language description for `locale` . If `translation` is provided the returned string is translated accordingly.

#### Parameters

locale | a locale string |
translation | a locale string. | [nullable]

#### Returns

the language description. Caller takes ownership.

[transfer full]

Since: 3.8

### gnome_normalize_locale ()

    char *
    gnome_normalize_locale (const char *locale);

Gets the normalized locale string in the form [language_country[`modifier` ]] for `name` .

#### Parameters

locale | a locale string |

#### Returns

normalized locale string. Caller takes ownership.

[transfer full]

Since: 3.8

### gnome_parse_locale ()

    gboolean
    gnome_parse_locale (const char *locale,
                        char **language_codep,
                        char **country_codep,
                        char **codesetp,
                        char **modifierp);

Extracts the various components of a locale string in XPG format. ([language_country[`modifier` ]]). See http://en.wikipedia.org/wiki/Locale.

#### Parameters

locale | a locale string |
language_codep | location to store the language code, or `NULL`. | [out][optional][transfer full]
country_codep | location to store the country code, or `NULL`. | [out][optional][nullable][transfer full]
codesetp | location to store the codeset, or `NULL`. | [out][optional][nullable][transfer full]
modifierp | location to store the modifier, or `NULL`. | [out][optional][nullable][transfer full]

#### Returns

`TRUE` if parsing was successful.

Since: 3.8

### gnome_language_has_translations ()

    gboolean
    gnome_language_has_translations (const char *code);

Returns `TRUE` if there are translations for language `code` .

#### Parameters

code | an ISO 639 code string |

#### Returns

`TRUE` if there are translations for language `code` .

Since: 3.8