messageSource不替换模板中的所有参数

gst*_*low 2 java spring template-engine resourcebundle internationalization

我有代码:

messageSource.getMessage("some.key",new Object[]{30,31},Constants.LOCALE)
Run Code Online (Sandbox Code Playgroud)

和键内部属性文件:

some.key=Csv header length ({0}) doesn't correspond the mapping file size {1} .
Run Code Online (Sandbox Code Playgroud)

但结果很奇怪:

Csv header length (30) doesn't correspond the mapping file size {1} .
Run Code Online (Sandbox Code Playgroud)

Fisrt变量被成功替换但第二 - 不是.

为什么第二个论点没有解决?

小智 8

问题是因为您在邮件中有一条未引用的单引号.

有关您的问题的示例,请参阅https://www.mscharhag.com/java/resource-bundle-single-quote-escaping.