[英]Sitecore: Problems in accessing an Item in a particular language
我在sitecore中有一个ID为' {05B1C498-39D1-40D6-B454-2A3277A6DDF9}
'的项目,该语言的“ en
”具有一种语言版本,而“ da-DK
”具有一种语言版本。
对于此项目,存在一个带有text
类型的“ Test
”字段,在英语版本中,我已在该字段中保存了“ English Text”。 对于以上项目的丹麦语版本,我已经在“ Test
”字段中保存了“丹麦语文本”。
我想用丹麦语获得上述物品。 我使用以下代码:
string dicItemId= "{05B1C498-39D1-40D6-B454-2A3277A6DDF9}"
Item dictionaryItem = Context.Database.GetItem(dicItemId, Sitecore.Data.Managers.LanguageManager.GetLanguage("da-DK"));
lblTest.Text = dictionaryItem["Test"];
我希望上面的标签看到字符串“ Danish Text”。 但是以某种方式不能获得丹麦语版本和输出的是“英文文本”。
我还尝试使用上述语言在Sitecore中不存在的语言来获取上述项目的版本,我尝试使用:
Item dictionaryItem = Context.Database.GetItem(dicItemId, Sitecore.Data.Managers.LanguageManager.GetLanguage("nl-NL"));
我期望dictionaryItem
为null
但仍包含ID为' {05B1C498-39D1-40D6-B454-2A3277A6DDF9}
的项目
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.