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
feat(@formatjs/ts-transformer): allow to override user defined message id via overrideIdFn
as function
#1926
Conversation
… id via `overrideIdFn` as function This commit introduces the following logic: 1) overrideIdFn is a string - if msg.id is defined leave it unchanged - if msg.id is empty then use interpolateName with provided template 2) overrideIdFn is a function - pass msg.id to function as first arg. Allow to user decide what to do with id - it may be empty or contain already defined value
I spent several hours to bazel without luck. @longlho please run tests on your machine before merge. Of course, if you accept these changes. |
looks like you forgot to initialize |
looks like this change is not backwards compatible. Can you explain the use case for #2 above? Why does |
I expect that With babel, I can override
But with babel you can override it even if formatjs/packages/babel-plugin-react-intl/index.ts Lines 202 to 214 in 9e48e2c
Anyway, it's quite strange that formatjs/packages/ts-transformer/src/transform.ts Lines 11 to 16 in 9e48e2c
So, in other words, I feel that the behavior for
PS. About bazel. My bad and you're right - I didn't init submodules. |
overrideIdFn
as functionoverrideIdFn
as function
Thanks a lot for your contributions! |
This PR introduces the following logic: