{"id":4072,"library":"l18n","title":"l18n: Internationalization for pytz timezones and territories","description":"l18n is a Python library providing internationalization (i18n) and localization (l10n) services specifically for `pytz` timezones and territory names. It offers lazy translations for names used for localization purposes, such as cities and full timezone names, by fetching them from the CLDR (Unicode's Common Locale Data Repository) database. The latest version, 2021.3, was released in November 2021. Its versioning strategy aims to align with `pytz` releases to ensure consistency with timezone names.","status":"maintenance","version":"2021.3","language":"en","source_language":"en","source_url":"https://github.com/tkhyn/l18n","tags":["internationalization","localization","i18n","l10n","timezones","pytz","CLDR"],"install":[{"cmd":"pip install l18n","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Core functionality relies on pytz for timezone data and names to translate.","package":"pytz","optional":false}],"imports":[{"symbol":"l18n","correct":"import l18n"},{"note":"A read-only dictionary-like object mapping pytz timezones to human-friendly translated city names.","symbol":"tz_cities","correct":"l18n.tz_cities"},{"note":"A read-only dictionary-like object mapping pytz timezones to human-friendly translated full timezone names.","symbol":"tz_fullnames","correct":"l18n.tz_fullnames"},{"note":"Sets the active language for translations. Default is 'en'.","symbol":"set_language","correct":"l18n.set_language('fr')"}],"quickstart":{"code":"import l18n\nimport os\n\n# Set the language to French (for demonstration)\nl18n.set_language('fr')\n\n# Get translated city name for a timezone\neaster_island_city_fr = l18n.tz_cities['Pacific/Easter']\nprint(f\"Easter Island (French): {easter_island_city_fr}\")\n\n# Switch to English\nl18n.set_language('en')\n\neaster_island_city_en = l18n.tz_cities['Pacific/Easter']\nprint(f\"Easter Island (English): {easter_island_city_en}\")\n\n# Get full translated timezone name\nlondon_timezone_en = l18n.tz_fullnames['Europe/London']\nprint(f\"London timezone (English): {london_timezone_en}\")\n\nl18n.set_language('de')\nlondon_timezone_de = l18n.tz_fullnames['Europe/London']\nprint(f\"London timezone (German): {london_timezone_de}\")","lang":"python","description":"This quickstart demonstrates how to import `l18n`, set the desired language, and retrieve translated city and full timezone names using the `tz_cities` and `tz_fullnames` mappings."},"warnings":[{"fix":"Test thoroughly with your target Python and `pytz` versions. Consider contributing updates or forking if you encounter compatibility issues with newer environments.","message":"The library's last release (2021.3) was in November 2021. While it declared compatibility with Python 2.7 and Python 3.5+ at the time of release, compatibility with modern Python versions (3.10+) or very recent `pytz` versions has not been explicitly confirmed or updated. Python 3.9 reached End-of-Life in October 2025.","severity":"gotcha","affected_versions":"2021.3 and older"},{"fix":"Ensure `l18n` is installed with a `pytz` version it was released alongside or a close subsequent version. If issues arise, check for a newer `l18n` release or report an issue on the GitHub repository.","message":"l18n's versioning is designed to align with `pytz`. If `l18n` and `pytz` versions are significantly mismatched, there may be missing or incorrect translations, particularly if new timezones or territory names have been introduced in `pytz` that `l18n` hasn't yet processed from CLDR.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Monitor for new `l18n` releases or be prepared to generate updated translation data if you require the absolute latest CLDR information.","message":"The library fetches translations from the CLDR database. If CLDR is updated with new or changed locale data and the `l18n` library is not updated accordingly, its translations may become outdated or incomplete.","severity":"gotcha","affected_versions":"All versions, especially older ones"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}