SaaS CMS has officially launched! Learn more now.

Programmatically creating pages in multiple languages


Hello all.

I wrote a scheduled job that creates and updates pages from an external data source.  Until now, only "en"/default lanugage content was needed.  I need to support additional languages now, and am having trouble finding recent samples or documentation on how to accomplish this.

Any help would be much appreciated!

Thanks, -Kevin

Jun 17, 2024 17:32

Hi Kevin

IContentRepository's CreateLanguageBranch method is what you need. I've included a sample code snippet for your reference.

        var auLang = _contentRepository.CreateLanguageBranch<ContentPage>(currentPage.ContentLink, 
            new LanguageSelector("en-AU"));
        auLang.Name = "AU branch";
Jun 18, 2024 2:21
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.