In my website every item exist in English version. Now if a user with Content Language ='Danish' wants to access an item which does not exist in 'Danish' language. The users actually see nothing, what I want to do is that if the item does not exist in desired language then get the English version of it.
I am doing this to achieve my goal:
string itemId = "{05B1C498-39D1-40D6-B454-2A3277A6DDF9}";
Item versionItem = Sitecore.Context.Database.GetItem(itemId);
if (versionItem.Versions.Count > 0)
lblOutput.Text = "Item does not exist in desired language";
else
{
versionItem = contextDatabase.GetItem(itemId, Sitecore.Data.Managers.LanguageManager.GetLanguage("en"));
lblOutput.Text = "Here is the item in default English language";
}
Is it the right way to achieve what I want? because my concern is that then I have to use this code to access every item. Is there any global settings or some thing like this so that I can get the item in 'English' language if it is not exist in desired language.