I’m sending emails from EPiServer, and the email content is based on a language selection coming from the backend. As often the case in EPiServer implementations, I have a separate page for Email Settings and translations. I read the subjects, mail texts and other properties from the [CultureSpecific] properties.
How to do this programmatically? I found lengthy answers on the internet, but I want a short, quick answer. Here is how to get e.g. the Swedish translations:
var cultureInfo = CultureInfo.GetCultureInfo(“sv”);
var contentLoader = ServiceLocator.Current.GetInstance<IContentLoader>();
var emailSettingsPage = contentLoader.Get<EmailSettingsPage>(EmailPageReference.PageLink, cultureInfo);
var subject = emailSettingsPage.Subject ?? string.Empty;