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

Expose i18n functionality via context object in FreemarkerHelper

    XMLWordPrintable

Details

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

    Description

      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).

      Checklists

        Acceptance criteria

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                  Created:
                  Updated:
                  Resolved:

                  Checklists

                    Task DoD

                    Time Tracking

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