В настоящее время при использовании babel-plugin-react-intl
для каждого компонента создается отдельный json с идентификатором, описанием и defaultMessage. Мне нужно создать только один json, который содержит один объект со всеми идентификаторами в качестве ключа и defaultMessage в качестве значения.
Текущая ситуация:
ComponentA.json
[
{
"id": "addEmoticonA",
"description": "Add emoticon",
"defaultMessage": "Insert Emoticon"
},
{
"id": "addPhotoA",
"description": "Add photo",
"defaultMessage": "Insert photo"
}
]
ComponentB.json
[
{
"id": "addEmoticonB",
"description": "Add emoji",
"defaultMessage": "Insert Emoji"
},
{
"id": "addPhotoB",
"description": "Add picture",
"defaultMessage": "Insert picture"
}
]
Что мне нужно для перевода.
final.json
{
"addEmoticonA": "Insert Emoticon",
"addPhotoA": "Insert photo",
"addEmoticonB": "Insert Emoji",
"addPhotoB": "Insert picture"
}
Есть ли способ выполнить эту задачу? Может быть, с помощью скрипта Python или чего-нибудь еще. т.е. сделать один файл json из разных файлов json. Или напрямую создать один файл json с помощью babel-plugin-react-intl