react-localization icon indicating copy to clipboard operation
react-localization copied to clipboard

Support for named tokens for format string

Open cleverguy25 opened this issue 8 years ago • 2 comments

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.

cleverguy25 avatar Nov 21 '17 05:11 cleverguy25

I also needed this, so modified the code to support it: https://github.com/stefalda/react-localization/pull/59

joshsalverda avatar Jan 15 '18 16:01 joshsalverda

@joshsalverda the PR is merged, so I think this should be closed.

clytras avatar May 29 '19 10:05 clytras