Question

Is there any way to load properties from database with i18n standards.?

In existing method,

  • it loads properties from properties files.
  • html entities are escaped by default.
  • if I want to change a property, I need to restart the server every time for the changes to reflect.
Was it helpful?

Solution

You can set text using data from the database instead of properties files. Before you do that, however, consider the drawbacks:

  • You have to write the code to retrieve each value from a database, because the value is not known at compile time.

  • You do not know if you missed any of the properties, because the properties are not compiled. If you did miss a property, your users will not any text for it.

  • Your app will have to make many more calls to the server in order to display each view, which can dramatically slow down your app. You can partially mitigate this by using JSP to dynamically generate key-value pairs using dynamic string i18n, but the load time will still be slower than with static i18n.

This is why I have never seen this done.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top