How to load messages to resource bundles from a database and bind strings via message keys to the view

Viewed 1163

Currently I'm developing a Java 8 / JavaEE 7 Web application using JSF 2 with Primefaces 6.

As a part of this project, I have to build a module to fetch translations (messages in German and English) from a database to get a dynamically translated application since hard coding Strings simply isn't an option.

After two days of reading stuff about ResourceBundles, ResourceBundle.Controls and ResourceBundleControlProvider I completely lost understanding of the whole matter.

I found many possible solutions that were about two to three years old, which were always completely different, which is why I came to ask my question here. I know that there are some posts here that describe some cases but I would be glad if someone could help me understand this matter.

Could anyone explain the usual workflow or state-of-the-art method to solve my problem and give an explanation of the important classes used for the solution?

1 Answers
Related