Exemple #1
0
 def po2sub(self, posource):
     """helper that converts po source to subtitle source without requiring
     files"""
     inputfile = wStringIO.StringIO(posource)
     inputpo = po.pofile(inputfile)
     convertor = po2sub.resub()
     outputsub = convertor.convertstore(inputpo)
     return outputsub.decode('utf-8')
Exemple #2
0
 def merge2sub(self, subsource, posource):
     """helper that merges po translations to subtitle source without
     requiring files"""
     inputfile = wStringIO.StringIO(posource)
     inputpo = po.pofile(inputfile)
     templatefile = wStringIO.StringIO(subsource)
     convertor = po2sub.resub(templatefile, inputpo)
     outputsub = convertor.convertstore()
     print(outputsub)
     return outputsub.decode('utf-8')