本文整理汇总了Python中dNG.data.text.l10n.L10n.get_dict方法的典型用法代码示例。如果您正苦于以下问题:Python L10n.get_dict方法的具体用法?Python L10n.get_dict怎么用?Python L10n.get_dict使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dNG.data.text.l10n.L10n
的用法示例。
在下文中一共展示了L10n.get_dict方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _change_match
# 需要导入模块: from dNG.data.text.l10n import L10n [as 别名]
# 或者: from dNG.data.text.l10n.L10n import get_dict [as 别名]
#.........这里部分代码省略.........
"content",
self._update_mapped_element("content", self.content),
key
)
elif (source == "settings"):
runtime_settings_dict = AbstractResponse.get_instance().runtime_settings
_return += self.render_block(data[data_position:tag_end_position],
"settings",
self._update_mapped_element("settings", runtime_settings_dict),
key
)
#
#
elif (tag_definition['tag'] == "each"):
re_result = re.match("^\\[each:(\\w+):([\\w.]+):([\\w.]+)\\]", data[tag_position:data_position])
source = (None if (re_result is None) else re_result.group(1))
if (source is not None):
key = re_result.group(2)
mapping_key = re_result.group(3)
if (source == "content"):
_return += self.render_each(data[data_position:tag_end_position],
"content",
self._update_mapped_element("content", self.content),
key,
mapping_key
)
elif (source == "settings"):
runtime_settings_dict = AbstractResponse.get_instance().runtime_settings
_return += self.render_each(data[data_position:tag_end_position],
"settings",
self._update_mapped_element("settings", runtime_settings_dict),
key,
mapping_key
)
#
#
elif (tag_definition['tag'] == "if"):
re_result = re.match("^\\[if:(\\w+):([\\w.]+)(\\s*)(!=|==)(.*?)\\]", data[tag_position:data_position])
source = (None if (re_result is None) else re_result.group(1))
if (source is not None):
key = re_result.group(2)
operator = re_result.group(4)
value = re_result.group(5).strip()
if (source == "content"):
_return += self.render_if_condition(self._update_mapped_element("content", self.content),
key,
operator,
value,
data[data_position:tag_end_position]
)
elif (source == "request"):
request = AbstractRequest.get_instance()
_return += self.render_if_condition({ 'lang': request.lang },
key,
operator,
value,
data[data_position:tag_end_position]
)
elif (source == "settings"):
runtime_settings_dict = AbstractResponse.get_instance().runtime_settings
_return += self.render_if_condition(self._update_mapped_element("settings", runtime_settings_dict),
key,
operator,
value,
data[data_position:tag_end_position]
)
#
#
elif (tag_definition['tag'] == "link"):
renderer = ContentLinkRenderer()
tag_params = Renderer.parse_tag_parameters("link", data, tag_position, data_position)
_return += renderer.render(data[data_position:tag_end_position], tag_params)
elif (tag_definition['tag'] == "rewrite"):
source = re.match("^\\[rewrite:(\\w+)(:.*)?\\]", data[tag_position:data_position]).group(1)
key = data[data_position:tag_end_position]
if (source == "content"):
_return += self.render_rewrite(self._update_mapped_element("content", self.content), key)
elif (source == "l10n"):
_return += self.render_rewrite(self._update_mapped_element("l10n", L10n.get_dict()), key)
elif (source == "settings"):
runtime_settings_dict = AbstractResponse.get_instance().runtime_settings
_return += self.render_rewrite(self._update_mapped_element("settings", runtime_settings_dict), key)
#
#
_return += data_closed
return _return