/django-admin-multilang

A Django application that adds the ability to select a language of the admin page manually (Does not includes content).

Primary LanguagePythonMIT LicenseMIT

django-admin-multilang

A very simple Django application that adds the ability on the admin page to select a language manually.

Screenshot

How to install

  • Install using pip:
        pip install django-admin-multilang
    

How to configure

  • Add package to INSTALLED_APPS (above of django.contrib.admin):
        INSTALLED_APPS = [
          'admin_multilanguage',
          'django.contrib.admin',
          'django.contrib.auth',
          'django.contrib.contenttypes',
          'django.contrib.sessions',
          'django.contrib.messages',
          'django.contrib.staticfiles',
          ...
      ]
    
  • In urlpatterns.py where is located settings.py, add this followed line:
        urlpatterns += [
            path('', include('admin_multilanguage.urls', namespace="admin_multilanguage")),
        ]
    
  • Configure in settings.py which languages you want to support (Example):
        from django.utils.translation import ugettext_lazy as _
        
        LANGUAGES = (
            ('lv', _("Latvian")),
            ('en', _("English")),
            ('ru', _("Russian")),
        )
        
        # language to select by default
        LANGUAGE_CODE = 'en'
    
  • Also you need to add this line to MIDDLEWARE to enable localization based on sessions in Django:
        MIDDLEWARE = [
             ...
            'django.middleware.locale.LocaleMiddleware',
             ...
        ]
    
  • Make sure I18N and Sessions enabled as well