﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
18192	If translation not exist: 'NoneType' object has no attribute '_info'	jedie	Claude Paroz	"I get this error:
{{{
Traceback (most recent call last):
  File ""./manage.py"", line 91, in <module>
    execute_from_command_line()
  File "".../env/src/django/django/core/management/__init__.py"", line 443, in execute_from_command_line
    utility.execute()
  File "".../env/src/django/django/core/management/__init__.py"", line 382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "".../env/src/django/django/core/management/base.py"", line 196, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "".../env/src/django/django/core/management/base.py"", line 251, in execute
    translation.activate(saved_lang)
  File "".../env/src/django/django/utils/translation/__init__.py"", line 105, in activate
    return _trans.activate(language)
  File "".../env/src/django/django/utils/translation/trans_real.py"", line 194, in activate
    _active.value = translation(language)
  File "".../env/src/django/django/utils/translation/trans_real.py"", line 183, in translation
    default_translation = _fetch(settings.LANGUAGE_CODE)
  File "".../env/src/django/django/utils/translation/trans_real.py"", line 147, in _fetch
    res._info = res._info.copy()
AttributeError: 'NoneType' object has no attribute '_info'
}}}

django/utils/translation/trans_real.py doesn't handle the error if translation file doesn't found. e.g.:
{{{
IOError: [Errno 2] No translation file found for domain: 'django'
}}}

This would fix it:
{{{
django/utils/translation/trans_real.py

@@ -138,6 +138,12 @@ def translation(language):
 
         res = _translation(globalpath)
 
+        if res is None:
+            return gettext_module.NullTranslations()
+
         # We want to ensure that, for example,  ""en-gb"" and ""en-us"" don't share
         # the same translation object (thus, merging en-us with a local update
         # doesn't affect en-gb), even though they will both use the core ""en""
}}}"	Bug	closed	Internationalization	1.4	Normal	fixed			Accepted	1	0	0	1	0	0
