Interpreting Struts2 Using a Database

We have a fairly large application with a lot of dynamic content. Is there a way to force struts to use the database to search for i18n instead of property files?

I would be open to other ways to solve this problem if anyone ever made i18n with dynamic content.

+5
source share
4 answers

I don’t know about the easy plug-and-play solution for this, so you probably have to implement it yourself - plan to spend a lot of time just by going over how the localization functions of struts 2 (and XWork) are. The key will probably be to provide your own implementation of com.opensymphony.xwork2.TextProvider (and say that struts use it, bean> tag in struts.xml). I can come up with at least two ways to fit this into a common architecture:

  • Ask your TextProvider implementation to directly access the database. In the spirit of YAGNI, this is probably the best way to get started (you can always reorganize later if necessary).

  • Java ResourceBundle, XWork, , , , .

+4

, Struts2 . .

? , , ..?

+2

, - , . . , , i18n , - i18n . , , , - , .

. , ( ) : http://ddubbya.blogspot.com/2011/01/creating-custom-struts2-interceptors.html.

0

, , , ..

, , . , , , . , , , , .

, , . - , .

...
PRIMARY KEY  (`subject_id`,`language_id`),
...
-1
source

All Articles