Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi, i just installed the multilingual tools, created a property editor for the ActionBar and added it to my document type. Selecting the translations nodes in the content section works without problems but i cannot figure out how to get the selected values in code:
// using models builder
var translations = Model.Content.Translations;
// accessing property directly
var translations2 = Model.Content.GetPropertyValue("translations");
But the variable translations (translations2) is always empty.
What am i doing wrong?
Can you have a look at /App_Data/umbraco.config file - "translations" field, does it store some info?
Unfortunately the linked translations aren't accessible as property value (yet). The purpose of the actionbar is to allow you to switch languages in the backoffice only.
We do, however, have plans to extend the package to make this data available as property value in the near future.
Thanks Alex and Martijn for your feedback!
I really need access to the linked language nodes via the property value, so i'm looking forward for the update :)
The translations are stored as Umbraco Relations so I am assuming we can fetch them with the Relations API?
That is correct however gathering information about multiple related nodes via the relations API is a bit tricky. The easiest way is probably to call the "Gettranslations" stored procedure and supply the correct relationTypeId and the nodeId you want to get translations for.
As I said the related nodes aren't available via property value yet.
Any news on the package extension?
Or maybe we can see the source and perhaps contribute?
A new package version has just been published. It now allows you to see related nodes via the actionbar property. I did not have enough time to automatically update all actionbar properties so it will only work for newly created translations or when updating translations on a node.
Can you provide some more information how to do this?
The following code is always empty:
var translations2 = Model.Content.GetPropertyValue<ActionBar>("translations");
Have you looked into the value stored in the umbraco.config? You can find it in ~/App_Data/umbraco.config. The actionbar value should be set there if you have the latest version of the package. If it's not, try to republish.
I'm not sure if converting to the actionbar object works.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted