To be able to create a translation of an existing node. We have a node in English, and we want to create a German translation. The user clicks "Create German Translation" and all the data is copied to a new de language version of that node.
Current Solution
Currently I am doing this on the client side, by making a PUT request to the node, with an updated language property, and otherwise copying all the existing values from the English version to the German version.
Issues
The following issues need to be solved:
The displayField value must be made unique. Currently I do: "My Node" -> "My Node (DE)"
The segmentField value must be made unique (if it is a string). Currently I do "foo" -> "foo_de" or for file name, "foo.html" -> "foo.de.html"
Binary fields must be handled. Currently this is impossible to easily do on the client side, and is the major reason why an API endpoint is needed. Update: It is possible to reference existing binary fields via the same sha512sum in the posted field.
Proposal
Create a endpoint /api/v1/projectName/nodes/<node_uuid>/translateTo/<language_code>
This endpoint should handle the above issues transparently - the client does not need to worry about these details. Additionally, and binary fields will be shared by the new translated version (until a new binary is uploaded for that translation).
Goal
To be able to create a translation of an existing node. We have a node in English, and we want to create a German translation. The user clicks "Create German Translation" and all the data is copied to a new de language version of that node.
Current Solution
Currently I am doing this on the client side, by making a PUT request to the node, with an updated language property, and otherwise copying all the existing values from the English version to the German version.
Issues
The following issues need to be solved:
Binary fields must be handled. Currently this is impossible to easily do on the client side, and is the major reason why an API endpoint is needed.Update: It is possible to reference existing binary fields via the same sha512sum in the posted field.Proposal
Create a endpoint
/api/v1/projectName/nodes/<node_uuid>/translateTo/<language_code>
This endpoint should handle the above issues transparently - the client does not need to worry about these details. Additionally, and binary fields will be shared by the new translated version (until a new binary is uploaded for that translation).