[Django] #28755: django.utils.translation.check_for_language doesn't check in the app folders

13 views
Skip to first unread message

Django

unread,
Oct 30, 2017, 10:03:09 AM10/30/17
to django-...@googlegroups.com
#28755: django.utils.translation.check_for_language doesn't check in the app
folders
------------------------------------------------+------------------------
Reporter: Dorian Amouroux | Owner: nobody
Type: Bug | Status: new
Component: Internationalization | Version: 1.11
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 1
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
------------------------------------------------+------------------------
When using the `set_language` view to set the language for the user, it
doesn't work if the language file is not in `settings.LOCALE_PATHS` nor in
`django/conf/locale/`.

Indeed `set_language`
(https://github.com/django/django/blob/stable/1.11.x/django/views/i18n.py#L50)
calls the function `check_for_language`. `check_for_language` will check
if the language in parameter exists in the `gettext` catalog. However,
`check_for_language` calls the function `all_locale_paths`
(https://github.com/django/django/blob/stable/1.11.x/django/utils/translation/trans_real.py#L411)
which doesn't contains the path of the apps.

I create a language that doesn't exist in the Django default language, I
can't switch to this language because it cannot be found, it only exists
in the `locale` directory inside my apps.

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

Django

unread,
Nov 1, 2017, 1:05:57 PM11/1/17
to django-...@googlegroups.com
#28755: django.utils.translation.check_for_language doesn't check in the app
folders
--------------------------------------+------------------------------------

Reporter: Dorian Amouroux | Owner: nobody
Type: Bug | Status: new
Component: Internationalization | Version: 1.11
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Claude Paroz):

* has_patch: 1 => 0
* easy: 1 => 0
* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/28755#comment:1>

Django

unread,
Nov 5, 2017, 7:39:03 AM11/5/17
to django-...@googlegroups.com
#28755: django.utils.translation.check_for_language doesn't check in the app
folders
-------------------------------------+-------------------------------------
Reporter: Dorian Amouroux | Owner:
| ChillarAnand
Type: Bug | Status: assigned
Component: | Version: 1.11
Internationalization |

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by ChillarAnand):

* status: new => assigned
* owner: nobody => ChillarAnand


--
Ticket URL: <https://code.djangoproject.com/ticket/28755#comment:2>

Django

unread,
Nov 16, 2017, 7:16:18 AM11/16/17
to django-...@googlegroups.com
#28755: django.utils.translation.check_for_language doesn't check in the app
folders
-------------------------------------+-------------------------------------
Reporter: Dorian Amouroux | Owner:
| ChillarAnand
Type: Bug | Status: assigned
Component: | Version: 1.11
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by ChillarAnand):

* cc: ChillarAnand (added)
* has_patch: 0 => 1


Comment:

PR -> https://github.com/django/django/pull/9351

--
Ticket URL: <https://code.djangoproject.com/ticket/28755#comment:3>

Django

unread,
Nov 16, 2017, 8:32:19 AM11/16/17
to django-...@googlegroups.com
#28755: django.utils.translation.check_for_language doesn't check in the app
folders
-------------------------------------+-------------------------------------
Reporter: Dorian Amouroux | Owner:
| ChillarAnand
Type: Bug | Status: assigned
Component: | Version: 1.11
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Claude Paroz):

* needs_tests: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/28755#comment:4>

Django

unread,
Dec 1, 2017, 7:26:00 AM12/1/17
to django-...@googlegroups.com
#28755: django.utils.translation.check_for_language doesn't check in the app
folders
-------------------------------------+-------------------------------------
Reporter: Dorian Amouroux | Owner:
| ChillarAnand
Type: Bug | Status: assigned
Component: | Version: 1.11
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by ChillarAnand):

* needs_tests: 1 => 0


Comment:

Thanks Claude Paroz. Added a test case.

--
Ticket URL: <https://code.djangoproject.com/ticket/28755#comment:5>

Django

unread,
Dec 16, 2017, 6:03:12 PM12/16/17
to django-...@googlegroups.com
#28755: django.utils.translation.check_for_language doesn't check in the app
folders
-------------------------------------+-------------------------------------
Reporter: Dorian Amouroux | Owner:
| ChillarAnand
Type: Bug | Status: assigned
Component: | Version: 1.11
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Martin):

* needs_better_patch: 0 => 1


Comment:

The build seems to be failing on Windows. The build has expired now so I
can't see the logs to see whether this might be a random failure or not.

--
Ticket URL: <https://code.djangoproject.com/ticket/28755#comment:6>

Django

unread,
Dec 18, 2017, 2:29:02 AM12/18/17
to django-...@googlegroups.com
#28755: django.utils.translation.check_for_language doesn't check in the app
folders
-------------------------------------+-------------------------------------
Reporter: Dorian Amouroux | Owner:
| ChillarAnand
Type: Bug | Status: assigned
Component: | Version: 1.11
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by ChillarAnand):

* needs_better_patch: 1 => 0


Comment:

Build was failing because of windows path issue. Fixed it now.

--
Ticket URL: <https://code.djangoproject.com/ticket/28755#comment:7>

Django

unread,
Feb 7, 2018, 6:02:01 PM2/7/18
to django-...@googlegroups.com
#28755: django.utils.translation.check_for_language doesn't check in the app
folders
-------------------------------------+-------------------------------------
Reporter: Dorian Amouroux | Owner:
| ChillarAnand
Type: Bug | Status: assigned
Component: | Version: 1.11
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* needs_better_patch: 0 => 1


Comment:

Left a comment for improvement about putting the test in a better
location.

--
Ticket URL: <https://code.djangoproject.com/ticket/28755#comment:8>

Django

unread,
Feb 18, 2018, 11:36:56 AM2/18/18
to django-...@googlegroups.com
#28755: django.utils.translation.check_for_language doesn't check in the app
folders
-------------------------------------+-------------------------------------
Reporter: Dorian Amouroux | Owner:
| ChillarAnand
Type: Bug | Status: assigned
Component: | Version: 1.11
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by ChillarAnand):

* needs_better_patch: 1 => 0


Comment:

Added test case for `check_for_language`.

--
Ticket URL: <https://code.djangoproject.com/ticket/28755#comment:9>

Django

unread,
Feb 19, 2018, 4:32:44 AM2/19/18
to django-...@googlegroups.com
#28755: django.utils.translation.check_for_language doesn't check in the app
folders
-------------------------------------+-------------------------------------
Reporter: Dorian Amouroux | Owner:
| ChillarAnand
Type: Bug | Status: assigned
Component: | Version: 1.11
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/28755#comment:10>

Django

unread,
Feb 20, 2018, 9:57:27 PM2/20/18
to django-...@googlegroups.com
#28755: django.utils.translation.check_for_language doesn't check in the app
folders
-------------------------------------+-------------------------------------
Reporter: Dorian Amouroux | Owner:
| ChillarAnand
Type: Bug | Status: closed
Component: | Version: 1.11
Internationalization |
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"e8e0cfa9e550a3309a795ef133e59b90302813c8" e8e0cfa]:
{{{
#!CommitTicketReference repository=""
revision="e8e0cfa9e550a3309a795ef133e59b90302813c8"
Fixed #28755 -- Made check_for_language() include apps' locale
directories.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28755#comment:11>

Reply all
Reply to author
Forward
0 new messages