Skip to content

Instantly share code, notes, and snippets.

@oehme
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oehme/a00c6a2745ea25adcdc0 to your computer and use it in GitHub Desktop.
Save oehme/a00c6a2745ea25adcdc0 to your computer and use it in GitHub Desktop.
Localization ResourceBundle
public class MyMessages {
private ResourceBundle bundle;
public MyMessages(Locale locale) {
this.bundle = ResourceBundle.getBundle("MyMessages", locale);
}
public String trains(Number arg0) {
String pattern = bundle.getString("Trains");
MessageFormat format = new MessageFormat(pattern);
return format.format(new Object[]{arg0});
}
//more methods here...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment