Translate Content Fragment's JSON Properties With MS Machine Translation
Hello,
I'm currently working on a requirement for which translation of content fragments is required. The setup is pretty straight forward and translating the content fragments with Microsoft Machine Translation works basically. However, for some custom multi-fields with complex structure, the translation is not working due to the fact that the field values are stored as an array of JSON data. Translation is applied to the whole content of the JSON, also the keys and quotes are translated. The resulting content is not valid JSON anymore and the content fragment editor is therefor broken.
For example, the translation of the following content in French is displayed below with the wrong values.
{
"data": {
"articleByPath": {
"item": {
"_path": "/content/dam/wknd/en/magazine/sample-article",
"main": {
"json": [
{
"nodeType": "paragraph",
"content": [
{
"nodeType": "text",
"value": "This is a paragraph that includes "
},
{
"nodeType": "text",
"value": "important",
"format": {
"variants": [
"bold"
]
}
},
{
"nodeType": "text",
"value": " content. "
}
]
}
]
}
}
}
}
}
Translation Result FR
{
« données » : {
« articleByPath » : {
« item » : {
« _path » : « /content/dam/wknd/en/magazine/sample-article »,
« main » : {
« json » : [
{
« nodeType » : « paragraphe »,
« contenu » : [
{
« nodeType » : « texte »,
« value » : « Il s’agit d’un paragraphe qui inclut »
},
{
« nodeType » : « texte »,
« value » : « important »,
« format » : {
« variantes » : [
« Audacieux »
]
}
},
{
« nodeType » : « texte »,
« value » : " contenu. »
}
]
}
]
}
}
}
}
}
How is this issue to be fixed? Is there any configuration in AEM to properly handle JSON input in the translation? There was not appropriated option to use in the translation_rules.xml. Is this something to handle by the translator?
Any Input is highly appreciated.