def po2tmx(self, posource, sourcelanguage='en', targetlanguage='af'): """helper that converts po source to tmx source without requiring files""" inputfile = wStringIO.StringIO(posource) outputfile = wStringIO.StringIO() outputfile.tmxfile = tmx.tmxfile(inputfile=None, sourcelanguage=sourcelanguage) po2tmx.convertpo(inputfile, outputfile, templatefile=None, sourcelanguage=sourcelanguage, targetlanguage=targetlanguage) return outputfile.tmxfile
def po2tmx(self, posource, sourcelanguage='en', targetlanguage='af', comment=None): """helper that converts po source to tmx source without requiring files""" inputfile = BytesIO(posource.encode('utf-8')) outputfile = BytesIO() outputfile.tmxfile = tmx.tmxfile(inputfile=None, sourcelanguage=sourcelanguage) po2tmx.convertpo(inputfile, outputfile, templatefile=None, sourcelanguage=sourcelanguage, targetlanguage=targetlanguage, comment=comment) return outputfile.tmxfile
def po2tmx(posource, sourcelanguage="en", targetlanguage="af", comment=None): """helper that converts po source to tmx source without requiring files""" inputfile = BytesIO(posource.encode("utf-8")) outputfile = BytesIO() outputfile.tmxfile = tmx.tmxfile(inputfile=None, sourcelanguage=sourcelanguage) po2tmx.convertpo( inputfile, outputfile, templatefile=None, sourcelanguage=sourcelanguage, targetlanguage=targetlanguage, comment=comment, ) return outputfile.tmxfile