diff options
| author | Marc Garcia <garcia.marc@gmail.com> | 2009-08-08 15:29:30 +0000 |
|---|---|---|
| committer | Marc Garcia <garcia.marc@gmail.com> | 2009-08-08 15:29:30 +0000 |
| commit | ac70e26bafb47f8a69aa805273724fba29ccc26f (patch) | |
| tree | 3bea1b9bb80609474c53c852bb113e0fef0e63d4 /django | |
| parent | b6ceeb15958958587df8ee600c026b2251e9c4e0 (diff) | |
[soc2009/i18n] tests improved, and bugs fixed on tests and because of tests
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/i18n-improvements@11414 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
56 files changed, 61 insertions, 5 deletions
diff --git a/django/conf/global_settings.py b/django/conf/global_settings.py index 540eb0a6de..b21a8cabf1 100644 --- a/django/conf/global_settings.py +++ b/django/conf/global_settings.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # Default Django settings. Override these with settings in the module # pointed-to by the DJANGO_SETTINGS_MODULE environment variable. @@ -75,7 +76,7 @@ LANGUAGES = ( ('lt', gettext_noop('Lithuanian')), ('mk', gettext_noop('Macedonian')), ('nl', gettext_noop('Dutch')), - ('no', gettext_noop('Norwegian')), + ('nb', gettext_noop(u'Norwegian Bokmål')), ('pl', gettext_noop('Polish')), ('pt', gettext_noop('Portuguese')), ('pt-br', gettext_noop('Brazilian Portuguese')), diff --git a/django/conf/locale/ar/formats.py b/django/conf/locale/ar/formats.py index 8a0f54d072..d8d627f820 100644 --- a/django/conf/locale/ar/formats.py +++ b/django/conf/locale/ar/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/bg/formats.py b/django/conf/locale/bg/formats.py index 20bfc826eb..045543a7ac 100644 --- a/django/conf/locale/bg/formats.py +++ b/django/conf/locale/bg/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/bn/formats.py b/django/conf/locale/bn/formats.py index 3d78d5c414..46e5da9392 100644 --- a/django/conf/locale/bn/formats.py +++ b/django/conf/locale/bn/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/ca/formats.py b/django/conf/locale/ca/formats.py index aec16aceb2..464882a6ae 100644 --- a/django/conf/locale/ca/formats.py +++ b/django/conf/locale/ca/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/cs/formats.py b/django/conf/locale/cs/formats.py index e8a9626f13..327e77e868 100644 --- a/django/conf/locale/cs/formats.py +++ b/django/conf/locale/cs/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/cy/formats.py b/django/conf/locale/cy/formats.py index 3b6f62a620..a58d81f479 100644 --- a/django/conf/locale/cy/formats.py +++ b/django/conf/locale/cy/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/da/formats.py b/django/conf/locale/da/formats.py index 049103489a..bc80c6d6dd 100644 --- a/django/conf/locale/da/formats.py +++ b/django/conf/locale/da/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/de/formats.py b/django/conf/locale/de/formats.py index 5c038a5598..aab1c86167 100644 --- a/django/conf/locale/de/formats.py +++ b/django/conf/locale/de/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/el/formats.py b/django/conf/locale/el/formats.py index a548ad09c9..d476ab3885 100644 --- a/django/conf/locale/el/formats.py +++ b/django/conf/locale/el/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/en/formats.py b/django/conf/locale/en/formats.py index 3ff8ee4201..3a507cd27e 100644 --- a/django/conf/locale/en/formats.py +++ b/django/conf/locale/en/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/es/formats.py b/django/conf/locale/es/formats.py index 5b2fe92300..349810f0fe 100644 --- a/django/conf/locale/es/formats.py +++ b/django/conf/locale/es/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/es_AR/formats.py b/django/conf/locale/es_AR/formats.py index a66be1f94b..6d71786415 100644 --- a/django/conf/locale/es_AR/formats.py +++ b/django/conf/locale/es_AR/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/et/formats.py b/django/conf/locale/et/formats.py index b7d2255eb7..b96420c0c1 100644 --- a/django/conf/locale/et/formats.py +++ b/django/conf/locale/et/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/eu/formats.py b/django/conf/locale/eu/formats.py index 1838808356..475f924fe8 100644 --- a/django/conf/locale/eu/formats.py +++ b/django/conf/locale/eu/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/fa/formats.py b/django/conf/locale/fa/formats.py index b25864fa9a..dc11281790 100644 --- a/django/conf/locale/fa/formats.py +++ b/django/conf/locale/fa/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/fi/formats.py b/django/conf/locale/fi/formats.py index 964f17c003..670e26841a 100644 --- a/django/conf/locale/fi/formats.py +++ b/django/conf/locale/fi/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/fr/formats.py b/django/conf/locale/fr/formats.py index 2ddbef6173..965f21304d 100644 --- a/django/conf/locale/fr/formats.py +++ b/django/conf/locale/fr/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/ga/formats.py b/django/conf/locale/ga/formats.py index 1bab609447..f177bb28d4 100644 --- a/django/conf/locale/ga/formats.py +++ b/django/conf/locale/ga/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/gl/formats.py b/django/conf/locale/gl/formats.py index 58a6f89d07..e0a95d5106 100644 --- a/django/conf/locale/gl/formats.py +++ b/django/conf/locale/gl/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/he/formats.py b/django/conf/locale/he/formats.py index 4d9d34c127..8d7c7f2a4a 100644 --- a/django/conf/locale/he/formats.py +++ b/django/conf/locale/he/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/hi/formats.py b/django/conf/locale/hi/formats.py index a678794bfc..6afa2581b9 100644 --- a/django/conf/locale/hi/formats.py +++ b/django/conf/locale/hi/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/hr/formats.py b/django/conf/locale/hr/formats.py index 05fdb0dc97..62d1a7edf5 100644 --- a/django/conf/locale/hr/formats.py +++ b/django/conf/locale/hr/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/hu/formats.py b/django/conf/locale/hu/formats.py index 3ecb69eeec..6ee2db0cd5 100644 --- a/django/conf/locale/hu/formats.py +++ b/django/conf/locale/hu/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/is/formats.py b/django/conf/locale/is/formats.py index bcff36bdd6..b6377db40b 100644 --- a/django/conf/locale/is/formats.py +++ b/django/conf/locale/is/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/it/formats.py b/django/conf/locale/it/formats.py index 150738be18..fe86b5bd70 100644 --- a/django/conf/locale/it/formats.py +++ b/django/conf/locale/it/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/ja/formats.py b/django/conf/locale/ja/formats.py index ab446214e6..853056d8da 100644 --- a/django/conf/locale/ja/formats.py +++ b/django/conf/locale/ja/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/ka/formats.py b/django/conf/locale/ka/formats.py index 59c9e20b69..da37b4d06f 100644 --- a/django/conf/locale/ka/formats.py +++ b/django/conf/locale/ka/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/km/formats.py b/django/conf/locale/km/formats.py index f1ab00740a..3736d574fb 100644 --- a/django/conf/locale/km/formats.py +++ b/django/conf/locale/km/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/kn/formats.py b/django/conf/locale/kn/formats.py index 9e934ddfda..fa7a7b9546 100644 --- a/django/conf/locale/kn/formats.py +++ b/django/conf/locale/kn/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/ko/formats.py b/django/conf/locale/ko/formats.py index b4bc8a8cc0..51986c7910 100644 --- a/django/conf/locale/ko/formats.py +++ b/django/conf/locale/ko/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/lt/formats.py b/django/conf/locale/lt/formats.py index 17536830d7..d9fb0c86f7 100644 --- a/django/conf/locale/lt/formats.py +++ b/django/conf/locale/lt/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/lv/formats.py b/django/conf/locale/lv/formats.py index 4e47c680d6..5dc211cfc0 100644 --- a/django/conf/locale/lv/formats.py +++ b/django/conf/locale/lv/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/mk/formats.py b/django/conf/locale/mk/formats.py index 210a686a18..746ac0ea9f 100644 --- a/django/conf/locale/mk/formats.py +++ b/django/conf/locale/mk/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/nb/formats.py b/django/conf/locale/nb/formats.py index e64a606d19..5896a7fff1 100644 --- a/django/conf/locale/nb/formats.py +++ b/django/conf/locale/nb/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/nl/formats.py b/django/conf/locale/nl/formats.py index c3feb3ed27..3fdf4d631a 100644 --- a/django/conf/locale/nl/formats.py +++ b/django/conf/locale/nl/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/pl/formats.py b/django/conf/locale/pl/formats.py index 54db5039dc..860a4a88ca 100644 --- a/django/conf/locale/pl/formats.py +++ b/django/conf/locale/pl/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/pt/formats.py b/django/conf/locale/pt/formats.py index f9513efb49..053a48af53 100644 --- a/django/conf/locale/pt/formats.py +++ b/django/conf/locale/pt/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/pt_BR/formats.py b/django/conf/locale/pt_BR/formats.py index 14653031ff..f30d5c4dfc 100644 --- a/django/conf/locale/pt_BR/formats.py +++ b/django/conf/locale/pt_BR/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/ro/formats.py b/django/conf/locale/ro/formats.py index d80371ef85..6d6e800467 100644 --- a/django/conf/locale/ro/formats.py +++ b/django/conf/locale/ro/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/ru/formats.py b/django/conf/locale/ru/formats.py index bf76c22056..9a9ee96561 100644 --- a/django/conf/locale/ru/formats.py +++ b/django/conf/locale/ru/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/sk/formats.py b/django/conf/locale/sk/formats.py index 425e8cf82d..1bc3549dcf 100644 --- a/django/conf/locale/sk/formats.py +++ b/django/conf/locale/sk/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/sl/formats.py b/django/conf/locale/sl/formats.py index 0537637be2..4007f10707 100644 --- a/django/conf/locale/sl/formats.py +++ b/django/conf/locale/sl/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/sr/formats.py b/django/conf/locale/sr/formats.py index 68f5993e15..b1aaa77deb 100644 --- a/django/conf/locale/sr/formats.py +++ b/django/conf/locale/sr/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/sr_Latn/formats.py b/django/conf/locale/sr_Latn/formats.py index a66be1f94b..6d71786415 100644 --- a/django/conf/locale/sr_Latn/formats.py +++ b/django/conf/locale/sr_Latn/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/sv/formats.py b/django/conf/locale/sv/formats.py index 4f75056583..df4e633562 100644 --- a/django/conf/locale/sv/formats.py +++ b/django/conf/locale/sv/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/ta/formats.py b/django/conf/locale/ta/formats.py index 85b9e49437..69fa17df33 100644 --- a/django/conf/locale/ta/formats.py +++ b/django/conf/locale/ta/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/te/formats.py b/django/conf/locale/te/formats.py index 5d3c384c48..e805872d52 100644 --- a/django/conf/locale/te/formats.py +++ b/django/conf/locale/te/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/th/formats.py b/django/conf/locale/th/formats.py index 3ab3661fd3..7091dc6b98 100644 --- a/django/conf/locale/th/formats.py +++ b/django/conf/locale/th/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/tr/formats.py b/django/conf/locale/tr/formats.py index 57b4e5605b..b97878865b 100644 --- a/django/conf/locale/tr/formats.py +++ b/django/conf/locale/tr/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/uk/formats.py b/django/conf/locale/uk/formats.py index 918062b79a..8e41bf020d 100644 --- a/django/conf/locale/uk/formats.py +++ b/django/conf/locale/uk/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/zh_CN/formats.py b/django/conf/locale/zh_CN/formats.py index a66be1f94b..6d71786415 100644 --- a/django/conf/locale/zh_CN/formats.py +++ b/django/conf/locale/zh_CN/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/conf/locale/zh_TW/formats.py b/django/conf/locale/zh_TW/formats.py index a66be1f94b..6d71786415 100644 --- a/django/conf/locale/zh_TW/formats.py +++ b/django/conf/locale/zh_TW/formats.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- # This file is distributed under the same license as the Django package. # diff --git a/django/core/management/commands/importcldr.py b/django/core/management/commands/importcldr.py index ab8bd079bf..c4a13e6238 100644 --- a/django/core/management/commands/importcldr.py +++ b/django/core/management/commands/importcldr.py @@ -11,7 +11,8 @@ except ImportError: raise CommandError('You need to install `python-lxml` to run this script') FORMATS_FILE_NAME = 'formats.py' -FORMATS_FILE_HEADER = '''# This file is distributed under the same license as the Django package. +FORMATS_FILE_HEADER = '''# -*- encoding: utf-8 -*- +# This file is distributed under the same license as the Django package. # ''' diff --git a/django/forms/fields.py b/django/forms/fields.py index b4f454dd40..c9a069edfd 100644 --- a/django/forms/fields.py +++ b/django/forms/fields.py @@ -210,7 +210,8 @@ class FloatField(Field): return None try: # We always accept dot as decimal separator - value = float(value.replace(getformat('DECIMAL_SEPARATOR'), '.')) + if isinstance(value, str) or isinstance(value, unicode): + value = float(value.replace(getformat('DECIMAL_SEPARATOR'), '.')) except (ValueError, TypeError): raise ValidationError(self.error_messages['invalid']) if self.max_value is not None and value > self.max_value: @@ -247,7 +248,8 @@ class DecimalField(Field): value = smart_str(value).strip() try: # We always accept dot as decimal separator - value = Decimal(value.replace(getformat('DECIMAL_SEPARATOR'), '.')) + if isinstance(value, str) or isinstance(value, unicode): + value = Decimal(value.replace(getformat('DECIMAL_SEPARATOR'), '.')) except DecimalException: raise ValidationError(self.error_messages['invalid']) diff --git a/django/views/i18n.py b/django/views/i18n.py index e70cd3eca3..4a19e4b31c 100644 --- a/django/views/i18n.py +++ b/django/views/i18n.py @@ -208,7 +208,7 @@ def javascript_catalog(request, domain='djangojs', packages=None): for k, v in pdict.items(): src.append("catalog['%s'] = [%s];\n" % (javascript_quote(k), ','.join(["''"]*(v+1)))) for k, v in get_formats().items(): - src.append("catalog['%s'] = '%s';\n" % (javascript_quote(k), javascript_quote(unicode(v)))) + src.append("catalog['%s'] = '%s';\n" % (javascript_quote(k), javascript_quote(unicode(v)).encode('utf-8'))) src.extend(csrc) src.append(LibFoot) src.append(InterPolate) |
