Ticket #23840: makemessages.diff

File makemessages.diff, 2.6 KB (added by Ilja Maas, 10 years ago)
  • django/core/management/commands/makemessages.py

    diff --git a/django/core/management/commands/makemessages.py b/django/core/management/commands/makemessages.py
    index 77e7e62..b720ef3 100644
    a b class TranslatableFile(object):  
    6262        if command.verbosity > 1:
    6363            command.stdout.write('processing file %s in %s\n' % (self.file, self.dirpath))
    6464        _, file_ext = os.path.splitext(self.file)
    65         if domain == 'djangojs' and file_ext in command.extensions:
     65        if domain == 'djangojs':
    6666            orig_file = os.path.join(self.dirpath, self.file)
    6767            work_file = orig_file
    6868            is_templatized = command.gettext_version < (0, 18, 3)
    class TranslatableFile(object):  
    8585                '--output=-'
    8686            ] + command.xgettext_options
    8787            args.append(work_file)
    88         elif domain == 'django' and (file_ext == '.py' or file_ext in command.extensions):
     88        elif domain == 'django':
    8989            orig_file = os.path.join(self.dirpath, self.file)
    9090            work_file = orig_file
    91             is_templatized = file_ext in command.extensions
     91            is_templatized = file_ext != '.py'
    9292            if is_templatized:
    9393                with io.open(orig_file, encoding=settings.FILE_CHARSET) as fp:
    9494                    src_data = fp.read()
    class Command(BaseCommand):  
    250250        if self.domain == 'djangojs':
    251251            exts = extensions if extensions else ['js']
    252252        else:
    253             exts = extensions if extensions else ['html', 'txt']
    254         self.extensions = handle_extensions(exts)
     253            exts = extensions if extensions else ['html', 'txt', 'py']
     254        self.extensions = handle_extensions(exts, ignored=())
    255255
    256256        if (locale is None and not exclude and not process_all) or self.domain is None:
    257257            raise CommandError("Type '%s help %s' for usage information." % (
    class Command(BaseCommand):  
    394394                    self.locale_paths.insert(0, os.path.join(os.path.abspath(dirpath), dirname))
    395395            for filename in filenames:
    396396                file_path = os.path.normpath(os.path.join(dirpath, filename))
    397                 if is_ignored(file_path, self.ignore_patterns):
     397                _, file_ext = os.path.splitext(filename)
     398                if not (file_ext in self.extensions) or \
     399                        is_ignored(file_path, self.ignore_patterns):
    398400                    if self.verbosity > 1:
    399401                        self.stdout.write('ignoring file %s in %s\n' % (filename, dirpath))
    400402                else:
Back to Top