I would like to know if this is possible in java that i want to reload a swing app so that i can set locale. Im working on a swing app project where more than 5 languages used and i have already created property file for each language. Whenever user selects a new language from menu my app has to restart to change the selected language. Im totally stuck here as how to restart my swing app with my loaded vm arguments and new language.
For reference here is the website which has the same requirement as what i expect. http://teravoice.com/
After web-page loads select a link which download a jnlp and once app opens, please login with any name and in the file menu you find a sub menu "language" with 12 languages. when i click on a new language the app restarts itself with the new language and with user data (i.e. vm options).
Thank you.
that's simple possible two ways by using ResourceBundle and Locale
1) take Locale
from Native OS Locale.getDefault()
ResourceBundle rb = ResourceBundle.getBundle(
"com.MyPackage.Properties", Locale.getDefault());
frameTitle = (rb.getString("MyFrame.Title")); //myFrame.setTitle("frameTitle");
trayTitle = (rb.getString("MyFrame.TrayTitle"));
exitTitle = (rb.getString("MyFrame.Exit"));
newInfoTitle = (rb.getString("MyFrame.NewInfo"));
sendTitle = (rb.getString("MyFrame.Send"));
2) set Locale on Runtime, f.e by selecting Item
in the JComboBox, then you have to refresh (better would be to create separated method, void or class) all JComponents or methods, all changes must be done on Event Dispatch Thread
3) some examples about I18
4) I'm IDE user and for Locale I use built-in editor for properties File,