          def is_ignored(path, ignore_patterns):
              """
              Check if the given path should be ignored or not.
              """
              for pattern in ignore_patterns:
                  if fnmatch.fnmatchcase(path, pattern):
                      return True
              return False
  
          dir_suffix = '%s*' % os.sep
          norm_patterns = [p[:-len(dir_suffix)] if p.endswith(dir_suffix) else p for p in self.ignore_patterns]
          all_files = []
          for dirpath, dirnames, filenames in os.walk(root, topdown=True, followlinks=self.symlinks):
 
</s> remove         pattern1 = os.path.join('ignore_dir', '*')
 </s> add         ignore_patterns = [
            os.path.join('ignore_dir', '*'),
            'xxx_*',
        ] </s> remove             ignore_patterns=[pattern1], stdout=stdout)
 </s> add             ignore_patterns=ignore_patterns, stdout=stdout)
            filename = os.path.basename(path)
            ignore = lambda pattern: fnmatch.fnmatchcase(filename, pattern)
            return any(ignore(pattern) for pattern in ignore_patterns)
          def is_ignored(path, ignore_patterns):
              """
              Check if the given path should be ignored or not.
              """
            filename = os.path.basename(path)
            ignore = lambda pattern: fnmatch.fnmatchcase(filename, pattern)
            return any(ignore(pattern) for pattern in ignore_patterns)
            filename = os.path.basename(path)
            ignore = lambda pattern: fnmatch.fnmatchcase(filename, pattern)
            return any(ignore(pattern) for pattern in ignore_patterns)
            filename = os.path.basename(path)
            ignore = lambda pattern: fnmatch.fnmatchcase(filename, pattern)
            return any(ignore(pattern) for pattern in ignore_patterns)
            filename = os.path.basename(path)
            ignore = lambda pattern: fnmatch.fnmatchcase(filename, pattern)
            return any(ignore(pattern) for pattern in ignore_patterns)
  
          dir_suffix = '%s*' % os.sep
          norm_patterns = [p[:-len(dir_suffix)] if p.endswith(dir_suffix) else p for p in self.ignore_patterns]
          all_files = []
          for dirpath, dirnames, filenames in os.walk(root, topdown=True, followlinks=self.symlinks):
keep keep keep keep replace replace replace replace keep keep keep keep keep
 Fixed #20422 -- Applied makemessage's --ignore patterns to full path

Fix makemessage's --ignore patterns being applied to the full path
instead of the file name. Thanks to nnseva for the report and the
original patch. 
django/core/management/commands/makemessages.py