Localization for Struts Freemarker users
Because it took me freaking forever to find instructions on how to do this…
-
You do NOT need a message-resource tag in your struts configuration files. Those are outdated instructions for old versions of Struts.You do not need to edit ANY xml at all.
-
Your Action needs to implement Freemarker’s TemplateMethodModel interface
-
You need a package.properties file (the default locale) and a then another one for each other locale / language you want to support (ex. package_en_US.properties). These should be located in the same package as the Struts action that will be needing them. You can also do ClassName.properties if you want to tie some to a particular class.