I use .properties files to internationalize messages. For instance:
HELLO_WORLD = Hello World HELLO_UNIVERSE = Hello Universe
And then in the Java code:
String foo = resourceBundle.getString("HELLO_WORLD");
String literals like "HELLO_WORLD" are problematic because they are error prone and cannot be autocompleted. I would like to generate the code from the keys in the properties file as follows:
public interface Messages {
And then use it like this:
String foo = resourceBundle.getString(Messages.HELLO_WORLD);
Is there a standard way to do this? I prefer the Maven plugin, but any standalone tool that I can run manually will be good enough for my needs.
source share