Easy way to check if the item is translated or not?

Dec 17, 2014 at 12:07 PM
Hi

I would like to show some kind of icon next to each item in my template that shows for which pages it still needs to be translated

My idea was to check if one item a field was unlinked that would mean it was translated

is there a call to do this?

so i would do a call to check if one field of that entity is unlinked and if so no no icons because its translated, if no item in that entitity unlinked than i show an image for the language

How could I do this?

Armand
Coordinator
Dec 17, 2014 at 12:10 PM
I can't give you the full answer because that would take me some time to figure out. but here's how you do it:

This requires the complex data model. So cast something to AsEntity(...) and from there on, browse through the object model (best to use Visual Studio in break-mode).


Pseudocode:
var x = AsEntity(Content.Title);

x.Values[0].AssignedLanguages... // or something...
Developer
Dec 18, 2014 at 8:20 AM
Please try somethink like this:
var entity = AsEntity(Content);
var firstNameIsTranslatedToFrench = entity["FirstName"].Values.Any(v => v.Languages.Any(l => l.Key.ToLower() == "fr-fr"));
This will get the values for FirstName and see if there is any value in the language fr-FR.