示例#1
0
 def php2po(self, phpsource, phptemplate=None):
     """helper that converts .php source to po source without requiring files"""
     inputfile = BytesIO(phpsource.encode())
     output_file = BytesIO()
     templatefile = None
     if phptemplate:
         templatefile = BytesIO(phptemplate.encode())
     convertor = php2po.php2po(inputfile, output_file, templatefile)
     convertor.run()
     return convertor.target_store
示例#2
0
 def php2po(self, phpsource, phptemplate=None):
     """helper that converts .php source to po source without requiring files"""
     inputfile = wStringIO.StringIO(phpsource)
     output_file = wStringIO.StringIO()
     templatefile = None
     if phptemplate:
         templatefile = wStringIO.StringIO(phptemplate)
     convertor = php2po.php2po(inputfile, output_file, templatefile)
     convertor.run()
     return convertor.target_store
示例#3
0
 def php2po(self, phpsource, phptemplate=None):
     """helper that converts .phperties source to po source without requiring files"""
     inputfile = wStringIO.StringIO(phpsource)
     inputphp = php.phpfile(inputfile)
     convertor = php2po.php2po()
     if phptemplate:
         templatefile = wStringIO.StringIO(phptemplate)
         templatephp = php.phpfile(templatefile)
         outputpo = convertor.mergestore(templatephp, inputphp)
     else:
         outputpo = convertor.convertstore(inputphp)
     return outputpo
示例#4
0
 def php2po(self, phpsource, phptemplate=None):
     """helper that converts .php source to po source without requiring files"""
     inputfile = wStringIO.StringIO(phpsource)
     inputphp = php.phpfile(inputfile)
     convertor = php2po.php2po()
     if phptemplate:
         templatefile = wStringIO.StringIO(phptemplate)
         templatephp = php.phpfile(templatefile)
         outputpo = convertor.mergestore(templatephp, inputphp)
     else:
         outputpo = convertor.convertstore(inputphp)
     return outputpo