Skip to content

Creating a Multilingual Item

sergeyshushlyapin edited this page Nov 6, 2014 · 2 revisions

You can create a version of an item in a language:

[Fact]
public void HowToCreateMultilingualItem()
{
  using (Sitecore.FakeDb.Db db = new Sitecore.FakeDb.Db
    {
      new Sitecore.FakeDb.DbItem("home")
        {
          new Sitecore.FakeDb.DbField("Title")
            {
              { "en", "Hello!" },
              { "da", "Hej!" }
            }
        }
    })
  {
    Sitecore.Data.Items.Item homeEn =
      db.GetItem("/sitecore/content/home", "en");
    Xunit.Assert.Equal("Hello!", homeEn["Title"]);

    Sitecore.Data.Items.Item homeDa =
      db.GetItem("/sitecore/content/home", "da");
    Xunit.Assert.Equal("Hej!", homeDa["Title"]);
  }
}
You can’t perform that action at this time.