'Get all files in the given root. Also check that there is a matching
locale dir for each file.'

def find_files(self, root):

    def is_ignored(path, ignore_patterns):
        '\n                                                Check    if    the    given    path    should    be    ignored    or    not.\n                                                '
        filename = os.path.basename(path)
        def ignore(pattern):
            return (fnmatch.fnmatchcase(filename, pattern) or fnmatch.fnmatchcase(path, pattern))
        return any((ignore(pattern) for pattern in ignore_patterns))
    ignore_patterns = [os.path.normcase(p) for p in self.ignore_patterns]
    dir_suffixes = {('%s*' % path_sep) for path_sep in {'/', os.sep}}
    norm_patterns = []
    for p in ignore_patterns:
        for dir_suffix in dir_suffixes:
            if p.endswith(dir_suffix):
                norm_patterns.append(p[:(- len(dir_suffix))])
                break
        else:
            norm_patterns.append(p)
    all_files = []
    ignored_roots = []
    if self.settings_available:
        ignored_roots = [os.path.normpath(p) for p in (settings.MEDIA_ROOT, settings.STATIC_ROOT) if p]
    for (dirpath, dirnames, filenames) in os.walk(root, topdown=True, followlinks=self.symlinks):
        for dirname in dirnames[:]:
            if (is_ignored(os.path.normpath(os.path.join(dirpath, dirname)), norm_patterns) or (os.path.join(os.path.abspath(dirpath), dirname) in ignored_roots)):
                dirnames.remove(dirname)
                if (self.verbosity > 1):
                    self.stdout.write(('ignoring    directory    %s\n' % dirname))
            elif (dirname == 'locale'):
                dirnames.remove(dirname)
                self.locale_paths.insert(0, os.path.join(os.path.abspath(dirpath), dirname))
        for filename in filenames:
            file_path = os.path.normpath(os.path.join(dirpath, filename))
            file_ext = os.path.splitext(filename)[1]
            if ((file_ext not in self.extensions) or is_ignored(file_path, self.ignore_patterns)):
                if (self.verbosity > 1):
                    self.stdout.write(('ignoring    file    %s    in    %s\n' % (filename, dirpath)))
            else:
                locale_dir = None
                for path in self.locale_paths:
                    if os.path.abspath(dirpath).startswith(os.path.dirname(path)):
                        locale_dir = path
                        break
                if (not locale_dir):
                    locale_dir = self.default_locale_path
                if (not locale_dir):
                    locale_dir = NO_LOCALE_DIR
                all_files.append(self.translatable_file_class(dirpath, filename, locale_dir))
    return sorted(all_files)
