Skip to content

Conversation

@hoantran-it
Copy link
Contributor

I think it is the same with the order of argument we pass in merge function. But if we place the new one first, result file will be reordered well. I faced this issue when I add new message and run script again. Correct me if I'm wrong :) Anyway, I really appreciate this tool so much, it help me a lot by saving time correcting message manually. Thank you!!

Files I generated. En is default language

en.json
{
"homePage_title": "Home page",
"homePage_slogan": "Slogan",

"topicPage_title": "Topic",
"topic_filter_recents": "Recents",
"topic_filter_favorites": "Favorites",
"reaction_feel": "Feel",
"homePage_testing": "testing",
"homePage_testing_2": "testing_2"

}

vi.json
{
"homePage_title": "",
"homePage_slogan": "",
"homePage_testing": "",
"homePage_testing_2": "",

"topicPage_title": "",
"topic_filter_recents": "",
"topic_filter_favorites": "",
"reaction_feel": ""
}

@akameco
Copy link
Owner

akameco commented Jun 14, 2017

Thank you for your PR :)
I think en.json should be overridden with defaultMessage.

en.json

{
	"hello": "world"
}

messages.js

import { defineMessages } from 'react-intl'

export default defineMessages({
  hello: {
    id: 'hello',
    defaultMessage: 'new message'
  },
})

Run extract-react-intl-messages

en.json

{
	"hello": "new message"
}

But your point is right.
I changed to object key sort after merging.

@akameco akameco closed this Jun 14, 2017
@hoantran-it
Copy link
Contributor Author

Great! Thank you :)

akameco added a commit that referenced this pull request Aug 8, 2019
Consider env values when parsing .babrlrc
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