0

我正在以编程方式将版本添加到 sitecore 数据库。该项目正在工作流程中。一切都很好,但我的项目在工作流程中带有英语和丹麦语版本。我想摆脱丹麦版本或避免首先创建它。这是我的代码片段

var database = Sitecore.Configuration.Factory.GetDatabase("master");
Sitecore.Data.Items.Item itm = database.GetItem(Constants.Sitecore.CommonPages.JOB_LISTINGS);

using (new Sitecore.SecurityModel.SecurityDisabler())
{
    TemplateItem itemTemplate = database.GetItem(Constants.Sitecore.Templates.JOB);


    Item scInnerItem = itm.Add(ItemUtil.ProposeValidItemName(string.Format("{0} {1}", jb.JobId, jb.PositionTitle.RemoveSpecialCharacters())), itemTemplate);
    Job scJob = new Job(scInnerItem);

    using (new EditContext(scInnerItem))
        scJob.GetJobFromUserJob(jb);

    return (IBaseSitecoreItem)scJob;
}
4

2 回答 2

0

Danish is indeed installed by default, but it should not be bugging/annoying you while pragmatically adding items. Here are two things to check:

1)What is the default language of your site, check node in web.config
2)Does the Job template have any standard values, and are they by any chance in Danish?

于 2013-01-18T13:12:16.567 回答
0

我可以想到一些事情: 使用 LanguageSwitcher 临时更改代码中的上下文语言。所以改成英文。

当您检索存储新项目的父项目时,您必须已经切换了语言。不知何故,加载父项时的上下文语言将定义新创建版本的语言。

希望有帮助!

于 2013-01-23T18:11:58.317 回答