## ISO-639 lang mappings

ISO-639 lang mappings — mappings for ISO-639 language codes and names

## Functions

gchar ** | gst_tag_get_language_codes ()
const gchar * | gst_tag_get_language_name ()
#define | gst_tag_get_language_code ()
const gchar * | gst_tag_get_language_code_iso_639_1 ()
const gchar * | gst_tag_get_language_code_iso_639_2B ()
const gchar * | gst_tag_get_language_code_iso_639_2T ()
gboolean | gst_tag_check_language_code ()

## Includes

    #include <gst/tag/tag.h>

## Description

Provides helper functions to convert between the various ISO-639 language codes, and to map language codes to language names.

## Functions

### gst_tag_get_language_codes ()

    gchar **
    gst_tag_get_language_codes (void);

Returns a list of known language codes (in form of two-letter ISO-639-1 codes). This is useful for UIs to build a list of available languages for tagging purposes (e.g. to tag an audio track appropriately in a video or audio editor).

#### Returns

NULL-terminated string array with two-letter language codes. Free with `g_strfreev()` when no longer needed.

[transfer full]

### gst_tag_get_language_name ()

    const gchar *
    gst_tag_get_language_name (const gchar *language_code);

Returns the name of the language given an ISO-639 language code as found in a GST_TAG_LANGUAGE_CODE tag. The name will be translated according to the current locale (if the library was built against the iso-codes package, otherwise the English name will be returned).

Language codes are case-sensitive and expected to be lower case.

#### Parameters

language_code | two or three-letter ISO-639 language code |

#### Returns

language name in UTF-8 format, or NULL if `language_code` could not be mapped to a language name. The returned string must not be modified and does not need to freed; it will stay valid until the application is terminated.

### gst_tag_get_language_code()

    #define             gst_tag_get_language_code(lang_code)

Convenience macro wrapping `gst_tag_get_language_code_iso_639_1()`.

#### Parameters

lang_code | ISO-639 language code (e.g. "deu" or "ger" or "de") |

### gst_tag_get_language_code_iso_639_1 ()

    const gchar *
    gst_tag_get_language_code_iso_639_1 (const gchar *lang_code);

Returns two-letter ISO-639-1 language code given a three-letter ISO-639-2 language code or two-letter ISO-639-1 language code (both are accepted for convenience).

Language codes are case-sensitive and expected to be lower case.

#### Parameters

lang_code | ISO-639 language code (e.g. "deu" or "ger" or "de") |

#### Returns

two-letter ISO-639-1 language code string that maps to `lang_code` , or NULL if no mapping is known. The returned string must not be modified or freed.

### gst_tag_get_language_code_iso_639_2B ()

    const gchar *
    gst_tag_get_language_code_iso_639_2B (const gchar *lang_code);

Returns three-letter ISO-639-2 "bibliographic" language code given a two-letter ISO-639-1 language code or a three-letter ISO-639-2 language code (both are accepted for convenience).

The "bibliographic" code is derived from the English name of the language (e.g. "ger" for German instead of "de" or "deu"). In most scenarios, the "terminological" codes are prefered.

Language codes are case-sensitive and expected to be lower case.

#### Parameters

lang_code | ISO-639 language code (e.g. "deu" or "ger" or "de") |

#### Returns

three-letter ISO-639-2 language code string that maps to `lang_code` , or NULL if no mapping is known. The returned string must not be modified or freed.

### gst_tag_get_language_code_iso_639_2T ()

    const gchar *
    gst_tag_get_language_code_iso_639_2T (const gchar *lang_code);

Returns three-letter ISO-639-2 "terminological" language code given a two-letter ISO-639-1 language code or a three-letter ISO-639-2 language code (both are accepted for convenience).

The "terminological" code is derived from the local name of the language (e.g. "deu" for German instead of "ger"). In most scenarios, the "terminological" codes are prefered over the "bibliographic" ones.

Language codes are case-sensitive and expected to be lower case.

#### Parameters

lang_code | ISO-639 language code (e.g. "deu" or "ger" or "de") |

#### Returns

three-letter ISO-639-2 language code string that maps to `lang_code` , or NULL if no mapping is known. The returned string must not be modified or freed.

### gst_tag_check_language_code ()

    gboolean
    gst_tag_check_language_code (const gchar *lang_code);

Check if a given string contains a known ISO 639 language code.

This is useful in situations where it's not clear whether a given string is a language code (which should be put into a GST_TAG_LANGUAGE_CODE tag) or a free-form language name descriptor (which should be put into a GST_TAG_LANGUAGE_NAME tag instead).

#### Parameters

lang_code | ISO-639 language code (e.g. "deu" or "ger" or "de") |

#### Returns

TRUE if the two- or three-letter language code in `lang_code` is a valid ISO-639 language code.

## Types and Values

## See Also

GstTagList