-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[New] support custom replace implementation #171
Conversation
in order to support interpolating types other then strings fix airbnb#170
index.js
Outdated
Polyglot.transformPhrase = function transform(phrase, substitutions, locale) { | ||
return transformPhrase(phrase, substitutions, locale); | ||
}; | ||
Polyglot.transformPhrase = transformPhrase; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is optional. I'm not sure if the api intentionally excludes custom tokens or plural rules here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does intentionally exclude them.
I'll gladly add docs and types if you think this is valuable for the library |
@ljharb sorry to bother you. Have you had the chance to have a look on this? It would really help me to know if this is going into a direction that you'd consider valuable for polyglot or not. |
@Xiphe no, i haven't had time yet, but i will take a look soon. |
index.js
Outdated
Polyglot.transformPhrase = function transform(phrase, substitutions, locale) { | ||
return transformPhrase(phrase, substitutions, locale); | ||
}; | ||
Polyglot.transformPhrase = transformPhrase; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does intentionally exclude them.
hmm, this actually broke tests in node 0.8 and 0.10; something needs a bit more work here. |
Fixed in #172. |
Cool! Thanks for the integration and follow up 👍 |
in order to support interpolating types other then strings
as described in #170 this aims to allow use of complex types (like UI components) in interpolation slots.
Pre-Released this as
@xiphe/[email protected]
.Here is a working example with dynamic and nested components: https://codesandbox.io/s/admiring-framework-lb367l?file=/src/App.js