I have basic Spring MVC 3 setup for i18n where I can show labels on page based on user passed language in the request. For example: url?lang=fr, url?lang=de etc…
But actual requirement is I have to maintain 2 properties files for each locale, for example for French, I will have messages_fr_fr.properties and messages_fr_en.properties. Similarly for germany locale, I will have messages_de_de.properties and messages_de_en.properties.
That means when french user logs in, page will show french labels, but he can switch to english from a drop down if he wants. This requires programatic loading messages properties, how do I do this?
From reference, I believe using
LocaleChangeInterceptorhelps you change the language at runtime and load the messages likewise. A more detailed example is described here.