Uploaded image for project: 'Magnolia Diff Module'
  1. Magnolia Diff Module
  2. MGNLDIFF-70

Diff module is not i18n aware on single site with multiple languages

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 1.2.2
    • 1.2
    • Yes
    • Yes

      If you setup the i18n STK mechanism for multi-language in a single tree, one can not see the content differences of other languages than the default one.

      Setting up a site definition for each language defining it as default language is in most projects not an option. 3 languages on 5 sites will result in 15 SD configurations. One would have to manage 15 domains for an author and each Author would have to logout and login to all the domains for the language switch.

      For the support issue SUPPORT-3211 I created a simple Snapshot for the customer he can enhance for his needs. For product readiness the implementation needs to be enhanced, for projects it can be used and easily extended for the project needs.

      Situation:

      • The VersionDiffHtmlServlet is dropping two requests to the regarding page's URL.
      • Then provides both rendered outputs to the dasyDiff.
      • The content node used is not wrapped with the i18N node wrapper and there for not i18n aware.
      • Also the URl for the reuests are created by the content's handle and not via the LinkUtil, therefore no language flag is added to the URL.

      Solution:

      • In VersionDiffHtmlServlet wrap the content with the i18n node wrapper (Servlet requests the page and doesn't use the said node)
      • In VersionDiffHtmlServlet set the locale into the AggregationState.
      • In VersionDiffHtmlServlet create the url via LinkUtil I18nContentSupport
      • Extend the control by a configuration value of the locales.
      • Provide public method in the dialogs control DiffLink.java providing all relevant locales for the controls template: /diff/src/main/resources/info/magnolia/module/diff/dialog/DiffLink.html
        And read the values from the control.
      • Add the locale as a parameter for the Servlet to be fetchable: /diff/src/main/resources/mgnl-resources/js-classes/mgnl/diff/Diff.js
      • In VersionDiffHtmlServlet react to the parameter defining the locale and set the value into the AggregationState.

      See print screens DefaultLanguage_ENParameter.jpg & NotDefaultLanguage_DeParameter.jpg as the new parameter drives the language for the servlet. In this test setup en is default and de the non default language.

      See print screen Diff-Control-LoclasConfig.jpg:
      The locales configuration directly on the control.

      See print screen Dialog_with_three_Language-Links.jpg:
      The output in the dialog. For each language a link gets added with the according locale in the parameter.

      Problems to achieve this behavior:

      • As the request is done to the Servlet and not the target page, the site definition can not that easy be detected and the locales fetched from there dynamically:
        • delegated to the dialogs control
        • done by using the SiteManager's getAssignedSite(Node node) method
      • The link in the dialog's control must be extended by locales and this value has to be provided to the Servlet itself.

      Fast forward implementation which need to be enhanced for product readiness:

      • The locales should be read dynamically from the site definition in use.
        The implementation on defining it on the control is decoupling it form the actual site definition defining the locales for the page.
      • In the script /diff/src/main/resources/info/magnolia/module/diff/dialog/DiffLink.html the rendered label is not i18nized.
      • The diff comparison of older versions is not changed. So for comparison of different languages of older versions would need a comparable implementation.
        • This is currently not possible, but will be added as a separate feature request for the M5 version of diff module.

        Acceptance criteria

              pmundt Philip Mundt
              cringele Christian Ringele
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD