Package: python-django Version: 1.1.1-1 Severity: normal Tags: patch
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. Ticked has been filed here http://code.djangoproject.com/ticket/12230, but until there is no upstream fix, I suggest the following patch. Thanx. -- System Information: Debian Release: squeeze/sid APT prefers testing APT policy: (999, 'testing'), (1, 'experimental'), (1, 'unstable') Architecture: amd64 (x86_64) Kernel: Linux 2.6.31-janos (SMP w/2 CPU cores; PREEMPT) Locale: LANG=en_US.UTF-8, lc_ctype=sr_rs.ut...@latin (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages python-django depends on: ii python 2.5.4-2 An interactive high-level object-o ii python-support 1.0.4 automated rebuilding support for P python-django recommends no packages. Versions of packages python-django suggests: ii python-flup 1.0.2-1 Implements Python Web Server Gatew ii python-mysqldb 1.2.2-10 A Python interface to MySQL pn python-psycopg <none> (no description available) ii python-psycopg2 2.0.13-1 Python module for PostgreSQL ii python-sqlite 1.0.1-7 python interface to SQLite 2 -- no debconf information
--- a/django/utils/translation/trans_real.py +++ b/django/utils/translation/trans_real.py @@ -40,6 +40,9 @@ if to_lower: return language[:p].lower()+'_'+language[p+1:].lower() else: + # Get correct locale for sr-latn + if len(language[p+1:]) > 2: + return language[:p].lower()+'_'+language[p+1].upper()+language[p+2:].lower() return language[:p].lower()+'_'+language[p+1:].upper() else: return language.lower()