[英]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.