Code

Opened 5 years ago

Closed 5 years ago

Last modified 3 years ago

#12230 closed (fixed)

to_locale not working with sr_Latn

Reported by: janos 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 janos 5 years ago.

Download all attachments as: .zip

Change History (6)

Changed 5 years ago by janos

comment:1 Changed 5 years ago by jezdez

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

comment:2 Changed 5 years ago by jezdez

  • Needs tests set

comment:3 Changed 5 years ago by jezdez

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

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

comment:4 Changed 4 years ago by jezdez

(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 3 years ago by jacob

  • milestone 1.2 deleted

Milestone 1.2 deleted

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.