Code

Opened 3 years ago

Closed 3 years ago

Last modified 2 years ago

#16909 closed Bug (fixed)

django.utils.formats.get_format function uses wrong language

Reported by: defaultwombat Owned by: jezdez
Component: Internationalization Version: 1.3
Severity: Normal Keywords: l10n get_format lang
Cc: masterjakul@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

django/utils/formats.py

The lang argument in the get_format() function is not used for picking the right language module, as the get_format_modules() function always used the language from get_language().

Actually the language is only used for the cache key so the result of the wrong module will be cached.

As get_format_modules() is only used in get_format() and django.views.i18n.get_formats() I think its save to add an optinal lang=None argument to its definition.

Attachments (0)

Change History (3)

comment:1 Changed 3 years ago by jezdez

  • Needs documentation unset
  • Needs tests unset
  • Owner changed from nobody to jezdez
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 3 years ago by jezdez

  • Resolution set to fixed
  • Status changed from new to closed

In [16884]:

Fixed #16909 -- Pass language to get_format_modules when calling it from get_format to make sure the correct module is returned.

comment:3 Changed 2 years ago by masterjakul@…

  • Cc masterjakul@… added

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.