--- id: langcodes version: "3.5.1" license: unclear license_treatment: permissive maintenance: active --- # langcodes — Tools for labeling human languages with IETF language tags License: permissive · Maintenance: active · Downloads: 12.5M/mo ## What it is and what it does Langcodes is a library for working with IETF language tags (standardized codes like 'en' for English, 'es' for Spanish, 'zh-Hans-CN' for Simplified Chinese in China). It implements BCP 47, the standard that subsumes ISO 639 and handles language variations, scripts, territories, and deprecated codes. The library solves the problem of language code equivalence: it knows that 'eng' and 'en' refer to the same language, that 'en-UK' is a misspelling that should map to 'en-GB', and that redundant script tags like 'en-Latn' can be shortened to 'en'. The package provides two main interfaces: a `standardize_tag()` function that converts any language tag to its canonical BCP 47 form, and a `Language` class that parses tags into structured components (language, script, territory, variants, extensions, and private use codes). It validates tags against the IANA subtag registry, replacing deprecated values and handling complex substitutions like converting Serbo-Croatian to Serbian in Latin script. With no runtime dependencies and active maintenance, it's a lightweight tool for any application that needs to normalize or validate language identifiers. Use it for: - Normalize user-provided language preferences in web applications or APIs to canonical BCP 47 format for consistent storage and comparison. - Validate and correct language codes in multilingual content systems, replacing deprecated or misspelled codes with their modern equivalents. - Parse language tags to extract components (language, script, territory) for conditional logic in localization or content delivery pipelines. - Detect and handle language equivalences, such as treating 'zh-CN' and 'zh-Hans' interchangeably in Chinese text processing systems. - Build language selection dropdowns or autocomplete that accepts multiple input formats and normalizes them to standard codes. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Parses, validates, and standardizes IETF language tags (BCP 47 format), converting between different representations of the same language and resolving deprecated or non-standard codes. Yes. Langcodes is a stable, actively maintained library with no dependencies, permissive licensing, and strong popularity (top 5000 on PyPI). Install it if you work with language codes, multilingual systems, or need to normalize IETF language tags. The only minor consideration is whether you also need the optional language_data supplement for localized language names. ## Install pip install langcodes uv add langcodes poetry add langcodes ## Installing langcodes Before you install: Installs with no runtime dependencies and low friction. Active maintenance with a recent release (2025-12-02) and last commit on 2026-07-20. Supports current Python versions (3.9 through 3.13). License in practice: Released under the MIT license (permissive), allowing free use, modification, and distribution with minimal restrictions. Quickstart: pip install langcodes from langcodes import standardize_tag, Language # Standardize a tag print(standardize_tag('eng_US')) # 'en-US' # Parse and inspect a language lang = Language.get('en-Latn-US') print(lang.language, lang.script, lang.territory) Requires Python 3.9 or later. Verify before relying: - Whether the optional language_data supplement (mentioned in description) is required for full functionality or only for localized language names. - Performance characteristics when processing large volumes of language tags. ## Package facts - License: not declared (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 12.5M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags language code parsing, IETF language tags, BCP 47 standardization, language tag normalization, ISO 639 language codes, language code validation, multilingual language identification, language-processing, internationalization, standards-compliant [View on SkillFed](https://skillfed.io/packages/langcodes) · [View on PyPI](https://pypi.org/project/langcodes/)