django-rosetta is a Django application designed to simplify the translation process for Django projects. It works by providing a web-based interface to edit gettext `.po` files, without requiring any database models or creating tables. The library is actively maintained, with recent updates in version 0.10.3 adding support for Django 6.0 and modernizing its JavaScript codebase by dropping jQuery. It also features integration with various AI translation services like DeepL and OpenAI for translation suggestions.
pip install django-rosettaVerified import paths — ran on the pinned version, not inferred.
To quickly set up django-rosetta, first install it via pip. Then, add `'rosetta'` to your `INSTALLED_APPS` in `settings.py` and include `rosetta.urls` in your project's `urls.py`. Ensure your Django project is already configured for internationalization (i18n) by defining `LANGUAGES` and `LOCALE_PATHS`, and running `python manage.py makemessages` and `python manage.py compilemessages` to create and compile translation files.
Review and update any custom JavaScript that interacts with Rosetta's frontend to remove jQuery dependencies or adapt to the new vanilla JS implementation.
Check the official documentation or PyPI for the exact Django/Python version requirements for your django-rosetta version and upgrade your Django/Python environment if necessary.
Configure a persistent cache backend (e.g., Memcached, Redis) in your Django settings and ensure `ROSETTA_STORAGE_CLASS` is set to `'rosetta.storage.CacheRosettaStorage'`. Avoid using `signed_cookies` with `SessionRosettaStorage` for large PO files.
Review your `Content-Security-Policy` headers and potentially add `nonce` attributes or specific `'self'` sources for styles and scripts if you encounter CSP violations after upgrading.
Set `DEEPL_AUTH_KEY`, `OPENAI_API_KEY`, or other relevant API keys in your `settings.py` (e.g., using `os.environ.get`) and ensure `ROSETTA_ENABLE_TRANSLATION_SUGGESTIONS` is `True`.