to_locale not working with sr_Latn
|Reported by:||Janoš||Owned by:||nobody|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||yes||Patch needs improvement:||no|
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 : from django.utils.translation import to_locale In : to_locale('sr-latn') Out: '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.