Skip to content
This repository was archived by the owner on Jul 11, 2019. It is now read-only.

Commit 737bec7

Browse files
committed
fixed a bug concerning importing localized file
1 parent dbb813c commit 737bec7

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

bootstrap3_datetime/widgets.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,19 @@ def __iter__(self):
2222
yield 'bootstrap3_datetime/js/moment.min.js'
2323
yield 'bootstrap3_datetime/js/bootstrap-datetimepicker.min.js'
2424
lang = translation.get_language()
25-
if lang.startswith('zh') and lang not in ('zh-cn', 'zh-tw',):
26-
if lang == 'zh-hk':
27-
lang = 'zh-tw'
28-
else:
29-
lang = 'zh-cn'
30-
elif len(lang) > 2 and lang not in ('ar-ma', 'en-au', 'en-ca', 'en-gb',
31-
'fa-ir', 'fr-ca', 'ms-my', 'pt-br',
32-
'rs-latin', 'tzm-la', ):
33-
lang = lang[:2]
34-
if lang != 'en':
35-
yield 'bootstrap3_datetime/js/locales/bootstrap-datetimepicker.%s.js' % (lang.lower())
25+
if lang:
26+
lang = lang.lower()
27+
if lang.startswith('zh') and lang not in ('zh-cn', 'zh-tw',):
28+
if lang == 'zh-hk':
29+
lang = 'zh-tw'
30+
else:
31+
lang = 'zh-cn'
32+
elif len(lang) > 2 and lang not in ('ar-ma', 'en-au', 'en-ca', 'en-gb',
33+
'fa-ir', 'fr-ca', 'ms-my', 'pt-br',
34+
'rs-latin', 'tzm-la', ):
35+
lang = lang[:2]
36+
if lang != 'en':
37+
yield 'bootstrap3_datetime/js/locales/bootstrap-datetimepicker.%s.js' % (lang)
3638

3739
js = JsFiles()
3840
css = {'all': ('bootstrap3_datetime/css/bootstrap-datetimepicker.min.css',), }

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
'static/bootstrap3_datetime/js/*.js',
99
'static/bootstrap3_datetime/js/locales/*.js',]},
1010
include_package_data=True,
11-
version='2.2.1',
11+
version='2.2.2',
1212
description='Bootstrap3 compatible datetimepicker for Django projects.',
1313
long_description=open('README.rst').read(),
1414
author='Nakahara Kunihiko',

0 commit comments

Comments
 (0)