'Preprocess (if necessary) a translatable file before passing it to
xgettext GNU gettext utility.'

def preprocess(self):

    if (not self.is_templatized):
        return
    encoding = (settings.FILE_CHARSET if self.command.settings_available else 'utf-8')
    with open(self.path, 'r', encoding=encoding) as fp:
        src_data = fp.read()
    if (self.domain == 'djangojs'):
        content = prepare_js_for_gettext(src_data)
    elif (self.domain == 'django'):
        content = templatize(src_data, origin=self.path[2:])
    with open(self.work_path, 'w', encoding='utf-8') as fp:
        fp.write(content)
