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 :)
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.
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?
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.
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.
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
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.
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?
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?
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.
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.
So instead of this:
If have to do this?
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.
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:
Thanks again :)
is working on a reply...