AI OnAI Off
Maybe you could create a custom settings page for storing the email text. The page could be translated to different languages.
In your custom email actor, get the correct language version and send the email?
Hi,
If you wanted to make the whole actor language specific, you can do the equivalent of ticking the culture specific box in admin programmatically in an initialisation module like this:
[InitializableModule]
[ModuleDependency(typeof(EPiServer.Web.InitializationModule))]
public class FormsInitialisation : IInitializableModule
{
public void Initialize(InitializationEngine context)
{
var typeRepo = ServiceLocator.Current.GetInstance<IContentTypeRepository>();
var formContainerType = typeRepo.Load("FormContainerBlock");
var pdr = ServiceLocator.Current.GetInstance<IPropertyDefinitionRepository>();
var def = formContainerType.PropertyDefinitions.FirstOrDefault(d => d.Name.Equals("CustomSendEmailAfterSubmissionActor"));
if (def != null)
{
var clone = def.CreateWritableClone();
clone.LanguageSpecific = true;
pdr.Save(clone);
}
}
public void Uninitialize(InitializationEngine context)
{
}
}
Alternatively, assuming your custom actor has a custom model, you could add an additional property to that model to allow you to define a language then modify your actor to only send emails with a language that matches the current language. That would make it easier to see at a glance which languages have emails defined.
Hello everyone,
Though this is my first post here, I've used for some time most of the things found on this forum.
I have a simple question for maybe most of you but somehow tricky for me - I have implemented a custom SendEmailAfterSubmissionActor which is doing what is supposed to do, so no problem so far - the only thing is that I would like to know how can I make the emails specified in the admin interface to be culture specific - yes, I'm aware about the admin part where I can set the culture specific checkbox, but I would like to make through code. I found some vague information that this can be done through an initialization module, but not too much details - is there someone who can guide me a bit please?
Thank you.