{"id":3535,"library":"language-tags","title":"Language Tags","description":"This project is a Python version of the language-tags Javascript project. It provides an API to validate and lookup language tags based on BCP 47 (RFC 5646) and the latest IANA language subtag registry. It is actively maintained, with updates released as the underlying standards change.","status":"active","version":"1.2.0","language":"en","source_language":"en","source_url":"https://github.com/OnroerendErfgoed/language-tags","tags":["language","i18n","locale","bcp47","iana","tag","validation"],"install":[{"cmd":"pip install language-tags","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"note":"The primary class for parsing and validating language tags from the `language_tags` module.","symbol":"Tag","correct":"from language_tags import Tag"}],"quickstart":{"code":"from language_tags import Tag\n\n# Create a Tag object from a BCP 47 string\ntag = Tag('en-US')\n\n# Check if the tag is valid according to the IANA registry\nprint(f\"'{tag}' is valid: {tag.is_valid()}\")\n\n# Access components of the tag\nprint(f\"Language: {tag.language()}\")\nprint(f\"Region: {tag.region()}\")\n\n# Script might be None if not explicitly present or suppressed\nprint(f\"Script: {tag.script()}\")\nprint(f\"Description: {tag.description()}\")\n\n# Example of an invalid tag\ninvalid_tag = Tag('xx-YYY')\nprint(f\"\\n'{invalid_tag}' is valid: {invalid_tag.is_valid()}\")\n","lang":"python","description":"Initializes a Tag object from a BCP 47 string, checks its validity, and demonstrates how to access its primary language, region, script, and human-readable description components."},"warnings":[{"fix":"Upgrade your project to Python 3 or pin the `language-tags` library version to 0.5.0 or earlier.","message":"Python 2 support was dropped in version 1.0.0. For Python 2 compatibility, you must use version 0.5.0 or earlier.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Ensure your Python environment is version 3.10, 3.11, or 3.12. Update your Python installation if necessary.","message":"Support for Python versions 3.6 and 3.7 was dropped in version 1.2.0. The library now explicitly requires Python >=3.10, <3.13.","severity":"breaking","affected_versions":">=1.2.0"},{"fix":"Always use the latest stable version of `language-tags` to ensure you are working with the most current IANA language subtag registry data.","message":"Older versions of the library may contain outdated IANA language subtag registry data, which can lead to incorrect validation or lookup results for new or changed language tags. Compliance with BCP 47 depends on up-to-date data.","severity":"gotcha","affected_versions":"<1.2.0 (relative to current registry)"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}