本文整理匯總了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