コード例 #1
0
 def po2sub(self, posource):
     """helper that converts po source to subtitle source without requiring files"""
     inputfile = BytesIO(posource.encode())
     inputpo = po.pofile(inputfile)
     convertor = po2sub.po2sub()
     outputsub = convertor.convert_store(inputpo)
     return outputsub.decode("utf-8")
コード例 #2
0
ファイル: test_po2sub.py プロジェクト: diorcety/translate
 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.po2sub()
     outputsub = convertor.convert_store(inputpo)
     return outputsub.decode('utf-8')
コード例 #3
0
ファイル: test_po2sub.py プロジェクト: ltfbyz/translate
 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.po2sub()
     outputsub = convertor.convertstore(inputpo)
     return outputsub.decode('utf-8')
コード例 #4
0
 def merge2sub(self, subsource, posource):
     """helper that merges po translations to subtitle source without requiring files"""
     inputfile = BytesIO(posource.encode())
     inputpo = po.pofile(inputfile)
     templatefile = BytesIO(subsource.encode())
     convertor = po2sub.po2sub(templatefile, inputpo)
     outputsub = convertor.convert_store()
     print(outputsub)
     return outputsub.decode("utf-8")
コード例 #5
0
ファイル: test_po2sub.py プロジェクト: diorcety/translate
 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.po2sub(templatefile, inputpo)
     outputsub = convertor.convert_store()
     print(outputsub)
     return outputsub.decode('utf-8')