freemarkermagnolia

Magnolia override i18n in Freemarker Renderer


We have the problem that by default single quotes in i18n are not escaped in the magnolia freemarker renderer. That leads to the problem that our i18n string is too early closed in the html. As a simple fix we want to extend the i18n function provided in the Freemarker Template.

I have seen that it is possible to override the freemarker renderer with a decorator in decorations/rendering/renderers/freemarker.yaml but it seems that the contextAttributes doesn't include i18n. So the question is where does i18n come from and how can I extend it?


Solution

  • It's sadly not very easy to extend the default i18n mechanism. You might experiment with remapping the info.magnolia.i18nsystem.TranslationService to your custom implementation via component mappings in the module descriptor.

    However, it seems that i18n messages with single (or double) quotes work fine.

    enter image description here