All the source code in the project can be found in the linked repository :https://github.com/chenhaoxiang/uifuture-ssm
stay 6.6 section , It introduces LocaleResolver International parser , But how to use internationalization in the project has not been explained by examples , In this section , It's mainly about the use of international configuration . Internationalization , There are two main steps .
1、 Loading internationalized resources
2、 International output
About the output of internationalization , You can choose to use Spring MVC Tag library of , International output . In addition, it can be done in Controller Handle the message with output internationalization in the method , You need to use RequestContext Medium getMessage() Method to complete .
There are many ways to achieve internationalization . In the next example , Will demonstrate the use of Session Internationalization , And use... In the page Spring MVC The tag library completes the international output .
From the front 6.6 You can know , First of all, it needs to be in Spring The container is filled with the name ”localeResolver” and ”messageSource” Two bean example . ad locum ”localeResolver”Bean Instance selection SessionLocaleResolver object .”messageSource”Bean Instance selection ReloadableResourceBundleMessageSo