gpt4 book ai didi

spring - 为什么在某些语言环境中未正确填写 Spring MessageSource 参数?

转载 作者:IT老高 更新时间:2023-10-28 13:45:47 25 4
gpt4 key购买 nike

mailconfirm.mail.body=<html><body><h3 style="margin: 0 0 1em;">Hi, {0}!</h3>\
To confirm your email address click on the confirmation link given bellow. If clicking on the link doesn't work, copy and paste the link in a new browser tab. <br /><br />\
<a href="http://www.domain.com/confirm_email.html?action=activate&hash={1}">http://www.domain.com/confirm_email.html?action=activate&hash={1}</a><br /><br />\
Kind regards,<br />\
Your Something
</body></html>

以上是用于下面代码的特定消息。

String country = "AU";
Object[] args = new Object[] { account.getLogin(), confirm.getHash() };

helper.setText(appContext.getMessage("mailconfirm.mail.body", args,
new Locale(country)), true);

我调试了两个参数,它们都有正确的值。在调试 appContext.getMessage 行时,我看到 {1} 参数未填充正确的值,但 {0} 是。

有什么想法可能是错的吗?我怀疑这可能是一些语言环境问题。

最佳答案

问题解决了!问题似乎是因为邮件 mailconfirm.mail.body 在 {0} 之后和 {1} 之间的某处包含一个撇号。将 doesn't 替换为 does not 后,它解决了问题。我不知道那里不能使用撇号。附言这是一个错误还是只是我的错误,应该转义撇号?

mailconfirm.mail.body=<html><body><h3 style="margin: 0 0 1em;">Hi, {0}!</h3>\
To confirm your email address, click on the confirmation link given bellow. If clicking on the link doesn't work, copy and paste the link in a new browser tab. <br /><br />\
<a href="http://www.domain.com/confirm_email.html?action=activate&hash={1}">http://www.domain.com/confirm_email.html?action=activate&hash={1}</a><br /><br />\
Kind regards,<br />\
Your Something
</body></html>

一个花了我大约一个小时来弄清楚并插入修复。哈哈哈..从现在开始我认为撇号是邪恶的!

关于spring - 为什么在某些语言环境中未正确填写 Spring MessageSource 参数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6332378/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com