Enmerkar

0.7.1 · active · verified Thu Apr 16

Enmerkar is a Python library providing utilities for integrating Babel, a powerful internationalization and localization toolkit, with Django web applications. It is a fork of `django-babel` and is currently at version 0.7.1, offering compatibility with modern Django and Python versions. Releases are infrequent but target essential Django updates.

Common errors

Warnings

Install

Imports

Quickstart

Configure Enmerkar by adding it to `INSTALLED_APPS` and its `LocaleMiddleware` to `MIDDLEWARE`. Crucially, define `BABEL_DEFAULT_LOCALE` and `BABEL_DEFAULT_TIMEZONE` in your `settings.py`. Then, use `{% load babel %}` in your templates to access Babel's formatting filters for dates, times, and numbers.

# In your Django settings.py

INSTALLED_APPS = [
    # ... other apps
    'enmerkar',
]

MIDDLEWARE = [
    # ... other middleware, e.g., SessionMiddleware
    'enmerkar.middleware.LocaleMiddleware',
]

# Required Babel settings
BABEL_DEFAULT_LOCALE = 'en_US'
BABEL_DEFAULT_TIMEZONE = 'Europe/London'

# In a Django template (e.g., mytemplate.html)
# {% load babel %}
# <p>Formatted Date: {{ datetime_obj|babeldate:'full' }}</p>
# <p>Formatted Time: {{ datetime_obj|babeltime:'long' }}</p>
# <p>Formatted Number: {{ 12345.67|babelnumber }}</p>

view raw JSON →