Skip to content

Commit

Permalink
Fixed #7643 -- Fixed an oversight from [7844].
Browse files Browse the repository at this point in the history
Now makemessages works in projects again. Based on a patch from Horst Gutmann.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7848 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
malcolmt committed Jul 6, 2008
1 parent 075098f commit 25f2cfb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
7 changes: 7 additions & 0 deletions django/conf/__init__.py
Expand Up @@ -71,6 +71,13 @@ def configure(self, default_settings=global_settings, **options):
setattr(holder, name, value) setattr(holder, name, value)
self._target = holder self._target = holder


def configured(self):
"""
Returns True if the settings have already been configured.
"""
return bool(self._target)
configured = property(configured)

class Settings(object): class Settings(object):
def __init__(self, settings_module): def __init__(self, settings_module):
# update this dict from global settings (but only for ALL_CAPS settings) # update this dict from global settings (but only for ALL_CAPS settings)
Expand Down
11 changes: 7 additions & 4 deletions django/core/management/commands/makemessages.py
Expand Up @@ -10,12 +10,15 @@
def make_messages(locale=None, domain='django', verbosity='1', all=False): def make_messages(locale=None, domain='django', verbosity='1', all=False):
""" """
Uses the locale directory from the Django SVN tree or an application/ Uses the locale directory from the Django SVN tree or an application/
project to process all project to process all
""" """
# Need to ensure that the i18n framework is enabled # Need to ensure that the i18n framework is enabled
from django.conf import settings from django.conf import settings
settings.configure(USE_I18N = True) if settings.configured:

settings.USE_I18N = True
else:
settings.configure(USE_I18N = True)

from django.utils.translation import templatize from django.utils.translation import templatize


if os.path.isdir(os.path.join('conf', 'locale')): if os.path.isdir(os.path.join('conf', 'locale')):
Expand All @@ -24,7 +27,7 @@ def make_messages(locale=None, domain='django', verbosity='1', all=False):
localedir = os.path.abspath('locale') localedir = os.path.abspath('locale')
else: else:
raise CommandError("This script should be run from the Django SVN tree or your project or app tree. If you did indeed run it from the SVN checkout or your project or application, maybe you are just missing the conf/locale (in the django tree) or locale (for project and application) directory? It is not created automatically, you have to create it by hand if you want to enable i18n for your project or application.") raise CommandError("This script should be run from the Django SVN tree or your project or app tree. If you did indeed run it from the SVN checkout or your project or application, maybe you are just missing the conf/locale (in the django tree) or locale (for project and application) directory? It is not created automatically, you have to create it by hand if you want to enable i18n for your project or application.")

if domain not in ('django', 'djangojs'): if domain not in ('django', 'djangojs'):
raise CommandError("currently makemessages only supports domains 'django' and 'djangojs'") raise CommandError("currently makemessages only supports domains 'django' and 'djangojs'")


Expand Down

0 comments on commit 25f2cfb

Please sign in to comment.