{"id":8975,"library":"enmerkar","title":"Enmerkar","description":"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.","status":"active","version":"0.7.1","language":"en","source_language":"en","source_url":"https://github.com/Zegocover/enmerkar","tags":["Django","Babel","localization","internationalization","i18n","l10n"],"install":[{"cmd":"pip install enmerkar","lang":"bash","label":"Install Enmerkar"}],"dependencies":[{"reason":"Core framework for integration (requires >=2.2).","package":"Django"},{"reason":"Internationalization and localization toolkit (requires >=2.0).","package":"Babel"}],"imports":[{"note":"Enmerkar is a fork of django-babel; update middleware path after migration.","wrong":"from django_babel.middleware import LocaleMiddleware","symbol":"LocaleMiddleware","correct":"from enmerkar.middleware import LocaleMiddleware"}],"quickstart":{"code":"# In your Django settings.py\n\nINSTALLED_APPS = [\n    # ... other apps\n    'enmerkar',\n]\n\nMIDDLEWARE = [\n    # ... other middleware, e.g., SessionMiddleware\n    'enmerkar.middleware.LocaleMiddleware',\n]\n\n# Required Babel settings\nBABEL_DEFAULT_LOCALE = 'en_US'\nBABEL_DEFAULT_TIMEZONE = 'Europe/London'\n\n# In a Django template (e.g., mytemplate.html)\n# {% load babel %}\n# <p>Formatted Date: {{ datetime_obj|babeldate:'full' }}</p>\n# <p>Formatted Time: {{ datetime_obj|babeltime:'long' }}</p>\n# <p>Formatted Number: {{ 12345.67|babelnumber }}</p>","lang":"python","description":"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."},"warnings":[{"fix":"Ensure your project runs on Python 3.5+ and Django 2.2+ before upgrading to Enmerkar 0.7.1 or newer. Downgrade Enmerkar or upgrade your environment.","message":"Enmerkar dropped support for Python < 3.5 and Django < 2.2 in version 0.7.1.","severity":"breaking","affected_versions":">=0.7.1"},{"fix":"Uninstall `django-babel` and install `enmerkar`. Update all references in `settings.py` (e.g., `INSTALLED_APPS`, `MIDDLEWARE`) and any direct Python imports from `django_babel` to `enmerkar`.","message":"The package was renamed from `django-babel` to `enmerkar` in version 0.7.0.","severity":"breaking","affected_versions":">=0.7.0"},{"fix":"Always define `BABEL_DEFAULT_LOCALE` (e.g., 'en_US') and `BABEL_DEFAULT_TIMEZONE` (e.g., 'Europe/London') in your Django `settings.py` to prevent `ImproperlyConfigured` errors.","message":"The `BABEL_DEFAULT_LOCALE` and `BABEL_DEFAULT_TIMEZONE` settings are mandatory for Enmerkar.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Uninstall `django-babel`, install `enmerkar`, and update `INSTALLED_APPS`, middleware entries, and any direct Python imports in your code to use `enmerkar` instead of `django_babel`.","cause":"The library was renamed from `django-babel` to `enmerkar` starting from version 0.7.0.","error":"ModuleNotFoundError: No module named 'django_babel'"},{"fix":"Add `BABEL_DEFAULT_LOCALE = 'en_US'` and `BABEL_DEFAULT_TIMEZONE = 'UTC'` (or your desired values) to your Django project's `settings.py` file.","cause":"The required `BABEL_DEFAULT_LOCALE` (and possibly `BABEL_DEFAULT_TIMEZONE`) setting is missing from your Django `settings.py`.","error":"django.core.exceptions.ImproperlyConfigured: The BABEL_DEFAULT_LOCALE setting must be configured."},{"fix":"Ensure `enmerkar.middleware.LocaleMiddleware` is listed after `django.contrib.sessions.middleware.SessionMiddleware` (and `django.middleware.locale.LocaleMiddleware`, if used) in your `settings.py`.","cause":"Enmerkar's `LocaleMiddleware` is placed incorrectly in the `MIDDLEWARE` list, requiring session data to determine the locale.","error":"django.core.exceptions.ImproperlyConfigured: 'enmerkar.middleware.LocaleMiddleware' must be in MIDDLEWARE after 'django.contrib.sessions.middleware.SessionMiddleware'"}]}