I am using play 1.2.4. My application is running in several languages. I need to send emails to clients by an admin user. However, admin users language setting is fixed and I need to send emails to client in their preferred language. I am rendering email temlates with TemplateLoader but I could not find a way to render my templates with another language option?
Is there a way to render templates with a different language option?
Lang.set("language_code");should give you what you need.In normal templates, you can override the current browser defined language pack by using
or
You can read about it here.
Looking at the source code,
changewill modify the user’s cookie, which is no good for your use case, butsetchanges the language pack for the current thread, so this should give you exactly what you need.