Hi
I have a typical messages.properties file in my application. I am trying to create a letter using Freemarker.
The Freemarker template should generate before String , after which I will email the String user to the user. However, we need this multilingual. So Properties came to mind.
My properties file is as follows:
mail.layout.contactus=Contacteer ons mail.layout.greeting=Hoi
In Java, I inject a Properties file into my HashMap as follows:
rootMap.put("lang", (mail.getLanguage().equals(Language.FRENCH) ? langFR : langNL));
And try reading it in FreeMarker as follows:
<p>${lang.mail.layout.greeting} ${user.firstname},</p>
But get the following exception:
freemarker.core.InvalidReferenceException: Expression lang.mail is undefined on line 10, column 116 in layout/email.ftl.
Strange, he only says lang.mail , not lang.mail.layout.greeting
Edit: I tried to define my keys as follows:
mail_layout_contactus=Contacteer ons mail_layout_greeting=Hoi
which is working
source share