This cli-tool helps us to create a dictionary for the translation library React-Intl
After we have replaced all plain text with translation components in our React app, we need dictionaries which we will translate into different languages.
- You specify your React project folder and the application recursively scans all files in it.
- We are looking for all the components for translation and collect the default id and message from there:
<FormattedMessage id="common.find" defaultMessage="find"/>
- from this data we collect a dictionary and store it in the json-file
{
"common.find": "find"
}
flag | description | default |
---|---|---|
-s | project source directory | - |
-o | output dictionary file name | dictionary.json |
./dict-itl -s "./src" -o "dictionary.json"