[英]react-intl not changing placeholder value
Am I doing something wrong here ? 我在这里做错什么了吗?
I am calling intl.formatMessage()
API ( https://github.com/yahoo/react-intl/wiki/API#formatmessage ) as follows: 我正在调用
intl.formatMessage()
API( https://github.com/yahoo/react-intl/wiki/API#formatmessage ),如下所示:
this.intl.formatMessage({id:'downloadRequest.success',values:{correlID:'test'}})
The string in my JSON file looks like: 我的JSON文件中的字符串如下所示:
"downloadRequest.success": "Your request was successfully submitted. Your reference ID is: {correlID}"
However, when I view the page, the output is : 但是,当我查看页面时,输出为:
Your request was successfully submitted. Your reference ID is: {correlID}
ie {correlID}
is not substituted for the test
value provided to formatMessage()
即
{correlID}
不能替代提供给formatMessage()
的test
值
您应该将值作为第二个参数传递。
this.intl.formatMessage({id:'downloadRequest.success'},{correlID:'test'})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.