Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added contrib apps to ignore list when running makemessages in the Dj…

…agno source tree and added a --no-obsolete option in preparation of moving app translations out of core.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15258 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit cf179e195d5525e0233385be97a53a6c5d7c6985 1 parent ccfd70c
Jannis Leidel jezdez authored
Showing with 13 additions and 3 deletions.
  1. +13 −3 django/core/management/commands/makemessages.py
16 django/core/management/commands/makemessages.py
View
@@ -115,7 +115,8 @@ def copy_plural_forms(msgs, locale, domain, verbosity):
def make_messages(locale=None, domain='django', verbosity='1', all=False,
- extensions=None, symlinks=False, ignore_patterns=[], no_wrap=False):
+ extensions=None, symlinks=False, ignore_patterns=[], no_wrap=False,
+ no_obsolete=False):
"""
Uses the locale directory from the Django SVN tree or an application/
project to process all
@@ -133,6 +134,8 @@ def make_messages(locale=None, domain='django', verbosity='1', all=False,
if os.path.isdir(os.path.join('conf', 'locale')):
localedir = os.path.abspath(os.path.join('conf', 'locale'))
invoked_for_django = True
+ # Ignoring all contrib apps
+ ignore_patterns += ['contrib/*']
elif os.path.isdir('locale'):
localedir = os.path.abspath('locale')
else:
@@ -288,6 +291,11 @@ def make_messages(locale=None, domain='django', verbosity='1', all=False,
finally:
f.close()
os.unlink(potfile)
+ if no_obsolete:
+ msgs, errors = _popen('msgattrib %s -o "%s" --no-obsolete "%s"' %
+ (wrap, pofile, pofile))
+ if errors:
+ raise CommandError("errors happened while running msgattrib\n%s" % errors)
class Command(BaseCommand):
@@ -309,6 +317,8 @@ class Command(BaseCommand):
default=True, help="Don't ignore the common glob-style patterns 'CVS', '.*' and '*~'."),
make_option('--no-wrap', action='store_true', dest='no_wrap',
default=False, help="Don't break long message lines into several lines"),
+ make_option('--no-obsolete', action='store_true', dest='no_obsolete',
+ default=False, help="Remove obsolete message strings"),
)
help = "Runs over the entire source tree of the current directory and pulls out all strings marked for translation. It creates (or updates) a message file in the conf/locale (in the django tree) or locale (for project and application) directory."
@@ -330,7 +340,7 @@ def handle(self, *args, **options):
ignore_patterns += ['CVS', '.*', '*~']
ignore_patterns = list(set(ignore_patterns))
no_wrap = options.get('no_wrap')
-
+ no_obsolete = options.get('no_obsolete')
if domain == 'djangojs':
extensions = handle_extensions(extensions or ['js'])
else:
@@ -340,4 +350,4 @@ def handle(self, *args, **options):
sys.stdout.write('examining files with the extensions: %s\n'
% get_text_list(list(extensions), 'and'))
- make_messages(locale, domain, verbosity, process_all, extensions, symlinks, ignore_patterns, no_wrap)
+ make_messages(locale, domain, verbosity, process_all, extensions, symlinks, ignore_patterns, no_wrap, no_obsolete)
Please sign in to comment.
Something went wrong with that request. Please try again.