Opened 7 years ago

Closed 7 years ago

Last modified 5 years ago

#12230 closed (fixed)

to_locale not working with sr_Latn

Reported by: Janoš Owned by: nobody
Component: Internationalization Version: 1.1
Severity: Keywords:
Cc: janos@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: UI/UX:

Description

There is a bug in function to_locale in django/utils/translation/trans_real.py when trying to get locale for sr-latn language.

In [1]: from django.utils.translation import to_locale

In [2]: to_locale('sr-latn')
Out[2]: 'sr_LATN'

The output should be 'sr_Latn'. It is an exception that is overlooked when new language has been added.
Because of the wrong caption Django won't recognize 'sr_Latn' folder with translations when searching trough 'locale' folders.

Patch that I have provided solves the problem, but there could be a different condition under if.

Attachments (1)

01-trans_real.diff (456 bytes) - added by Janoš 7 years ago.

Download all attachments as: .zip

Change History (6)

Changed 7 years ago by Janoš

Attachment: 01-trans_real.diff added

comment:1 Changed 7 years ago by Jannis Leidel

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Triage Stage: UnreviewedAccepted

comment:2 Changed 7 years ago by Jannis Leidel

Needs tests: set

comment:3 Changed 7 years ago by Jannis Leidel

Resolution: fixed
Status: newclosed

(In [12056]) Fixed #12230 - Updated utils.translation.to_locale to support the special sr_Latn locale. Thanks to Janos Guljas.

comment:4 Changed 7 years ago by Jannis Leidel

(In [12251]) [1.1.X] Fixed #12230 - Updated utils.translation.to_locale to support the special sr_Latn locale. Thanks to Janos Guljas.

Backport of r12056.

comment:5 Changed 5 years ago by Jacob

milestone: 1.2

Milestone 1.2 deleted

Note: See TracTickets for help on using tickets.
Back to Top