Populating and Email Centre newsletter with multilingual subject line


#1

Hi… I’m working in the email centre, with translations on a per user basis. IE, send a french user an email in french!. I’ve been able to cover all aspects of the email, layout, template and widgets in multiple languages. But can’t figure out how to send the email with a translated subject line. Not the title of the html but the subject that appears in the recipients email client.

Any ideas appreciated?


#2

Can you update your question to include how you’ve made everything else translatable? It is not supported yet out of box so interesting to see how you’ve done it :). It might then give us a clue as to why the subject line is not getting translated too.


#3

Regarding the translations and the build of the emails… Ive had to do a little loading in the “layout” and “widgets” handlers. The first thing was to enable the Email Center preview screen allow for a real world example of an email for a user taken from the db. here it would be handy to assign website_user account to an administration account.

Effectively views/email/layout/newsleter/html.cfm runs a renderViewLet
renderViewlet(
event = “email.layout.newsletter”
, args = args
)

//handlers/email/layout/newsletter
private function index( event, rc, prc, args={} ) {

	rc.email       = rc.email ?: "emailaddress2someco.com" ;

	/*
	 * Get the recipients website user record
	 */
	var getContextPayload = EmailSendingContextService.getContextPayload() ;

	//define a struct for the website user
	args.website_user = getContextPayload.website_user   ?: {}  ;

            var inTestMode = ( !structKeyExists(args.website_user, "id") ) ;

            if(inTestMode) {
               args.website_user = `go and get the website_user record`
               `other stuff ...`
            } else {
              `other stuff ...`
            }

            // Languages and translation
	event.setLanguage( `users prefered translation` );

	args.title = `get a title based on the website users language`

	args.other_variables = `get  other data based on website_users language`

           return renderView( view = "email/layout/_html", args = args );

}

Widgets work in a similar fashion!

Using this method I am able to preview the emails in the Email Center with real subject matter and in multiple languages. (Accept the subject line of the email being sent out)

Let us know if you need more info.