0

JSON file - reconstruction of final file failed.

Problem:

user is having problem reconstructing the JSON file into final translated file.

His file was containing "text" nodes which looked like this:

In his parser configuration he had in the list of Translatable json attribute (xpath expression) xptah like this:

//text

to handle those nodes.

File was properly parsed and all strings were correctly imported into Wordbee Editor for translation but after translation it was impossible to produce final JSON file.

Solution:

Main thing here is that xpath //text should slightly changed to //text/*


That difference really has an importance.


In the first case "//text/", the system is thinking that the "text" node is either a string, a number or a boolean, and is expecting this node to look like this : 




But it isn't the case since the node "text" is here an object and contains plenty of subnodes :



And each of these subnodes are handled using the star /* in the configuration. It simply means that all strings, numbers or booleans within the text node will be handled.

Moreover, when marking JSON file for online translation first, Wordbee is converting the JSON file into an XML which allows to use XPATHS. And the opposite is happening when creating a delivery. Hence it is easier to parse than to reconstruct a document. That is why it was possible to see all segments properly, but not to reconstruct them. 

Wordbee is now throwing the error because simply cannot replace a JSON object (here, it is "text" that is an object) to a string, a number or a boolean.

0 comments

Please sign in to leave a comment.