Spring Boot Localization
Spring Boot OOTB allow us to show localized text which is nothing but internationalization. It helps us to show language based text depending on the Accept-Language header.
To understand localization in actual, Lets create a Spring Boot project having Spring Web as a dependency.

Create a controller to handle HTTP requests and return a localized response based on Accept-Language header.

Create below messages.properties and messages_fr.properties for English and French localized respective key value pairs in parallel to application.properties file.

message.properties:
good.morning.message=Good Morning
message_fr.properties:
good.morning.message=Bonjour
Access the URL http://localhost:8085/message
in your browser, and it will return the text “Good Morning”.
Note: By default, the browser sends "en"
(English) as the default language, as highlighted below.

Access controller with the help of postman and set Accept-Language header as fr in Postman will return text in French.


Imran Khan, Adobe Community Advisor, certified AEM developer and Java Geek, is an experienced AEM developer with over 12 years of expertise in designing and implementing robust web applications. He leverages Adobe Experience Manager, Analytics, and Target to create dynamic digital experiences. Imran possesses extensive expertise in J2EE, Sightly, Struts 2.0, Spring, Hibernate, JPA, React, HTML, jQuery, and JavaScript.