Add translation to a Dynamic Content item

Posted by Community Admin on 04-Aug-2018 16:52

Add translation to a Dynamic Content item

All Replies

Posted by Community Admin on 29-Nov-2013 00:00

Hi all,

What would be the best way to create a multilingual Dynamic Content Item through code? I have a source table with some records that have both english and dutch translation which I need to import into a Dynamic Module. Can I do this at once?

I know how to add an item with a default culture. But how do I add the second culture in the same procedure?

Thanks,
Daniel

Posted by Community Admin on 03-Dec-2013 00:00

Hello Daniel,

I am attaching an approach for adding multilingual to the modules that are not hierarchical (NewsRoomArticles, NewsRoomDocuments), refer to the attached (ModuleBuilderLanguageVersionCreator.zip).

The form uses the approach from how hierarchical data items are created from NewsRoomGallery sample

Thread.CurrentThread.CurrentUICulture = enCulture;
            DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager();
            Type testType = TypeResolutionService.ResolveType("Telerik.Sitefinity.DynamicTypes.Model.NewsroomContent.NewsroomArticle");
  
            //create the item in invarian culture
            DynamicContent testItem = dynamicModuleManager.CreateDataItem(testType);
            Guid itemId = testItem.Id;
  
            //assign its values in specific culture and publish
            using (new CultureRegion(enCulture))
            
                testItem.SetString("Title", "Some Title", enCulture);
                testItem.SetString("UrlName", "SomeUrlName", enCulture);
  
                testItem.SetWorkflowStatus(dynamicModuleManager.Provider.ApplicationName, "Published", enCulture);
                dynamicModuleManager.SaveChanges();
                dynamicModuleManager.Lifecycle.Publish(testItem);
                dynamicModuleManager.SaveChanges();
            
// perform the same for additional languages



I am also attaching a sample of Module Builder Language Version Creator.  Hopefully this helps.

Please feel free to write back to me if you need further assistance.

Regards,
Anjeza Llapi
Telerik

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Sitefinity Stanislav

[View:/cfs-file/__key/communityserver-discussions-components-files/296/d027811d_2D00_ddff_2D00_4540_2D00_8d9e_2D00_66ae632bedca_5F00_ModuleBuilderLanguageVersionCreator.zip:320:240]

[View:/cfs-file/__key/communityserver-discussions-components-files/296/248a78ce_2D00_ce26_2D00_4a16_2D00_a2ba_2D00_6f0a378aa357_5F00_ModuleBuilderLanguageVersionCreator.zip:320:240]

This thread is closed