Programmatically creating pages in multiple languages

Vote:
 

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

#323694
Jun 17, 2024 17:32
Vote:
 

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";
        _contentRepository.Save(auLang);
#323733
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.