def finish(self): I18nBuilder.finish(self) data = dict( version = self.config.version, copyright = self.config.copyright, project = self.config.project, # XXX should supply tz ctime = datetime.now().strftime('%Y-%m-%d %H:%M%z'), ) self._create_project_folder() for section, messages in self.status_iterator( self.catalogs.iteritems(), "writing message catalogs... ", lambda (section, _):darkgreen(section), len(self.catalogs)): pofn = path.join(self.config.omegat_project_path, "source", section + '.po') pofile = open(pofn, 'w', encoding='utf-8') try: pofile.write(POHEADER % data) for message, positions in messages.iteritems(): # message contains *one* line of text ready for translation position = ", ".join(["%s(%s)" % (source, line) for (source, line) in positions]) message = message.replace(u'\\', ur'\\'). \ replace(u'"', ur'\"') pomsg = u'#%s\nmsgid "%s"\nmsgstr ""\n\n' % (position, message) pofile.write(pomsg) finally: pofile.close()
def finish(self): I18nBuilder.finish(self) data = dict( version=self.config.version, copyright=self.config.copyright, project=self.config.project, # XXX should supply tz ctime=datetime.now().strftime('%Y-%m-%d %H:%M%z'), ) self._create_project_folder() for section, messages in self.status_iterator( self.catalogs.iteritems(), "writing message catalogs... ", lambda (section, _): darkgreen(section), len(self.catalogs)): pofn = path.join(self.config.omegat_project_path, "source", section + '.po') pofile = open(pofn, 'w', encoding='utf-8') try: pofile.write(POHEADER % data) for message, positions in messages.iteritems(): # message contains *one* line of text ready for translation position = ", ".join([ "%s(%s)" % (source, line) for (source, line) in positions ]) message = message.replace(u'\\', ur'\\'). \ replace(u'"', ur'\"') pomsg = u'#%s\nmsgid "%s"\nmsgstr ""\n\n' % (position, message) pofile.write(pomsg) finally: pofile.close()
def init(self): I18nBuilder.init(self) errors = False if not self.config.omegat_project_path: self.info(red("'omegat_project_path' should not be empty.")) self.info(red(" -> Please check conf.py")) raise RuntimeError("lack setting")