如果属性值中存在参数,则必须将该值作为模式传递给 java.text.MessageFormat
。
也就是说要使用单引号进行转义。 因此,要让引号可见,必须使用重复的引号:
'{0}'
→ {0}
''{0}''
→ '$value$'
使用 choice 格式时会将嵌套格式评估为格式本身,因此必须添加第二个双引号。
传递 1
时:
{0, choice, 0#no|#1''{0}'' file}
→ {0} files
{0, choice, 0#no|#1''''{0}'''' file}
→ '$number_of_files$' files