I have items created in various languages in sitecore. I need to fetch the list of languages in which that item is created. Example: If available languages in sitecore are : en,de,fr,it,en-GB. But the item is created in only en and de, i need to have list of languages as en and de. can someone provide me the piece of code for obtaining that.
Thanks
Item class has a property called Languages which returns list of languages that the item has content in.
Sitecore.Globalization.Language[] langs = item.Languages;
and if you need just string list with names of the languages you can use:
List<string> langNames = item.Languages.Select(l => l.Name).ToList();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With