Today my dear colleague Max had the problem he wasn’t able to edit his newly created item in another language then the default one. So I helped poor old Max a little out by taking the creation of the item from him and supplying the item in all different languages to his delegate:
1 public delegate void ItemByLanguageEditor(Item item);
2
3 public void CreateItemFromMaster(string itemName, ID masterId, Item destination, ItemByLanguageEditor ible)
4 {
5 Assert.IsNotNullOrEmpty(itemName, “The parameter with the name ‘itemName’ cannot be null or empty”);
6 Assert.IsNotNull(masterId, “The parameter with the name ‘masterId’ cannot be null”);
7 Assert.IsNotNull(masterId, “The parameter with the name ‘destination’ cannot be null”);
8
9 Item newCreatedItem = Sitecore.Data.Managers.ItemManager.AddFromMaster(itemName, masterId, destination);
10 if(newCreatedItem != null)
11 {
12 foreach (Sitecore.Globalization.Language l in newCreatedItem.Languages)
13 {
14
15 Item langVersionOfItem = Sitecore.Context.ContentDatabase.GetItem(newCreatedItem.ID, l);
16 ible.Invoke(langVersionOfItem);
17
18 }
19 }
20 }
When you use this method make sure you are/have:
- in the right security context
- selectected the right active site(Sitecore.Context.SetActiveSite….)
- the destination item(his upcoming parent) is in the right database
A small improvement to think about, for my friends in Denmark, would be a method with the following stub
:
Item.GetByLanguage(Sitecore.Globalisation.Language lang):Item

Actually, it may be easier and more generic to do item.Database.GetItem(item.ID, language)
Yep you’re right! Going to fix that