Django Rosetta

0.10.3 · active · verified Thu Apr 16

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.

Common errors

Warnings

Install

Imports

Quickstart

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.

import os

# settings.py
INSTALLED_APPS = [
    # ... default Django apps
    'rosetta',
    'django.contrib.admin', # Rosetta often accessed via admin
]

# Example for translation suggestions
ROSETTA_ENABLE_TRANSLATION_SUGGESTIONS = True

# Configure DeepL or OpenAI if desired
# DEEPL_AUTH_KEY = os.environ.get('DEEPL_AUTH_KEY', '')
# OPENAI_API_KEY = os.environ.get('OPENAI_API_KEY', '')
# OPENAI_BASE_URL = os.environ.get('OPENAI_BASE_URL', '') # for self-hosted LLM

# urls.py (in your project's main urls.py)
from django.contrib import admin
from django.urls import include, path

urlpatterns = [
    path('admin/', admin.site.urls),
    path('rosetta/', include('rosetta.urls')),
]

# After configuration and running makemessages:
# python manage.py makemessages -l es
# python manage.py compilemessages
# Then, navigate to /rosetta/ in your browser.

view raw JSON →