Hi folks,
In my application I have multiple category entries stored in a database
table named "categories".
For each entry, I have a name and a description field.
I want to internationalize the application with struts and have
identified two possible approaches.
1) Set up a resource bundle which contains keys which are the same
as the database entries
for name and description and use the <bean:message key. > tag to display
the correct name.
For example, say I have two category entries:
Name: fish
Description: fishdesc
Name: dogs
Description: dogsdesc
Now in my resource bundle I can put:
fish=fish
fishdesc=this category is for fishes
dogs=dogs
dogsdesc=this category is for dogs
And so, in my jsp I could hopefully use the <bean:message
key=<value of database field> />
to display the correct thing. Adding a new language should
be simple here.
2) I could also do this completely in the database, by creating a
language mapping table
For example
------------------- -------------------
| Category | | CategoryI8ln |
-------------------- 1__________* --------------------
| PK | | Name
|
------------------- |
Description |
| Language
|
---------------------
I would really like anyone's experience with trying to
internationalize data that is stored in
the database that won't change that often using struts. Do
you think option 1 or 2 is better,
or do you have a different solution?
The advantages of solution 1 over solution 2 as I see them
are:
Simple database structure
No need to have the database set up for UTF-8
The disadvantages of solution 1 over solution 2 as I see
them are:
Replication of the information in the database
Can't add a new category on the fly
Any comments, suggestions would be much appreciated.
Thanks,
Brian