martinandert / react-translate-component

A component for React that utilizes the Counterpart module to provide multi-lingual/localized text content.
MIT License
322 stars 31 forks source link

Can't make dynamic translation work using `with` #28

Closed micky2be closed 7 years ago

micky2be commented 7 years ago

I have a simple label "Inbox": "Inbox [%(unread)]" showing the number of unread message. I setting the props with like so { unread: nbUnreadMsg || 0 } but the display stay as Inbox [%(unread)]

This number can change dynamically of course and will trigger a rendering on this comonent. Am I missing something here?

martinandert commented 7 years ago

Hi @micky2be, please try %(unread)s instead of %(unread). See https://www.npmjs.com/package/sprintf-js#named-arguments.