Django Multilingual interface Django.How

Author avatar wrote on 26/05/2022

1.Change ‘’ of our project

#default langueage of the site

# list of avaible languages
    ('en', 'Englich'),
    ('ru', 'Русский'),

# enable django translate system
USE_I18N = True

# set location of files with translations
    os.path.join(BASE_DIR, 'locale'),



2.Change ‘’ of our project:

from django.conf.urls.i18n import i18n_patterns

urlpatterns = i18n_patterns(
    path('', include('pages.urls')),
    path('accounts/', include('accounts.urls')),  
    prefix_default_language = False


3.Create ‘local’ folder in our project root

Now it’s working. To set place for translation, in template use it in different ways:

When you create all interface run command in terminal makemessages -l ru


!Set lang you want to create translation at the end

After this django will generate some files ‘*.po’ in our ‘local’ folder. In this files you can set translation for all words you set by ‘{% trans %}’ tag.

At the end run ‘ compilemessages’ command in our terminal

Django translation tutorial:

Important for windos need to install ‘gettext’

to do thi just download 2 packages from


Where ‘X’ is version (i have install 0.17)

Unzip them to ‘C:\Program Files\gettext-utils’ (need only bin folders, put them all together)

and add ‘;C:\Program Files\gettext-utils\bin’ our PATH at the end

More detaile here –как-установить-gnu-gettext-gt-015-в-windows-так-что-я-могу-создавать-файлы-po