def inc2po(self, incsource, inctemplate=None):
     """helper that converts .inc source to po source without requiring files"""
     inputfile = wStringIO.StringIO(incsource)
     if inctemplate:
         templatefile = wStringIO.StringIO(inctemplate)
     else:
         templatefile = None
     outputfile = wStringIO.StringIO()
     result = mozfunny2prop.inc2po(inputfile, outputfile, templatefile)
     outputpo = outputfile.getvalue()
     outputpofile = po.pofile(wStringIO.StringIO(outputpo))
     return outputpofile
 def inc2po(self, incsource, inctemplate=None):
     """helper that converts .inc source to po source without requiring files"""
     inputfile = wStringIO.StringIO(incsource)
     if inctemplate:
         templatefile = wStringIO.StringIO(inctemplate)
     else:
         templatefile = None
     outputfile = wStringIO.StringIO()
     result = mozfunny2prop.inc2po(inputfile, outputfile, templatefile)
     outputpo = outputfile.getvalue()
     outputpofile = po.pofile(wStringIO.StringIO(outputpo))
     return outputpofile
Beispiel #3
0
 def inc2po(incsource, inctemplate=None):
     """helper that converts .inc source to po source without requiring files"""
     inputfile = BytesIO(incsource.encode())
     if inctemplate:
         templatefile = BytesIO(inctemplate.encode())
     else:
         templatefile = None
     outputfile = BytesIO()
     result = mozfunny2prop.inc2po(inputfile, outputfile, templatefile)
     assert result == 1
     outputpo = outputfile.getvalue()
     outputpofile = po.pofile(BytesIO(outputpo))
     return outputpofile