my main problem which I am trying to solve is to generate JSON files from React source code.
currently I am using for translations react-intl universal package which is working in my App https://github.com/alibaba/react-intl-universal
To solve my main problem I have found this package (I have found only this one, so, if you recommend me something else, i will be glad)
https://github.com/GertjanReynaert/react-intl-translations-manager
As is in guide i have created translationRunner.js (which is in src folder)
const manageTranslations = require('react-intl-translations-manager').default;
manageTranslations({
messagesDirectory: 'src/translations/extractedMessages',
translationsDirectory: 'src/translations/locales/',
languages: ['nl'] // any language you need
});
in my package.json added
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"manage:translations": "node ./translationRunner.js"
in render method i have something like
<h1>{intl.get('APPBARTITLE')}</h1>
if i run translationRunner.js I obtain nl.json which looks like
{
}
How to obtains json file with my message?