Get resource bundle for a certain locale
import java.util.Locale;
import java.util.ResourceBundle;
import java.util.MissingResourceException;
public class Animals {
public static void main(String [] argv) {
ResourceBundle animalResources;
try {
animalResources = ResourceBundle.getBundle("AnimalResources", Locale.getDefault());
System.out.println(animalResources.getString("Animals"));
} catch (MissingResourceException mre) {
mre.printStackTrace();
}
}
}
# Sample properties file with keys whose values span more than one line
#
Animals=Cat, Dog, Giraffe, \
Bear, Moose
Related examples in the same category