I want to split the following, nested dictionary into different dictionaries by language AND create a new JSON-File/Dictionary for each language.
Afterwards I would like to merge them back together.
Grateful for any suggestions how to continue!
Example:
{
"All": {
"label_es_ES": "Todo",
"label_it_IT": "Tutto",
"label_en_EN": "All",
"label_fr_FR": "Tout"
},
"Searchprofile": {
"label_es_ES": "Perfil de búsqueda",
"label_it_IT": "Profilo di ricerca",
"label_en_EN": "Search profile",
"label_fr_FR": "Profil de recherche"
},
What I got so far:
import json
store_file = open( 'test.txt' , "w" )
with open('translations.json') as json_file:
data = json.load(json_file)
for label, translations in data.items():
for key in translations:
if key==('label_en_EN'):
json.dump(???, store_file)
.....'''