How to remove or disable unwanted languages in Django 4.1.1

Question:

I had a question about translations in Django…
So I have a project with 4 languages defined in my settings.py

LANGUAGES = [
    ('en', _('English')),
    ('fr', _('French')),
    ('de', _('German')),
    ('it', _('Italy')),
]

now I want to disable all languages except english, so I’ve been searching in google how to do it, and find this post on SO => enter link description here, than I tried to comment all languages except english, after that I’ve done ./manage.py makemigrations => ./manage.py migrate migrations went without any error, BUT in my language list they didn’t dissapear… also I’ve been find code that as I think forms this list… I changed thare hardcoded langlist from language_list = ['en', 'it', 'de', 'fr'] to language_list = settings.LANGUAGES and also nothing happened with my UI language list choices…

So, question:
how properly I can disable unwanted languages in my Django application;

P.S I’m new in python and Django at all, so please can anyone help me with this?

Asked By: vladimir

||

Answers:

You should define it in the setting’s file in the LANGUAGES list.

In your case, it should be English only, and make sure you are running migrations correctly. Please double-check the migrations file and run migrate command again, and it should work.

LANGUAGES = (
    ('en', _("English")),
)
Answered By: Ikram Khan Niazi

problem solved
I just should populate language list in UI from settings.py (using this package => https://github.com/jakubroztocil/django-settings-export), and this solved my problem!

Answered By: vladimir
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.