Re: Dyanamic properties in Struts2

2009-10-04 Thread Tommy Pham
 Original Message 
 From: Scott Smith ssm...@mainstreamdata.com
 To: Struts Users Mailing List user@struts.apache.org
 Sent: Fri, October 2, 2009 4:35:06 PM
 Subject: Dyanamic properties in Struts2
 
 Has anyone found a good way to do the following. 
 
 
 
 I have a menu on a web page.  The strings used to display menu items are
 in properties files and so the tags on the web page reference the menu
 property name instead of hard-coding the actual string .  Therefore, I
 can have an English version of the property file and a Spanish version
 of the property file and different users will see different language
 versions of the menu.  All that works fine.
 
 
 
 Now the customer wants to be able to change the translations of the
 strings on the fly.  It's easy enough to give them a web page that
 allows them to look at the various strings and type in a new/different
 Spanish version of an English string.  But writing that out to the
 property file doesn't cause Struts2 to reload the property file and so
 anyone looking at a web page will see the old translation and not the
 new translation.  
 
 
 
 I can see how to do this by doing a custom version of the struts tags
 that get the property values and completely re-implement the property
 support in struts/java.  But, it seems like there should be an easier
 way.  
 
 
 
 Is there a way to get at the properties class instances (for different
 languages) that are loaded into the jvm and change the values on the
 fly?  I'd like to piggyback on the existing java support for the java
 properties class (and maybe put the different properties out in a
 database instead of in property files).
 
 
 
 Does anyone have any suggestions?  

What about using DB backend for localization?  You'll have to make major 
changes in your code.  Once you have implemented DB backend, you can add/remove 
languages, or change the translations dynamically without having to deploy the 
new version of the app.  The changes to the language  translations can be done 
by anyone via the web UI with the proper privileges.

Regards,
Tommy


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Dyanamic properties in Struts2

2009-10-02 Thread Scott Smith
Has anyone found a good way to do the following. 

 

I have a menu on a web page.  The strings used to display menu items are
in properties files and so the tags on the web page reference the menu
property name instead of hard-coding the actual string .  Therefore, I
can have an English version of the property file and a Spanish version
of the property file and different users will see different language
versions of the menu.  All that works fine.

 

Now the customer wants to be able to change the translations of the
strings on the fly.  It's easy enough to give them a web page that
allows them to look at the various strings and type in a new/different
Spanish version of an English string.  But writing that out to the
property file doesn't cause Struts2 to reload the property file and so
anyone looking at a web page will see the old translation and not the
new translation.  

 

I can see how to do this by doing a custom version of the struts tags
that get the property values and completely re-implement the property
support in struts/java.  But, it seems like there should be an easier
way.  

 

Is there a way to get at the properties class instances (for different
languages) that are loaded into the jvm and change the values on the
fly?  I'd like to piggyback on the existing java support for the java
properties class (and maybe put the different properties out in a
database instead of in property files).

 

Does anyone have any suggestions?