SetForumPostInfo sending emails using the incorrect culture

Lance Keay asked on December 19, 2015 13:32

We currently have 2 cultures on our site: en-US and es-ES. When using ForumPostInfoProvider.SetForumPostInfo(f) to save a post, the email going out to ALL subscribers is always in en-us.

It doesn't seem to matter if the sender or recipient have their preferred content culture as Spanish. It doesn't seem to matter if the sender is viewing the site in spanish or not.

My expectation is that the resource strings contained in the email template will be translated depending on the RECIPIENT's culture preference.

Recent Answers


Zachary Perry answered on December 21, 2015 15:29

What macros are you trying to resolve in the email template? The {%postsubject%} and {%posttext%} are based off the actual post.

Might be able to try adding |(resolver)subscriber to the macros.

0 votesVote for this answer Mark as a Correct answer

Lance Keay answered on December 24, 2015 19:06

Thanks for the help, but it doesn't have any effect. I think that (resolver) just delays the parsing of the macro, but what I need is that the email is sent in the correct language for the RECIPIENT.

Here's what we have:

  1. a forum that Users are subscribed to.
  2. an email template Forums.NewPost. Here's the plaintext version:

    {$global.email.text.newPost$}: {$global.email.text.forum$}: {%forumdisplayname%}
    {$global.email.text.subject$}: {%postsubject%}
    {$global.email.text.postedBy$}: {%postusername%}
    {$global.email.text.blogText$}: {%posttextplain%}
    {$global.email.text.viewForum$}: {%link%} {$global.email.toUnSubscribe$}: {%unsubscribelink%}

  3. a User whose preferred content culture is Spanish AND who is subscribed to the Forum to be updated.

  4. All the UI strings have been translated.
  5. using ForumPostInfoProvider.SetForumPostInfo(f) to save a post

Expectation

That the User subscribed will be sent an email with the Spanish versions of the UI strings.

Actual Result

The Spanish User receives an English email instead.

0 votesVote for this answer Mark as a Correct answer

Lance Keay answered on December 29, 2015 12:13

Hi Lance,

So as we thought... our developers has confirmed that this behavior is by design. Localization macros are always resolved according to the default culture.

Recipients culture is not taken into account. You can use the workaround mentioned in your first email.

On the other hand, if you want functionality like this available in the feature version of Kentico, you can suggest it and also other users will be able to vote for it (more users = higher priority), on the special page: http://kentico.uservoice.com/

Best regards,

Martin Danko Senior Support Engineer

0 votesVote for this answer Mark as a Correct answer

Zachary Perry answered on January 28, 2016 17:36

I have in the past created a custom macro that takes a resource string and userid, then resolves it using the user's preferred culture. Only works if the person getting the email is a user, and you can get the userID. then on that macro add the |(resolver)subscriber and it will resolve that custom macro when the email sends.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.