Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-6181

Expose i18n functionality via context object in FreemarkerHelper

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Neutral Neutral
    • 5.4.4
    • None
    • freemarker
    • Kromeriz 24
    • 3

      The i18n FTL templating support object (an instance of info.magnolia.freemarker.MessagesWrapper) still uses the old i18n mechanism and requires the old 'i18nBasename' property and hence a separate resource bundle file from the default new location in mgnl-i18n. This is very inconvenient we only want a single resource bundle location.

      @zdenek thought of the following solution (see SUPPORT-4560):


      How about to add something to TemplatingFunctions for this purpose? So that you could use something like cmsfn.i18n('key') that would pass the key to the translation service and eventually also fallback to the "old" i18n way of resolving the labels if not found.

      It is an idea to implement this at some stage?

      UPDATE:
      had already outlined the specifics in the comment from 8th of Oct.
      TranslationService already has the functionality to fallback to the old basename-functionality: info.magnolia.i18nsystem.TranslationService#translate(info.magnolia.i18nsystem.LocaleProvider, java.lang.String, java.lang.String[]). It's only a matter of wiring everything nicely together to make the new i18n-mechanism available in templates, while providing fallback for basename-usages.

      info.magnolia.freemarker.FreemarkerHelper#addDefaultData
      info.magnolia.freemarker.MessagesWrapper
      

      We should delegate to TranslationService in MessagesWrapper (or similar).

        Acceptance criteria

              rkovarik Roman Kovařík
              edgar Edgar Vonk
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Task DoD

                    Estimated:
                    Original Estimate - Not Specified
                    Not Specified
                    Remaining:
                    Remaining Estimate - 0d
                    0d
                    Logged:
                    Time Spent - 6.5h
                    6.5h