Hi

I noticed that you set jcr:primaryType=mix:language. It should be
jcr:mixinTypes.

Also no need to set the jcr:primaryType=nt:file, it should be set
automatically. Setting it again explicitly might actually cause issues.

So just try posting

./jcr:mixinTypes=mix:language
./jcr:language=en

If that works in a separate request, you could try combining them into a
single request.

Regards
Julian

On Fri, 24 Apr 2020 at 03:47, Andrey Shulinsky <ashulin...@korio.ca> wrote:

> Hi folks,
>
> We're trying to use this bundle with the JSON file option:
>
> https://sling.apache.org/documentation/bundles/internationalization-support-i18n.html#json-file-based
>
> Have been having an issue we'd really appreciate help with.
>
>
> We'd like to add the language-specific bundles using the POST API.
>
>
> This is the structure from the doc mentioned above:
>    /libs/languages
>            +-- english.json (nt:file, mix:language)
>            |    +-- jcr:language = en
>            |    +-- jcr:content (nt:resource)
>            |         + jcr:data (containing the actual JSON file)
>
>
> When we do this request:
>
>
> --------------------------------
> POST http://localhost:8123/libs/languages HTTP/1.1
> Content-Type: multipart/form-data;
> boundary=-------------------------acebdf13572468
> User-Agent: Fiddler
> Host: localhost:8123
> Content-Length: 257
> Authorization: Basic YWRtaW46YWRtaW4=
>
> ---------------------------acebdf13572468
> Content-Disposition: form-data; name="english.json";
> filename="english.json"
> Content-Type: application/json
>
> {
>     "message1": "aaa",
>     "message2": "bbb"
> }
>
> ---------------------------acebdf13572468--
> --------------------------------
>
> We get a similar structure:
>
>    /libs/languages
>            +-- english.json (nt:file)
>            |    +-- jcr:content (nt:resource)
>            |         + jcr:data (containing the actual JSON file)
>
> And the messages1-2 are added properly.
>
> However it's lacking
> - the "mix:language" type on the english.json node
> - the jcr:language=en property on the english/json node
> Which are needed to get the proper language-specific content
>
> We have tried to modify the request above to add those properties,
> tried a separate request to add them:
>
> --------------------------------
> POST http://localhost:8123/libs/languages/english.json HTTP/1.1
> Content-Type: application/x-www-form-urlencoded
> User-Agent: Fiddler
> Host: localhost:8123
> Content-Length: 52
> Authorization: Basic YWRtaW46YWRtaW4=
>
> jcr:primaryType=nt:file&jcr:primaryType=mix:language
> --------------------------------
>
> But nothing has worked so far.
>
> So if anyone could do us a favor and advise how to add those
> properties that would be really helpful.
>
> Thanks in advance!
>
> Andrey.
>

Reply via email to