I am using Pebble
to process mail content, and it works great,
usually I make it getting locale from environment variables:
@Autowired
private Environment env;
PebbleTemplate template = pebbleEngine.getTemplate(templateName);
Writer writer = new StringWriter();
template.evaluate(writer, templateVars, Locale.forLanguageTag(env.getProperty("system-prop.locale")));
String content = writer.toString();
<td>
{{ i18n("messages/mail", "welcome.words") }}
</td>
Now I've got some extraordinary templates that I would like to put both English and French messages at the same time,
does Pebble
provides any methods to manually designate locale like Handlebars.java
?
<td>
{{i18n "welcome.words" locale="en_US"}}<br />
{{i18n "welcome.words" locale="fr_FR"}}
</td>
Currently, it is not supported. It always use the locale from the spring context. I suggest that you provide a custom function and use it for your need.