Try Now
More in this section

Forums / Developing with Sitefinity / Add translation to a Dynamic Content item

Add translation to a Dynamic Content item

2 posts, 0 answered
  1. Daniel Plomp
    Daniel Plomp avatar
    952 posts
    18 Feb 2004
    29 Nov 2013
    Link to this post
    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?

  2. Anjeza Llapi
    Anjeza Llapi avatar
    10 posts
    04 Nov 2013
    03 Dec 2013
    Link to this post
    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);
    // 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.

    Anjeza Llapi
    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
2 posts, 0 answered