...
The configuration will look like this:
...
How it works:
The “language” node will contain the language as per the JSON path and the '#' placeholder.
#
is replaced by the source or target language codes
...
in the Wordbee project.
The JSON path selects all array elements by language.
...
It uses a JSON path condition
...
:
[?( … condition …)]
It checks that the product object has a “translate” property with value “yes”: @.language == '#'
.
When the filter looks for the English content, it selects the array elements using
[?(@.language ==
...
‘en-US')]
- assuming that this is the file’s source language.Translations are inserted back by cloning each source array elements.
Important (!!):
You also need to add “language” to the list of “Translate nodes”. Otherwise, the system will not localize the language-nodes and save back the target locales.
If you tick the option to translate all child nodes then you do not think about this detail.
Example 4 - Translate array elements with language indicator, no 2
...
The configuration now is $.products[….]
. The array elements are indeed located under the products
property. With JSON paths, the $
sign is the root of the document and writing $.products
locates the product node at the root. We further instructed to only translate the “text” properties but not any of the other ones.
...
Important (!!):
You also need to add “language” to the list of “Translate nodes”.
...
Otherwise, the system will not localize the language-nodes and save back the target locales.
If you tick the option to translate all child nodes then you do not think about this detail.
Info |
---|
When the system inserts back the translations, it will clone the source language node or array element for each target language. If the target objects/elements already exist fully or partially in the source file, the system will keep any existing properties and replace only those that we are translating. |
...