代码拉取完成,页面将自动刷新
package gvalid
// getErrorMessageByRule retrieves and returns the error message for specified rule.
// It firstly retrieves the message from custom message map, and then checks i18n manager,
// it returns the default error message if it's not found in custom message map or i18n manager.
func (v *Validator) getErrorMessageByRule(ruleKey string, customMsgMap map[string]string) string {
content := customMsgMap[ruleKey]
if content != "" {
// I18n translation.
i18nContent := v.i18nManager.GetContent(v.ctx, content)
if i18nContent != "" {
return i18nContent
}
return content
}
// Retrieve default message according to certain rule.
content = v.i18nManager.GetContent(v.ctx, ruleMessagePrefixForI18n+ruleKey)
if content == "" {
content = defaultMessages[ruleKey]
}
// If there's no configured rule message, it uses default one.
if content == "" {
content = v.i18nManager.GetContent(v.ctx, ruleMessagePrefixForI18n+internalDefaultRuleName)
if content == "" {
content = defaultMessages[internalDefaultRuleName]
}
}
return content
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。