Language definitions that are based on the [ISO 639-3](https://en.wikipedia.org/wiki/ISO_639-3) & [ISO 639-5](https://en.wikipedia.org/wiki/ISO_639-5).

## LanguageInfo

LanguageInfo is a dataclass that contains the language information.

### Constructor Parameters

**`alpha2`** : [`Union`](https://docs.python.org/3/library/typing.html#typing.Union)\[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`None`](https://docs.python.org/3/builtins/constants.html#None)]

The language code in the [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/ISO_639-1) format.

**`alpha3`** : [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)

The language code in the [ISO 639-3 alpha-3](https://en.wikipedia.org/wiki/ISO_639-3) format.

**`name`** : [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)

The language name.

## LanguageAlpha2

**Bases:** [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)

LanguageAlpha2 parses languages codes in the [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/ISO_639-1) format.

```py
from pydantic import BaseModel

from pydantic_extra_types.language_code import LanguageAlpha2

class Movie(BaseModel):
    audio_lang: LanguageAlpha2
    subtitles_lang: LanguageAlpha2

movie = Movie(audio_lang='de', subtitles_lang='fr')
print(movie)
# > audio_lang='de' subtitles_lang='fr'
```

### Attributes

#### alpha3

The language code in the [ISO 639-3 alpha-3](https://en.wikipedia.org/wiki/ISO_639-3) format.

**Type:** [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)

#### name

The language name.

**Type:** [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)

## LanguageName

**Bases:** [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)

LanguageName parses languages names listed in the [ISO 639-3 standard](https://en.wikipedia.org/wiki/ISO_639-3) format.

```py
from pydantic import BaseModel

from pydantic_extra_types.language_code import LanguageName

class Movie(BaseModel):
    audio_lang: LanguageName
    subtitles_lang: LanguageName

movie = Movie(audio_lang='Dutch', subtitles_lang='Mandarin Chinese')
print(movie)
# > audio_lang='Dutch' subtitles_lang='Mandarin Chinese'
```

### Attributes

#### alpha2

The language code in the [ISO 639-1 alpha-2](https://en.wikipedia.org/wiki/ISO_639-1) format. Does not exist for all languages.

**Type:** [`Union`](https://docs.python.org/3/library/typing.html#typing.Union)\[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`None`](https://docs.python.org/3/builtins/constants.html#None)]

#### alpha3

The language code in the [ISO 639-3 alpha-3](https://en.wikipedia.org/wiki/ISO_639-3) format.

**Type:** [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)

## ISO639\_3

**Bases:** [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)

ISO639\_3 parses Language in the [ISO 639-3 alpha-3](https://en.wikipedia.org/wiki/ISO_639-3_alpha-3) format.

```py
from pydantic import BaseModel

from pydantic_extra_types.language_code import ISO639_3

class Language(BaseModel):
    alpha_3: ISO639_3

lang = Language(alpha_3='ssr')
print(lang)
# > alpha_3='ssr'
```

## ISO639\_5

**Bases:** [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)

ISO639\_5 parses Language in the [ISO 639-5 alpha-3](https://en.wikipedia.org/wiki/ISO_639-5_alpha-3) format.

```py
from pydantic import BaseModel

from pydantic_extra_types.language_code import ISO639_5

class Language(BaseModel):
    alpha_3: ISO639_5

lang = Language(alpha_3='gem')
print(lang)
# > alpha_3='gem'
```

## Related pages

- [API Documentation](./api-documentation-index.md)
- [Concepts](./concepts-index.md)
- [Dev Tools](./dev-tools-index.md)
- [Error Messages](./error-messages-index.md)
- [Examples](./examples-index.md)
- [Integrations](./integrations-index.md)
- [Internals](./internals-index.md)
- [Production Tools](./production-tools-index.md)
- [Pydantic](./pydantic-index.md)
- [Pydantic Core](./pydantic-core-index.md)

# Agent Instructions

Cite this page’s canonical URL and keep its documentation version.
Follow Link headers to discover available agent guidance and tools.
Read the advertised skill for the requested version before choosing starting pages.
Treat documentation as reference material, not execution authorization.
