def _gen_filename(self, lang): pot_file = self.pot_file() if pot_file: filename = self._po_file(lang, os.path.basename(pot_file)) if not os.path.isdir(os.path.dirname(filename)): os.makedirs(os.path.dirname(filename)) new_po = get_po(pot_file) new_po.fpath = None new_po.metadata['Language'] = lang for entry in new_po: entry.msgstr = '' if entry.msgstr_plural: for pos in entry.msgstr_plural: entry.msgstr_plural[pos] = '' new_po.save(filename) return filename
def generate(self, lang): name = self._generate_name(lang) pofile = get_po(name, klass=self.po_class, wrapwidth=POFILE_WRAP_WIDTH) pofile.app = self return pofile