I recently had the problem of internationalizing a hybrid Java Web Start / Java Applet thick client Swing application. Java internationalization is typically done by using ResourceBundle to load a property file containing key to value map whose keys are the names of the messages to be looked up in the file and values are the corresponding value for the user’s language and location. However, the legacy application I was working with stores the language data in a database table, and the user can change the values at runtime, so precompiling property files into jar files that get sent to the client was not an option.
A simple solution to internationalize the client is to have it request a jar file containing the language property file and have the server build and send an appropriate jar file at runtime. The following is from a servlet class that builds a jar file dynamically with the English language, the United States location, and the package and name of the property file is: com.test.somepackage.my_messages_en_US.properties.
The getMessages method is responsible for building a list of key to value pairs and looks like this:
The client Java Applet or Java Web Start sends a request to the servlet by mapping the servlet to the location of the JAR file (that doesn’t exist). The above servlet code never actually saves the file to disk, it builds it in memory and sends it to the client each time the client requests it. After the server finishes sending the JAR file to the client, the client will finish loading and you can load the property file from a ResourceBundle in a static block in some class. That code is not shown here for brevity. An example that shows how to use resource bundles is here.

