Babel

The Python internationalization library for locale-aware dates, numbers, and message catalogs

Library
PyPI
v2.18.0
1,467 stars
BSD 3-Clause License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
85 /100 Excellent
Development Activity 92
Maintenance 72
Community 88
Maturity 60
Momentum 28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
73 /100 Good
Architecture 76
Code Quality 78
Innovation 70
Learning Curve 68

Babel is a Python library that provides an integrated collection of utilities for internationalizing and localizing applications, especially web-based ones. It wraps the CLDR (Common Locale Data Repository) to expose locale-aware formatting for dates, times, numbers, currencies, lists, and units, alongside a full toolchain for extracting, compiling, and working with gettext message catalogs. Originally developed for the Sphinx documentation project’s translation needs, Babel has become a foundational dependency across the Python web ecosystem, quietly powering the i18n layer of frameworks like Flask, Django extensions, and Jinja2-based sites.

What You Get

  • A Locale class exposing CLDR-derived display names, territories, scripts, and plural rules for any of the hundreds of locales CLDR tracks
  • Locale-aware date, time, and datetime formatting/parsing (babel.dates) including timezone-sensitive interval formatting
  • Locale-aware number, currency, and unit formatting/parsing (babel.numbers, babel.units) with correct grouping, decimal, and currency symbol conventions
  • A pybabel CLI and babel.messages API for extracting translatable strings from Python/Jinja2/JavaScript source, plus compiling and updating gettext .po/.mo catalog files
  • CLDR plural-rule evaluation (babel.plural) for correctly pluralizing translated strings across languages with complex plural categories
  • Support helpers (babel.support) for lazy translation proxies and format wrappers commonly used in web frameworks

Common Use Cases

  • Formatting dates, numbers, and currencies correctly for a user’s locale in a Flask, Django, or Pyramid web application
  • Extracting translatable strings from a Python + Jinja2 codebase into a .pot template and managing per-language .po translation files via the pybabel CLI
  • Building CLI tools or reports that need to render numbers, dates, and lists using conventions appropriate to the end user’s locale rather than hardcoded English formatting
  • Implementing correct plural forms in translated UI strings across languages with more than the English singular/plural distinction

Under The Hood

Architecture Babel is organized around two largely independent subsystems that share only the CLDR data layer. babel.core.Locale parses locale identifiers (e.g. en_US, zh_Hans_CN) and loads the matching CLDR dataset from the bundled babel/locale-data/*.dat files via babel.localedata; babel.dates, babel.numbers, babel.units, and babel.lists all take a Locale (or locale string) and format values against that dataset. The second subsystem, babel.messages, implements the gettext workflow: extract.py walks source trees with pluggable per-filetype extractors (Python, JavaScript, Jinja2), catalog.py models a translation catalog in memory, and pofile.py/mofile.py read and write the .po/.mo file formats; pybabel (via babel.messages.frontend) is the CLI entry point tying extraction, initialization, update, and compilation into distutils/setuptools-style commands. Tech Stack The library is pure Python with zero required runtime dependencies beyond the standard library (Python 3.8+ per pyproject.toml), keeping it easy to vendor into any web framework’s dependency tree; CLDR data is pre-compiled into binary .dat files at release time by scripts/import_cldr.py rather than parsed from XML at runtime, which keeps import and locale-lookup overhead low. Development tooling is Ruff for lint/format and pytest for the test suite, configured entirely in pyproject.toml. Code Quality The tests/ directory contains roughly 20 test modules and about 593 test functions/methods covering core locale parsing, date/number/unit formatting, plural rules, message extraction, and catalog I/O, including a dedicated test_smoke.py and a tests/messages/ subpackage for the gettext toolchain; conftest.py centralizes locale-parameterized fixtures used across the suite. Coverage is tracked via .coveragerc and CI runs through GitHub Actions. Code style favors explicit, well-documented functions over cleverness, with docstrings on public formatting functions showing example output. API Design The formatting functions follow a consistent format_x(value, locale=...) / parse_x(string, locale=...) pairing across dates, numbers, and units, so the mental model transfers directly between modules; Locale.parse() accepts flexible input (POSIX-style codes, CLDR identifiers) and normalizes them, lowering the barrier for developers unfamiliar with locale-tag conventions. The message-catalog side is more CLI-driven and requires learning pybabel’s command structure and a babel.cfg extraction mapping file, which is a steeper on-ramp than the formatting API but is well documented in the project’s Sphinx docs.

Used by 9 apps in this directory

Python
89%
Apache 2.0

Apache Airflow

Data Engineering

46,995

Define, schedule, and monitor complex data workflows as Python code — with a powerful UI, 80+ provider integrations, and battle-tested scalability across thousands of production deployments.

View details
96
Repo Health
89
Technical
64
Dependency
Built with
Python 89%
Updated 4 days ago
Python
59%
Apache 2.0

argilla

AI Development · Data Engineering

5,125

Collaborate on high-quality AI training data with a self-hosted annotation platform built for LLMs, NLP, and multimodal models.

View details
65
Repo Health
81
Technical
61
Dependency
Built with
Python 59%
Jupyter Notebook 21%
Updated 1 weeks ago
Python
79%
Apache 2.0

changedetection.io

Monitoring

34,605

Self-hosted website change detection with AI-powered smart alerts, browser automation, price tracking, and 85+ notification channels.

View details
91
Repo Health
80
Technical
68
Dependency
Built with
Python 79%
Updated 1 weeks ago
Python
52%
Other

Odoo

CRM · ERP · Productivity

54,709

The open source ERP platform that integrates CRM, accounting, inventory, manufacturing, and 60+ business apps into one seamlessly connected suite.

View details
87
Repo Health
82
Technical
64
Dependency
Built with
Python 52%
JavaScript 44%
Updated 5 days ago
TypeScript
58%
MIT

open-notebook

AI Assistants · Note Taking

39,569

A privacy-first, self-hosted AI research notebook with 18+ model providers, multi-speaker podcast generation, and full REST API—your open-source alternative to Google Notebook LM.

View details
90
Repo Health
84
Technical
71
Dependency
Built with
TypeScript 58%
Python 39%
Updated 5 days ago
Python
63%
GPL 3.0

Paperless-ngx

Bookmarks Archiving

46,108

Turn your paper pile into a searchable digital archive with OCR, AI classification, and automated workflows — all running on your own server.

View details
91
Repo Health
88
Technical
67
Dependency
Built with
Python 63%
TypeScript 28%
Updated 4 days ago
Python
65%
Apache 2.0

Polar

Developer Tools · Ecommerce · Invoicing Finance

10,293

Open source payments infrastructure that turns software into a business — subscriptions, usage-based billing, digital products, and merchant-of-record compliance in one platform.

View details
90
Repo Health
82
Technical
66
Dependency
Built with
Python 65%
TypeScript 28%
Updated 4 days ago
Python
82%
AGPL 3.0

SearXNG

Search

37,694

Privacy-first metasearch engine that aggregates results from 250+ search services — no tracking, no profiling, full control when self-hosted.

View details
79
Repo Health
82
Technical
83
Dependency
Built with
Python 82%
Updated 1 weeks ago
Python
54%
AGPL 3.0

Speakr

AI Assistants

4,030

Self-hosted AI transcription with speaker diarization, smart tagging, and multi-user collaboration — your recordings stay on your infrastructure.

View details
82
Repo Health
79
Technical
70
Dependency
Built with
Python 54%
HTML 24%
JavaScript 19%
Updated 1 weeks ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers