citerus / dddsample-core

This is the new home of the original DDD Sample app (previously hosted at sf.net)..
MIT License
4.94k stars 1.47k forks source link

Add support for multiple languages #84

Open orende opened 1 year ago

orende commented 1 year ago

A while ago I noticed a half-finished effort at adding internationalization to the project in the form of a partial messages_en.properties file. I decided to finish the work by externalizing all hardcoded strings from the html files into the messages_en.properties file as well as adding translations for Swedish and simplified Chinese. I also rewrote parts of the code in the interfaces package where strings had been hardcoded and replaced them with externalized strings. Finally, I wrote a LocaleContextResolver to handle the mapping of the "lang" query parameter value to matching message sources.

One feature I've left out for now is programmatic detection of new locales based on property file names, but that could be relatively easily added in the future.