I've been trying to learn and understand react-intl
library and I encountered babel-plugin-react-intl
library. There is a description in the library's page like that;
Extracts string messages for translation from modules that use React Intl.
I wonder that which string messages would be extracted?
Also, what are the benefits of extracted messages?
From: https://blog.johnphoto.se/2016/03/21/react-intl-v2/ (couldn't comment without more rep)
Once it is time to get all these messages translated, you only have to do a webpack build with the babel-plugin react-intl plugin. This will extract all the defined messages from the code base into JSON files. These files are then sent to your translators and they translate all of these messages and the translations is put into a flat JSON hash and this is then loaded into your code and you have a i18n enabled app. So enough with theory!
I am using babel-plugin-react-intl to automatically extract all the labels in my React application. I'd point as main advantages the following two:
Extra: I am not using, but, if you want to force developers to add a context description for each label, this plugin also has an option to force this behavior so that, if the developer forgets it, an error is thrown on webpack.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.