enmerkar-underscore
raw JSON → 2.4.0 verified Fri May 01 auth: no python
A Django extension that implements an underscore extractor for django-babel, enabling translation of JavaScript underscore templates. Version 2.4.0 supports Django 5.2 and Python 3.9+. Released as needed by the Open edX project.
pip install enmerkar-underscore Common errors
error ModuleNotFoundError: No module named 'enmerkar_underscore' ↓
cause Missing installation or wrong package name.
fix
Run: pip install enmerkar-underscore
error AttributeError: module 'enmerkar' has no attribute 'underscore' ↓
cause Importing from the wrong package 'enmerkar' instead of 'enmerkar_underscore'.
fix
Change import to: from enmerkar_underscore.extract import Extractor
Warnings
breaking Dropped Python 3.8 support in version 2.4.0. Upgrade to Python 3.9+. ↓
fix Use Python 3.9 or higher.
gotcha Do not confuse with 'enmerkar' (which extracts Django templates). enmerkar-underscore is for underscore.js templates only. ↓
fix Ensure you install and import from 'enmerkar_underscore' not 'enmerkar'.
Imports
- Extractor wrong
from enmerkar import Extractorcorrectfrom enmerkar_underscore.extract import Extractor
Quickstart
# In your Django app's Babel extraction config (setup.cfg or pyproject.toml):
# [extractors]
# underscore = enmerkar_underscore.extract:Extractor
import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings')
from enmerkar_underscore.extract import Extractor
extractor = Extractor("underscore", [], {})
# Extractor is used by django-babel during extraction.