Skip to main content

Locale

Learn Locale (Internationalization, Spring MVC) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Fresher Notes Locale is the java.util.Locale object that holds a language and an optional country, such as fr or en_GB ; it tells Java which language and format rules to use. Created with Locale.of("fr", "CA") (Java 19+), new Locale("fr", "CA") or Locale.forLanguageTag("fr-CA") . In a controller declare a Locale method parameter and Spring injects the locale chosen by the LocaleResolver .

More lessons in Internationalization