Skip to content

Message extraction fails when using both Globalize.formatMessage and <FormatMessage>#5

Closed
alunny wants to merge 2 commits intorxaviers:masterfrom
alunny:alunny/es6both
Closed

Message extraction fails when using both Globalize.formatMessage and <FormatMessage>#5
alunny wants to merge 2 commits intorxaviers:masterfrom
alunny:alunny/es6both

Conversation

@alunny
Copy link
Collaborator

@alunny alunny commented Oct 1, 2015

PR is just a failing test case - I can try to fix if you don't have time to have a look.

@alunny
Copy link
Collaborator Author

alunny commented Oct 1, 2015

I think I've found what's up, should have a real patch shortly.

@rxaviers
Copy link
Owner

rxaviers commented Oct 1, 2015

👏 👍

@alunny
Copy link
Collaborator Author

alunny commented Oct 1, 2015

So part of the problem (at least in a test case) is that react-globalize-compiler doesn't transform _globalize2['default'] into Globalize, as globalize-compiler does.

Should react-globalize-compiler depend on globalize-compiler? I don't really want to just copy that transform into here, although that would be the quickest fix.

@rxaviers
Copy link
Owner

rxaviers commented Oct 1, 2015

Using the transform in here as well sounds good to me. Ideally, Globalize should adopts the same strategy for default messages that react-globalize has. Then, we'll be able to move all this stuff into globalize-compiler (where it should live).

PS: About variable names, the ideal solution should keep a table of variables (per scope) dynamically generated from require("globalize"), or define(["globalize"...) calls, orimport` declaration. But, that is much more complex.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found this useful during debugging - not strictly necessary.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting 👍

@alunny
Copy link
Collaborator Author

alunny commented Oct 1, 2015

I think we'll want to do the same for messageFormatter calls as well as formatMessage btw.

@rxaviers
Copy link
Owner

rxaviers commented Oct 1, 2015

Sounds good to me, thanks.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a duplicate file now (this was already in extract-default-message-transforms but not exported)

formatMessage and messageFormatter

Signed-off-by: Andrew Lunny <alunny@twitter.com>
@alunny
Copy link
Collaborator Author

alunny commented Oct 2, 2015

Should be ready to merge now.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency, let's move lib/extract-default-messages-transforms/babel-globalize2-default-into-globalize.js to lib/extract-transforms/ given it's used by both default-messages and normal compiler?

@rxaviers
Copy link
Owner

rxaviers commented Oct 2, 2015

Other than one comment above, it looks good to me.

also rm extract-default-messages-transforms directory, since it's empty
now

Signed-off-by: Andrew Lunny <alunny@twitter.com>
@alunny
Copy link
Collaborator Author

alunny commented Oct 2, 2015

updated now :)

@rxaviers rxaviers closed this in 4439985 Oct 2, 2015
@rxaviers
Copy link
Owner

rxaviers commented Oct 2, 2015

Thank you @alunny, landed and published by 0.0.6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants