Multiple Templates using same property file

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Multiple Templates using same property file

th_jakob
This post was updated on .
Hi,

I want to use Thymeleaf to localize the HTML of our Emails. Some of these Templates should use the same texts, which I want to store in a single set of .properties files.

So we have several Templates, say:
email1.html
email2.html
email3.html

Each of them has their own .properties files (this works, with "Template-based message resolution"):
email1_en.properties
email1_de.properties
...
email2_en.properties
email2_de.properties
...

Additionally all mails contain some common texts like:
th:text="#{footer.paragraph1}"

I don't wont to store these texts again in the email1_en.properties, email2_en.properties and so on.

But instead have one set of .properties files for common (but still localized) texts:
common_de.properties
common_en.properties

Which has the corresponding text:
footer.paragraph1: Some text...

For me this is exactly what should work with the "Origin-based message resolution" of the StandardMessageResolver (as described in the docs). Or shouldn't it? But I was not able to get it working.

Do you think my use case should work out of the box with Thymeleaf and "Origin-based message resolution"? If yes, could you elaborate where exactly the common_xx.properties file have to go? Maybe I just put them in the wrong place. (I don't really understand what "classes being used as origin" means in the documentation of the StandardMessageResolver.)

Edit: I found out that the StandardMessageResolver skips the whole Step 2 because origin is null.)

Thank you!
Jakob




Reply | Threaded
Open this post in threaded view
|

Re: Multiple Templates using same property file

Cesarvv
Reply | Threaded
Open this post in threaded view
|

Re: Multiple Templates using same property file

th_jakob
Thanks! I already saw that. As far as I understand this works only for unlocalized texts - so one text for all the languages.