Files
spring-boot-rest/java-strings-2/src/main/java/com/baeldung/localization/Localization.java
Andrey Shcherbakov 7eba063308 Place the code for BAEL-2876 to java-strings-2 (#6911)
* Add the code for article BAEL-2876

* Move BAEL-2876 from core-java-8-2 to java-strings-2

* Remove ICU from the pom of core-java-8-2

* Replace the char é by its unicode encoding
2019-05-07 23:57:20 -06:00

19 lines
464 B
Java

package com.baeldung.localization;
import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;
public class Localization {
public static String getLabel(Locale locale) {
final ResourceBundle bundle = ResourceBundle.getBundle("messages", locale);
return bundle.getString("label");
}
public static void run(List<Locale> locales) {
locales.forEach(locale -> System.out.println(getLabel(locale)));
}
}