本文整理汇总了Python中translate.storage.oo.makekey函数的典型用法代码示例。如果您正苦于以下问题:Python makekey函数的具体用法?Python makekey怎么用?Python makekey使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了makekey函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: convertelement
def convertelement(self, theoo):
"""convert an oo element into a list of base units (.po or XLIFF)"""
if self.sourcelanguage in theoo.languages:
part1 = theoo.languages[self.sourcelanguage]
else:
logging.error("/".join(theoo.lines[0].getkey()) +
"language not found: %s", self.sourcelanguage)
return []
if self.blankmsgstr:
# use a blank part2
part2 = oo.ooline()
else:
if self.targetlanguage in theoo.languages:
part2 = theoo.languages[self.targetlanguage]
else:
# if the language doesn't exist, the translation is missing ... so make it blank
part2 = oo.ooline()
if "x-comment" in theoo.languages:
translators_comment = theoo.languages["x-comment"]
else:
translators_comment = oo.ooline()
key = oo.makekey(part1.getkey(), self.long_keys)
unitlist = []
for subkey in ("text", "quickhelptext", "title"):
unit = self.maketargetunit(part1, part2, translators_comment, key, subkey)
if unit is not None:
unitlist.append(unit)
return unitlist
开发者ID:flyeven,项目名称:translate,代码行数:28,代码来源:oo2xliff.py
示例2: test_makekey
def test_makekey():
"""checks the makekey function for consistency"""
assert oo.makekey(('project', r'path\to\the\sourcefile.src', 'resourcetype', 'GROUP_ID', 'LOCAL_ID', 'platform'), False) == "sourcefile.src#GROUP_ID.LOCAL_ID.resourcetype"
# Testwith long_key i.e. used in multifile options
assert oo.makekey(('project', r'path\to\the\sourcefile.src', 'resourcetype', 'GROUP_ID', 'LOCAL_ID', 'platform'), True) == "project/path/to/the/sourcefile.src#GROUP_ID.LOCAL_ID.resourcetype"
assert oo.makekey(('project', r'path\to\the\sourcefile.src', 'resourcetype', 'GROUP_ID', '', 'platform'), False) == "sourcefile.src#GROUP_ID.resourcetype"
assert oo.makekey(('project', r'path\to\the\sourcefile.src', 'resourcetype', '', 'LOCAL_ID', 'platform'), False) == "sourcefile.src#LOCAL_ID.resourcetype"
assert oo.makekey(('project', r'path\to\the\sourcefile.src', '', 'GROUP_ID', 'LOCAL_ID', 'platform'), False) == "sourcefile.src#GROUP_ID.LOCAL_ID"
assert oo.makekey(('project', r'path\to\the\sourcefile.src', '', 'GROUP_ID', '', 'platform'), False) == "sourcefile.src#GROUP_ID"
开发者ID:onia,项目名称:translate,代码行数:9,代码来源:test_oo.py
示例3: makeindex
def makeindex(self):
"""makes an index of the oo keys that are used in the source file"""
self.index = {}
for ookey, theoo in self.o.ookeys.iteritems():
sourcekey = oo.makekey(ookey, self.long_keys)
self.index[sourcekey] = theoo
开发者ID:anderson916,项目名称:translate,代码行数:6,代码来源:po2oo.py
注:本文中的translate.storage.oo.makekey函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论