GWT typically loads i18n lines using this interface:
public interface StatusMessage extends Messages { String error(String username); : }
which then loads the actual lines from the StatusMessage.property file:
error=User: {0} does not have access to resource
This is a great solution, however my client cannot claim to put i18n strings in the database so that they can be changed at runtime (although this is not a requirement that they be changed in real time).
One solution is to create an asynchronization service that accepts the message identifier and user locale and returns a string. I implemented this and find it terribly ugly (it introduces a huge amount of additional communication with the server, and also makes replacing the placeholder replacement quite difficult).
So my question is whether it is possible in some good way to implement a specialized message provider that downloads messages from the backend in one major fell swoop (for the current user session). If he can also connect to the default GWT messaging engine, then I would be completely happy (i.e. I could create an interface as described above and continue to use the nice {0}, {1} ... property replacement format )
Other suggestions for clean database-driven messages in the GWT are also welcome.
java internationalization gwt
Lars tackmann
source share