React Intl, How to compile multiple language files in at a time?

1.7k views Asked by At

According to Format.js docs, I can extract all messages from the source codes using flowing commands.

yarn extract 'src/**/*.js*' --out-file lang/en.json --id-interpolation-pattern '[sha512:contenthash:base64:6]'

It's working fine but when I go to compile this lang files I can only compile a single file at a time using the following command. Docs link

yarn compile lang/fr.json --ast --out-file compiled-lang/fr.json

If I have multiple language files like:es.json,fr.json,ga.json,bn.json then I have to run this command four times but I wanna run this command only one time and it will compile all JSON file inside the lang folder.

Is there any way to do it?

1

There are 1 answers

0
Long Ho On

You're looking for compile-folder command from the CLI https://formatjs.io/docs/tooling/cli#folder-compilation