-
Notifications
You must be signed in to change notification settings - Fork 6
Description
When working with localization it's often the case to have the same structure for multiple objects which you want to 'merge' when exposing to a third party. For example object 'attribute' and object 'classification' both have a code but the name is localized.
Attribute object:
{
"attributeCode": "unique_attribute_code",
"localizedAttributes": {
"en": {
"attributeName": "HP",
"formattedValue": "100 HP"
},
"de": {
"attributeName": "PS",
"formattedValue": "100 PS"
}
}
}Template object:
content: {
classificationCode: { dataKey: 'classification.code' },
attributeCode: { dataKey: 'code' },
localizedAttributes: {
dataKey: 'localizedAttributes',
content: {
nl: {
dataKey: 'nl',
content: {
classificationName: { dataKey: 'Cant get classification.localizedAttributes.nl.name' },
attributeName: { dataKey: 'name' }
}
},
fr: {
dataKey: 'fr',
content: {
classificationName: { dataKey: 'Cant get classification.localizedAttributes.fr.name' },
attributeName: { dataKey: 'name' }
}
}
}
}
}As you can see in the template I can set the attribute code and go deeper on the object for the classification code. But for the localizedAttributes I can't use classification.localizedAttributes.nl.name for example. And I can only climb up one parent with the source parameter.
It would be great to extend the source parameter to chain parents here. For example:
content: {
classificationName: { dataKey: 'name', source: 'parent.parent.classification.localizedAttributes.nl' },
attributeName: { dataKey: 'name' }
}This way it's possible to go deeper and higher with ease and gives so much flexibility for building custom views.