diff options
| author | Georg Bauer <gb@hugo.westfalen.de> | 2005-10-11 13:38:24 +0000 |
|---|---|---|
| committer | Georg Bauer <gb@hugo.westfalen.de> | 2005-10-11 13:38:24 +0000 |
| commit | 6f88c4f9ecf3837d4f1bb8dcd0c437bc2bdca09d (patch) | |
| tree | 08b3edb268470e763e8337d1bb5f0e59299a40ff /django/utils | |
| parent | 50f348a92f6953c4eeb0d98f7311124e72527016 (diff) | |
i18n: fixed translation resolving - now project translations are pulled in allways (if they exist)
git-svn-id: http://code.djangoproject.com/svn/django/branches/i18n@837 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/utils')
| -rw-r--r-- | django/utils/translation.py | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/django/utils/translation.py b/django/utils/translation.py index e3cb275399..1abeccf39b 100644 --- a/django/utils/translation.py +++ b/django/utils/translation.py @@ -119,21 +119,23 @@ def translation(appname, language): except IOError: t = gettext_module.NullTranslations() _translations[(appname, language)] = t + parts = appname.split('.') + project = __import__(parts[0], {}, {}, []) + + projectpath = os.path.join(os.path.dirname(project.__file__), 'locale') + + try: + t = gettext_module.translation('django', projectpath, [language, settings.LANGUAGE_CODE], klass) + t.set_app_and_language(appname, language) + except IOError: t = None + if t is not None: + t.add_fallback(_translations[(appname, language)]) + _translations[(appname, language)] = t + if appname != '*': - parts = appname.split('.') - project = __import__(parts[0], {}, {}, []) app = __import__(appname, {}, {}, ['views']) apppath = os.path.join(os.path.dirname(app.__file__), 'locale') - projectpath = os.path.join(os.path.dirname(project.__file__), 'locale') - - try: - t = gettext_module.translation('django', projectpath, [language, settings.LANGUAGE_CODE], klass) - t.set_app_and_language(appname, language) - except IOError: t = None - if t is not None: - t.add_fallback(_translations[(appname, language)]) - _translations[(appname, language)] = t try: t = gettext_module.translation('django', apppath, [language, settings.LANGUAGE_CODE], klass) |
