• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python dtd.dtdfile函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中translate.storage.dtd.dtdfile函数的典型用法代码示例。如果您正苦于以下问题:Python dtdfile函数的具体用法?Python dtdfile怎么用?Python dtdfile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了dtdfile函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: dtd2po

 def dtd2po(self, dtdsource, dtdtemplate=None):
     """helper that converts dtd source to po source without requiring files"""
     inputfile = wStringIO.StringIO(dtdsource)
     inputdtd = dtd.dtdfile(inputfile)
     convertor = dtd2po.dtd2po()
     if dtdtemplate is None:
         outputpo = convertor.convertstore(inputdtd)
     else:
         templatefile = wStringIO.StringIO(dtdtemplate)
         templatedtd = dtd.dtdfile(templatefile)
         outputpo = convertor.mergestore(templatedtd, inputdtd)
     return outputpo
开发者ID:anderson916,项目名称:translate,代码行数:12,代码来源:test_dtd2po.py


示例2: convertdtd

def convertdtd(inputfile, outputfile, templatefile, pot=False, duplicatestyle="msgctxt"):
    """reads in inputfile and templatefile using dtd, converts using dtd2po, writes to outputfile"""
    inputstore = dtd.dtdfile(inputfile)
    convertor = dtd2po(blankmsgstr=pot, duplicatestyle=duplicatestyle)
    if templatefile is None:
        outputstore = convertor.convertstore(inputstore)
    else:
        templatestore = dtd.dtdfile(templatefile)
        outputstore = convertor.mergestore(templatestore, inputstore)
    if outputstore.isempty():
        return 0
    outputfile.write(str(outputstore))
    return 1
开发者ID:AlexArgus,项目名称:affiliates-lib,代码行数:13,代码来源:dtd2po.py


示例3: dtdparse

 def dtdparse(self, dtdsource):
     """helper that parses dtd source without requiring files"""
     if not isinstance(dtdsource, bytes):
         dtdsource = dtdsource.encode('utf-8')
     dummyfile = BytesIO(dtdsource)
     dtdfile = dtd.dtdfile(dummyfile)
     return dtdfile
开发者ID:Jobava,项目名称:translate-toolkit,代码行数:7,代码来源:test_dtd.py


示例4: convertdtd

def convertdtd(inputfile, outputfile, templatefile, includefuzzy=False,
               remove_untranslated=False, outputthreshold=None):
    inputstore = po.pofile(inputfile)

    if not convert.should_output_store(inputstore, outputthreshold):
        return False

    # Some of the DTD files used for Firefox Mobile are actually completely
    # different with different escaping and quoting rules. The best way to
    # identify them seems to be on their file path in the tree (based on code
    # in compare-locales).
    android_dtd = False
    header_comment = ""
    input_header = inputstore.header()
    if input_header:
        header_comment = input_header.getnotes("developer")
        if "embedding/android" in header_comment or "mobile/android/base" in header_comment:
            android_dtd = True

    if templatefile is None:
        convertor = po2dtd(android=android_dtd,
                           remove_untranslated=remove_untranslated)
    else:
        templatestore = dtd.dtdfile(templatefile, android=android_dtd)
        convertor = redtd(templatestore, android=android_dtd,
                          remove_untranslated=remove_untranslated)
    outputstore = convertor.convertstore(inputstore, includefuzzy)
    outputfile.write(str(outputstore))
    return 1
开发者ID:onia,项目名称:translate,代码行数:29,代码来源:po2dtd.py


示例5: merge2dtd

 def merge2dtd(self, dtdsource, posource):
     """helper that merges po translations to dtd source without requiring files"""
     inputfile = wStringIO.StringIO(posource)
     inputpo = po.pofile(inputfile)
     templatefile = wStringIO.StringIO(dtdsource)
     templatedtd = dtd.dtdfile(templatefile)
     convertor = po2dtd.redtd(templatedtd)
     outputdtd = convertor.convertstore(inputpo)
     return outputdtd
开发者ID:ANKIT-KS,项目名称:fjord,代码行数:9,代码来源:test_po2dtd.py


示例6: convertstore

 def convertstore(self, inputstore, includefuzzy=False):
     outputstore = dtd.dtdfile()
     self.currentgroups = []
     for inputunit in inputstore.units:
         if includefuzzy or not inputunit.isfuzzy():
             dtdunit = self.convertunit(inputunit)
             if dtdunit is not None:
                 outputstore.addunit(dtdunit)
     return outputstore
开发者ID:AlexArgus,项目名称:affiliates-lib,代码行数:9,代码来源:po2dtd.py


示例7: dtdparse

    def dtdparse(self, dtdsource):
        """Parses an Android DTD source string and returns a DTD store.

        This allows to simulate reading from Android DTD files without really
        having real Android DTD files.
        """
        dummyfile = wStringIO.StringIO(dtdsource)
        dtdfile = dtd.dtdfile(dummyfile, android=True)
        return dtdfile
开发者ID:anderson916,项目名称:translate,代码行数:9,代码来源:test_dtd.py


示例8: openDTD

def openDTD(file):
	f = open(file, "r")
	dtdobj = dtd.dtdfile(f)
	f.close()
	dtdentries = dtdobj.units
	d = OrderedDict()
	for i in dtdentries:
		if d.has_key(i.entity): print "Duplicate entry: %s" %i.entity
		else: d[i.entity] = dtd.unquotefromdtd(i.definition)
开发者ID:gialloporpora,项目名称:yellowpy,代码行数:9,代码来源:dtd2lang.py


示例9: convertstore

 def convertstore(self, inputstore, includefuzzy=False):
     outputstore = dtd.dtdfile(android=self.android)
     self.currentgroups = []
     for inputunit in inputstore.units:
         if (includefuzzy or not inputunit.isfuzzy()) and (inputunit.istranslated() or not self.remove_untranslated):
             dtdunit = self.convertunit(inputunit)
             if dtdunit is not None:
                 outputstore.addunit(dtdunit)
     return outputstore
开发者ID:asyschikov,项目名称:translate,代码行数:9,代码来源:po2dtd.py


示例10: convertdtd

def convertdtd(inputfile, outputfile, templatefile, includefuzzy=False):
    inputstore = po.pofile(inputfile)
    if templatefile is None:
        convertor = po2dtd()
    else:
        templatestore = dtd.dtdfile(templatefile)
        convertor = redtd(templatestore)
    outputstore = convertor.convertstore(inputstore, includefuzzy)
    outputfile.write(str(outputstore))
    return 1
开发者ID:AlexArgus,项目名称:affiliates-lib,代码行数:10,代码来源:po2dtd.py


示例11: convertdtd

def convertdtd(inputfile, outputfile, templatefile, pot=False,
               duplicatestyle="msgctxt"):
    """reads in inputfile and templatefile using dtd, converts using dtd2po,
    writes to outputfile"""
    android_dtd = False
    if hasattr(inputfile, "name"):
        # Check if it is an Android DTD file.
        if ("embedding/android" in inputfile.name or
            "mobile/android/base" in inputfile.name):
            android_dtd = True
    inputstore = dtd.dtdfile(inputfile, android=android_dtd)
    convertor = dtd2po(blankmsgstr=pot, duplicatestyle=duplicatestyle)
    if templatefile is None:
        outputstore = convertor.convertstore(inputstore)
    else:
        templatestore = dtd.dtdfile(templatefile, android=android_dtd)
        outputstore = convertor.mergestore(templatestore, inputstore)
    if outputstore.isempty():
        return 0
    outputfile.write(str(outputstore))
    return 1
开发者ID:alghaamdi,项目名称:translate,代码行数:21,代码来源:dtd2po.py



注:本文中的translate.storage.dtd.dtdfile函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python dtd.unquotefromdtd函数代码示例发布时间:2022-05-27
下一篇:
Python csvl10n.csvfile函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap