Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Puck Holshuijsen 151 posts 602 karma points
    1 week ago
    Puck Holshuijsen
    0

    Weird culture issue with order confirmation

    Hi Matt,

    Got a weird issue which I can't figure out.

    A Dutch customer is using the dutch language on the site (has 3 languages - dutch, english and german). The customer ordered some products, and got the confirmation email (my own template with text from the dictionary).

    The subject of the email is in Dutch, but the rest of the mail is in English. And I can't figure out why or how. Was hoping you would know what's happing :)

    Thanks!

    Puck

    enter image description here

  • Matt Brailsford 3961 posts 21149 karma points MVP 9x c-trib
    1 week ago
    Matt Brailsford
    0

    Hi Puck,

    What does your order confirmation email look like? This appears to be based on the OOTB template which is hard coded english so unless you've updated the template to take into account the current threads culture, this is likely the reason why.

  • Puck Holshuijsen 151 posts 602 karma points
    1 week ago
    Puck Holshuijsen
    0

    Hi Matt,

    It is a copy of your OOTB template which uses the dictonary to get the values instead of hard coded english :)

    Is there a way to override the order confirmation email process? That way I can use the SendEmail from the VendrApi and pass in the Culture. Or is there some other way?

  • Matt Brailsford 3961 posts 21149 karma points MVP 9x c-trib
    1 week ago
    Matt Brailsford
    0

    The culture should be extracted from the orders language, so it should be passed the correct culture.

    I can't recall how the dictionary API grabs the culture though. Have you debugged the templates to see what culture they think they are running in?

  • Puck Holshuijsen 151 posts 602 karma points
    1 week ago
    Puck Holshuijsen
    0

    Locally I haven't had this issue, only in production unfortunately. Although, my local pc is set to Dutch.

    I will try and see if I can get the culture from the order and maybe set the Current thread culture that way. I will let you know if I find something.

  • Matt Brailsford 3961 posts 21149 karma points MVP 9x c-trib
    1 week ago
    Matt Brailsford
    0

    Hmm, ok so looking through the code, I think you might have to setup view paths for the different cultures.

    The view path for a template can be a dictionary key, it will then lookup the path for the given culture and use that. But if it can't find one, it falls back to english, and sends english as the current threads culture.

    Maybe try setting the view path to the same value for all cultures, this should make them all use the same template, but make sure the template is run within a cultural context of the correct culture.

  • Puck Holshuijsen 151 posts 602 karma points
    1 week ago
    Puck Holshuijsen
    0

    So instead of this:

    enter image description here

    If have to do this?

    enter image description here enter image description here

  • Matt Brailsford 3961 posts 21149 karma points MVP 9x c-trib
    1 week ago
    Matt Brailsford
    0

    Yea, I believe so.

    It looks like we designed it such that each culture would potentially have it's own template, but you can point it to the same path and it'll pass the relevant culture and use that to look up dictionary keys.

  • Puck Holshuijsen 151 posts 602 karma points
    1 week ago
    Puck Holshuijsen
    1

    Okay, I fixed it! It still came in dutch (from my local pc) - even after the dictionary item.

    Only way to fix this was adding this line of code to the template:

    CultureInfo.CurrentCulture = new CultureInfo(Model.LanguageIsoCode);
    

    Thanks again :)

Please Sign in or register to post replies

Write your reply to:

Draft