react-localization
react-localization copied to clipboard
Support for named tokens for format string
What is the appetite for supporting named tokens in a new method, to be called like this:
en:{
welcome:"welcome |firstName|, your status is |Status|."
}
...
var tokens = { firstName: "John", status: "Accepted" };
strings.formatStringWithTokens(strings.welcome, tokens);
The benefit of this is that when the strings are handed over to localization teams they have more context of the value in those fields and less room for error.
I also needed this, so modified the code to support it: https://github.com/stefalda/react-localization/pull/59
@joshsalverda the PR is merged, so I think this should be closed.