Użyj klasy java.text.MessageFormat do formatowania komunikatów.
public static void main(String[] args){
final String MSG_FORMATSTRING="Rational Developer {0}, wersja {1}";
final String VERSION = "wersja";
final String EDITION = "wydanie";
final String JAVA = "dla Java";
final String MY_RESOURCES = "MojeZasoby";
ResourceBundle myResources = ResourceBundle.getBundle(MY_RESOURCES, Locale.US );
String version = myResources.getString(VERSION);
String edition = myResources.getString(EDITION);
MessageFormat form = new MessageFormat(MSG_FORMATSTRING);
Object[] testArgs = {new Integer(6), JAVA};
System.out.println(form.format(testArgs));
}
|
|