本文整理汇总了Python中translate.misc.quote.propertiesdecode函数的典型用法代码示例。如果您正苦于以下问题:Python propertiesdecode函数的具体用法?Python propertiesdecode怎么用?Python propertiesdecode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了propertiesdecode函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: get_source
def get_source(self):
'''
Returns source string from a ttkit unit.
'''
if (isinstance(self.mainunit, tsunit) and
self.template is None and
self.mainunit.hasplural()):
# Need to apply special magic for plurals here
# as there is no singlular/plural in the source string
return join_plural([
self.unit.source,
self.unit.source,
])
if self.is_unit_key_value():
# Need to decode property encoded string
if isinstance(self.mainunit, propunit):
if self.template is not None:
return quote.propertiesdecode(self.template.value)
else:
return quote.propertiesdecode(self.unit.name)
if self.template is not None:
return self.template.value
else:
return self.unit.name
else:
if self.template is not None:
return get_string(self.template.target)
else:
return get_string(self.unit.source)
开发者ID:franco999,项目名称:weblate,代码行数:29,代码来源:formats.py
示例2: test_properties_decode_slashu
def test_properties_decode_slashu(self):
# The real input strings don't have double backslashes, but we have to
# double them here because Python immediately decode them, even for raw
# strings.
assert quote.propertiesdecode(u"abc\\u1e13") == u"abcḓ"
assert quote.propertiesdecode(u"abc\\u0020") == u"abc "
# NOTE Java only accepts 4 digit unicode, Mozilla accepts two
# unfortunately, but it seems harmless to accept both.
assert quote.propertiesdecode("abc\\u20") == u"abc "
开发者ID:onlinehomeopati,项目名称:translate,代码行数:9,代码来源:test_quote.py
示例3: get_source
def get_source(self):
"""Return source string from a ttkit unit."""
if self.is_unit_key_value(self.mainunit):
# Need to decode property encoded string
if isinstance(self.mainunit, propunit):
if self.template is not None:
return quote.propertiesdecode(self.template.value)
return quote.propertiesdecode(self.unit.name)
if self.template is not None:
return self.template.value
return self.unit.name
else:
if self.template is not None:
return get_string(self.template.target)
return get_string(self.unit.source)
开发者ID:daleathan,项目名称:weblate,代码行数:15,代码来源:base.py
示例4: target
def target(self):
"""Return target string from a ttkit unit."""
if self.unit is None:
return ''
# Need to decode property encoded string
# This is basically stolen from
# translate.storage.properties.propunit.gettarget
# which for some reason does not return translation
value = quote.propertiesdecode(self.unit.value)
value = re.sub('\\\\ ', ' ', value)
return value
开发者ID:nijel,项目名称:weblate,代码行数:11,代码来源:ttkit.py
示例5: test_propertiesdecode
def test_propertiesdecode(self):
assert quote.propertiesdecode(u"abc") == u"abc"
assert quote.propertiesdecode(u"abc\\u1e13") == u"abcḓ"
assert quote.propertiesdecode(u"abc\\u1E13") == u"abcḓ"
assert quote.propertiesdecode(u"abc\N{LEFT CURLY BRACKET}") == u"abc{"
assert quote.propertiesdecode(u"abc\\") == u"abc\\"
assert quote.propertiesdecode(u"abc\\") == u"abc\\"
开发者ID:onlinehomeopati,项目名称:translate,代码行数:7,代码来源:test_quote.py
示例6: get_target
def get_target(self):
"""Return target string from a ttkit unit."""
if self.unit is None:
return ''
if self.is_unit_key_value(self.unit):
# Need to decode property encoded string
if isinstance(self.unit, propunit):
# This is basically stolen from
# translate.storage.properties.propunit.gettarget
# which for some reason does not return translation
value = quote.propertiesdecode(self.unit.value)
value = re.sub('\\\\ ', ' ', value)
return value
return self.unit.value
return get_string(self.unit.target)
开发者ID:daleathan,项目名称:weblate,代码行数:15,代码来源:base.py
示例7: get_target
def get_target(self):
"""
Returns target string from a ttkit unit.
"""
if self.unit is None:
return ""
if isinstance(self.unit, tsunit) and not self.unit.isreview() and not self.unit.istranslated():
# For Qt ts, empty translated string means source should be used
return self.get_source()
if self.is_unit_key_value():
# Need to decode property encoded string
if isinstance(self.unit, propunit):
# This is basically stolen from
# translate.storage.properties.propunit.gettarget
# which for some reason does not return translation
value = quote.propertiesdecode(self.unit.value)
value = re.sub(u"\\\\ ", u" ", value)
return value
return self.unit.value
else:
return get_string(self.unit.target)
开发者ID:schuster-rainer,项目名称:weblate,代码行数:21,代码来源:formats.py
示例8: get_target
def get_target(unit):
'''
Returns target string from a ttkit unit.
'''
if unit is None:
return ''
if is_unit_key_value(unit):
# Need to decode property encoded string
if isinstance(unit, propunit):
# This is basically stolen from
# translate.storage.properties.propunit.gettarget
# which for some reason does not return translation
value = quote.propertiesdecode(unit.value)
value = re.sub(u"\\\\ ", u" ", value)
return value
return unit.value
else:
if hasattr(unit.target, 'strings'):
return join_plural(unit.target.strings)
else:
return unit.target
开发者ID:lohrun,项目名称:weblate,代码行数:21,代码来源:util.py
示例9: gettarget
def gettarget(self):
translation = quote.propertiesdecode(self.translation)
translation = re.sub(u"\\\\ ", u" ", translation)
return translation
开发者ID:andynicholson,项目名称:translate,代码行数:4,代码来源:properties.py
示例10: getsource
def getsource(self):
value = quote.propertiesdecode(self.value)
return value
开发者ID:andynicholson,项目名称:translate,代码行数:3,代码来源:properties.py
示例11: decode
def decode(string):
return quote.propertiesdecode(string)
开发者ID:translate,项目名称:translate,代码行数:2,代码来源:properties.py
示例12: source
def source(self):
# Need to decode property encoded string
return quote.propertiesdecode(
super(PropertiesUnit, self).source
)
开发者ID:nijel,项目名称:weblate,代码行数:5,代码来源:ttkit.py
示例13: getsource
def getsource(self):
value = quote.propertiesdecode(self.value)
value = re.sub(u"\\\\ ", u" ", value)
return value
开发者ID:lehmannro,项目名称:translate,代码行数:4,代码来源:properties.py
注:本文中的translate.misc.quote.propertiesdecode函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论