#31911: Django-3.1: get_language() fails to return LANGUAGE_CODE during 
./manage.py
migrate
-------------------------------------+-------------------------------------
     Reporter:  George Tantiras      |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:                       |                  Version:  3.1
  Internationalization               |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by George Tantiras):

 The example project resulted after stripping down
 [https://github.com/raratiru/django-letsagree, django-letsagree] which
 uses `get_language` (through [https://github.com/matthiask/django-
 translated-fields, `django-translated-fields`]) in the `ModelForm` to
 allow only certain fields to appear in the relevant admin page.

 As a user who has set `USE_I18N  = True`, I would expect of `get_language`
 to at least return the default language, as per the "notion" I get from
 the docs of [https://docs.djangoproject.com/en/dev/ref/settings/#language-
 code, `LANGUAGE_CODE`]:


     It serves two purposes:
     *If the locale middleware isn’t in use, it decides which translation
 is served to all users.
     *If the locale middleware is active, it provides a fallback language
 in case the user’s preferred language can’t be determined or is not
 supported by the website. It also provides the     fallback translation
 when a translation for a given literal doesn’t exist for the user’s
 preferred language.

 "Notion": `@no_translations` ~= "the locale middleware isn’t in use"

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31911#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.1a5dab231c3d442fccde84b61a50ebb0%40djangoproject.com.

Reply via email to