E-Mail Localization
Posted: Thu Feb 10, 2011 12:21 pm
I am finishing up localizing AbleCommerce for a client and I just got to the e-mail templates. I am using <asp:localize> tags for the website and I am storing my language data in resx files.
Now what I am trying to figure out is how to access those resx files inside of the e-mail templates using nvelocity. When a user checks out I store their two character language as a order note and then call that in the e-mail to get their language.
How can I call from a specific xml file and read back a line?
** EDIT**
Ok. I found some code that works that I tested on the admin sendmail page but I need to know how to get it to work with e-mails not sent manually.
What I did was create a class that takes 2 inputs (entry and culture). If I have CameraDescription in my resx file I call $lang.GetItem("CameraDescription",$locale) from my e-mail template and add a parameter in the SendEmail.ascx.cs file that uses the resource helper class as the object.
Any Ideas on how to get this to work on automated e-mails? I can get access to the source code if needed, but I would rather not touch it.
Now what I am trying to figure out is how to access those resx files inside of the e-mail templates using nvelocity. When a user checks out I store their two character language as a order note and then call that in the e-mail to get their language.
Code: Select all
#foreach ($note in $order.notes)
#if ($note.Comment.Contains("Language"))
#set ($locale = $note.Comment.Replace("Language,",""))
#end
#end
#if ($locale == "fr")
oui
#elseif ($locale == "en")
Yes
#end
** EDIT**
Ok. I found some code that works that I tested on the admin sendmail page but I need to know how to get it to work with e-mails not sent manually.
What I did was create a class that takes 2 inputs (entry and culture). If I have CameraDescription in my resx file I call $lang.GetItem("CameraDescription",$locale) from my e-mail template and add a parameter in the SendEmail.ascx.cs file that uses the resource helper class as the object.
Any Ideas on how to get this to work on automated e-mails? I can get access to the source code if needed, but I would rather not touch it.