Language Data

1.4.0 · active · verified Thu Apr 09

language-data is a Python library that provides supplementary data about languages, primarily intended to be consumed by the `langcodes` module. It bundles data from the Unicode Common Locale Data Repository (CLDR). The current version is 1.4.0. Releases are irregular, often coinciding with updates to the CLDR specification, typically one to two times per year.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how the `langcodes` library, after `language-data` is installed, automatically leverages its language data. Users typically interact with `language-data` indirectly through `langcodes`, which processes and presents the data.

# language-data is a data dependency for langcodes.
# After installing both 'langcodes' and 'language-data',
# langcodes will automatically utilize the data provided by language-data.

import langcodes

# Example: Get a Language object from langcodes
english_us = langcodes.Language.get('en-US')
print(f"Code: {english_us}")
print(f"English Name: {english_us.display_name('en')}")

# Example: Work with a less common language code
nl_be = langcodes.Language.get('nl-BE')
print(f"\nCode: {nl_be}")
print(f"French Name: {nl_be.display_name('fr')}")
print(f"Dutch Name: {nl_be.display_name('nl')}")

# The functionality of langcodes, such as display_name, depends on the data
# provided by the language-data package. If language-data were not installed
# or was an older version, langcodes might fall back to less detailed data
# or an internal, potentially outdated dataset.

view raw JSON →