Fix some pep8 errors
This commit is contained in:
@@ -35,10 +35,18 @@ def extract_django(fileobj, keywords, comment_tags, options):
|
|||||||
pluralmatch = plural_re.match(t.contents)
|
pluralmatch = plural_re.match(t.contents)
|
||||||
if endbmatch:
|
if endbmatch:
|
||||||
if inplural:
|
if inplural:
|
||||||
yield lineno, 'ngettext', (smart_unicode(u''.join(singular)),
|
yield (
|
||||||
smart_unicode(u''.join(plural))), []
|
lineno,
|
||||||
|
'ngettext',
|
||||||
|
(smart_unicode(u''.join(singular)),
|
||||||
|
smart_unicode(u''.join(plural))),
|
||||||
|
[])
|
||||||
else:
|
else:
|
||||||
yield lineno, None, smart_unicode(u''.join(singular)), []
|
yield (
|
||||||
|
lineno,
|
||||||
|
None,
|
||||||
|
smart_unicode(u''.join(singular)),
|
||||||
|
[])
|
||||||
|
|
||||||
intrans = False
|
intrans = False
|
||||||
inplural = False
|
inplural = False
|
||||||
|
|||||||
@@ -13,18 +13,24 @@ class Command(LabelCommand):
|
|||||||
args = '[makemessages] [compilemessages]'
|
args = '[makemessages] [compilemessages]'
|
||||||
|
|
||||||
option_list = LabelCommand.option_list + (
|
option_list = LabelCommand.option_list + (
|
||||||
make_option('--locale', '-l', default=None, dest='locale', action='append',
|
make_option(
|
||||||
help='Creates or updates the message files for the given locale(s) (e.g. pt_BR). '
|
'--locale', '-l',
|
||||||
'Can be used multiple times.'),
|
default=None, dest='locale', action='append',
|
||||||
make_option('--domain', '-d', default='django', dest='domain',
|
help='Creates or updates the message files for the given locale(s)'
|
||||||
|
' (e.g pt_BR). Can be used multiple times.'),
|
||||||
|
make_option('--domain', '-d',
|
||||||
|
default='django', dest='domain',
|
||||||
help='The domain of the message files (default: "django").'),
|
help='The domain of the message files (default: "django").'),
|
||||||
make_option('--mapping-file', '-F', default=None, dest='mapping_file',
|
make_option('--mapping-file', '-F',
|
||||||
|
default=None, dest='mapping_file',
|
||||||
help='Mapping file')
|
help='Mapping file')
|
||||||
)
|
)
|
||||||
|
|
||||||
def handle_label(self, command, **options):
|
def handle_label(self, command, **options):
|
||||||
if command not in ('makemessages', 'compilemessages'):
|
if command not in ('makemessages', 'compilemessages'):
|
||||||
raise CommandError("You must either apply 'makemessages' or 'compilemessages'")
|
raise CommandError(
|
||||||
|
"You must either apply 'makemessages' or 'compilemessages'"
|
||||||
|
)
|
||||||
|
|
||||||
if command == 'makemessages':
|
if command == 'makemessages':
|
||||||
self.handle_makemessages(**options)
|
self.handle_makemessages(**options)
|
||||||
@@ -42,7 +48,8 @@ class Command(LabelCommand):
|
|||||||
distribution.parse_config_files(distribution.find_config_files())
|
distribution.parse_config_files(distribution.find_config_files())
|
||||||
|
|
||||||
mapping_file = options.pop('mapping_file', None)
|
mapping_file = options.pop('mapping_file', None)
|
||||||
if mapping_file is None and 'extract_messages' in distribution.command_options:
|
has_extract = 'extract_messages' in distribution.command_options
|
||||||
|
if mapping_file is None and has_extract:
|
||||||
opts = distribution.command_options['extract_messages']
|
opts = distribution.command_options['extract_messages']
|
||||||
try:
|
try:
|
||||||
mapping_file = opts['mapping_file'][1]
|
mapping_file = opts['mapping_file'][1]
|
||||||
@@ -77,7 +84,10 @@ class Command(LabelCommand):
|
|||||||
|
|
||||||
for path in locale_paths:
|
for path in locale_paths:
|
||||||
for locale in locales:
|
for locale in locales:
|
||||||
po_file = os.path.join(path, locale, 'LC_MESSAGES', domain + '.po')
|
po_file = os.path.join(
|
||||||
|
path, locale, 'LC_MESSAGES', domain + '.po'
|
||||||
|
)
|
||||||
if os.path.exists(po_file):
|
if os.path.exists(po_file):
|
||||||
cmd = ['pybabel', 'compile', '-D', domain, '-d', path, '-l', locale]
|
cmd = ['pybabel', 'compile', '-D', domain,
|
||||||
|
'-d', path, '-l', locale]
|
||||||
call(cmd)
|
call(cmd)
|
||||||
|
|||||||
Reference in New Issue
Block a user