Fixed locale issues with the freemarker templates and added tests.