Author: jezdez
Date: 2011-01-21 11:30:35 -0600 (Fri, 21 Jan 2011)
New Revision: 15258
Modified:
django/trunk/django/core/management/commands/makemessages.py
Log:
Added contrib apps to ignore list when running makemessages in the Djagno
source tree and added a --no-obsolete option in preparation of moving app
translations out of core.
Modified: django/trunk/django/core/management/commands/makemessages.py
===================================================================
--- django/trunk/django/core/management/commands/makemessages.py
2011-01-21 15:55:27 UTC (rev 15257)
+++ django/trunk/django/core/management/commands/makemessages.py
2011-01-21 17:30:35 UTC (rev 15258)
@@ -115,7 +115,8 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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)
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.