{"id":22977,"library":"weblate-language-data","title":"Weblate Language Data","description":"Provides language definitions (names, plurals, country info) used by Weblate. Version 2026.7 requires Python >=3.11. Released on a monthly cadence alongside Weblate releases.","status":"active","version":"2026.7","language":"python","source_language":"en","source_url":"https://github.com/WeblateOrg/language-data","tags":["weblate","language-data","translations","plural-forms","localization"],"install":[{"cmd":"pip install weblate-language-data","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"This package is a flat namespace, not part of the `weblate` package.","wrong":"from weblate.language_data import COUNTRIES","symbol":"COUNTRIES","correct":"from weblate_language_data import COUNTRIES"},{"note":"","wrong":"","symbol":"PLURAL_REPRESENTATIVES","correct":"from weblate_language_data import PLURAL_REPRESENTATIVES"},{"note":"","wrong":"","symbol":"LANGUAGES","correct":"from weblate_language_data import LANGUAGES"}],"quickstart":{"code":"from weblate_language_data import COUNTRIES, LANGUAGES, PLURAL_REPRESENTATIVES\n\n# List all languages\nfor code, name in LANGUAGES.items():\n    print(f\"{code}: {name}\")\n\n# Get country name for a country code\nprint(COUNTRIES.get('cz', 'Czechia'))\n\n# Get plural forms for a language\nprint(PLURAL_REPRESENTATIVES.get('cs', 'nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 ? 1 : 2);'))\n","lang":"python","description":"Import and use the language data constants."},"warnings":[{"fix":"Upgrade Python to 3.11+ or pin to an older version (e.g., weblate-language-data==2025.12).","message":"Python 3.11 minimum required starting from version 2026.7. Older Python versions will get ImportError or install failure.","severity":"breaking","affected_versions":">=2026.7"},{"fix":"Use `from weblate_language_data import ...`","message":"The package name uses hyphens on PyPI (weblate-language-data), but the import uses underscores (weblate_language_data). Common mistake: try to import weblate.language_data.","severity":"gotcha","affected_versions":"all"},{"fix":"Check the exact key format in the source data.","message":"LANGUAGES dict keys are language codes (e.g., 'cs_CZ') not just 'cs'. Use PLURAL_REPRESENTATIVES for plural forms with language-only codes.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Install and import from the separate package: `pip install weblate-language-data` then `from weblate_language_data import COUNTRIES`.","cause":"Trying to import from `weblate.language_data` assuming it's part of the main Weblate package.","error":"ModuleNotFoundError: No module named 'weblate'"},{"fix":"Use `from weblate_language_data import LANGUAGES`","cause":"Typo: the correct constant is `LANGUAGES` (plural).","error":"AttributeError: module 'weblate_language_data' has no attribute 'LANGUAGE' (or similar)"},{"fix":"Run `python -c \"import weblate_language_data; print(dir(weblate_language_data))\"` to list available exports.","cause":"The constant may have been renamed in a newer version. Check the source for available symbols.","error":"ImportError: cannot import name 'COUNTRIES' from 'weblate_language_data'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}