Groovy Script to create translated Folder

Hey there,

I am running into problems while creating an update script to create a folder in multiple channels. It should be the same folder in every channel and should be translateable. As far as I understand the folder needs a unique “hippotranslation:id” is there a way to obtain one?

Best wishes,

A translation id is a uuid, though I suspect that it isn’t important that it is a uuid. In any case, I think it should work to put any uuid in there. Nodes that are translations of each other have the same id. So give all folders that are translations of each other the same id.

Thank you, I thought there maybe is an build in way to obtain one.

You can probably dig to find a workflow that gives you a translation id, but you can also just set it by hand in the console. Like I said, I don’t think it matters that it is a uuid, but just use that as it follows the pattern and is also almost certainly unique.

1 Like

This isn’t something I’ve tried before but perhaps this method handles translation:id generation?

Here’s an example of it’s usage with some working on the translation:id

Of course, Jasper answer should also suffice but if you can get the translation:id generated automatically with a UUID, your solution would be cleaner.

Hey there, thanks for this. I have to test your solution. I fixed and tested my script and everything seems to work fine I used:

private static final String   TRANSLATION_ID          = UUID.randomUUID().toString()

To get a matching and valid UUID for all newly created folders.

Best wishes,

Hey Doenut, thanks for sharing your solution. I think that is a decent enough solution :slight_smile: