Exemplo n.º 1
0
 def convertstore(self, inputstore, templatefile=None, **kwargs):
     """converts a .po file to .xlf format"""
     if templatefile is None:
         outputstore = poxliff.PoXliffFile(**kwargs)
     else:
         outputstore = poxliff.PoXliffFile(templatefile, **kwargs)
     filename = inputstore.filename
     for inputunit in inputstore.units:
         if inputunit.isblank():
             continue
         transunitnode = self.convertunit(outputstore, inputunit, filename)
     return bytes(outputstore)
Exemplo n.º 2
0
 def po2xliff(self, posource, sourcelanguage="en", targetlanguage=None):
     """helper that converts po source to xliff source without requiring files"""
     postore = po.pofile(posource.encode("utf-8"))
     convertor = po2xliff.po2xliff()
     outputxliff = convertor.convertstore(postore,
                                          None,
                                          sourcelanguage=sourcelanguage,
                                          targetlanguage=targetlanguage)
     return poxliff.PoXliffFile(outputxliff)
Exemplo n.º 3
0
def poxliffparse(posource):
    """helper that parses po source into poxliffFile"""
    poxli = poxliff.PoXliffFile()
    poxli.parse(posource)
    return poxli