def merge2dtd(dtdsource, posource): """helper that merges po translations to dtd source without requiring files""" inputfile = BytesIO(posource.encode()) inputpo = po.pofile(inputfile) templatefile = BytesIO(dtdsource.encode()) templatedtd = dtd.dtdfile(templatefile) convertor = po2dtd.redtd(templatedtd) return convertor.convertstore(inputpo)
def merge2dtd(self, dtdsource, posource): """helper that merges po translations to dtd source without requiring files""" inputfile = wStringIO.StringIO(posource) inputpo = po.pofile(inputfile) templatefile = wStringIO.StringIO(dtdsource) templatedtd = dtd.dtdfile(templatefile) convertor = po2dtd.redtd(templatedtd) outputdtd = convertor.convertstore(inputpo) return outputdtd