[MGNLDIFF-70] Diff module is not i18n aware on single site with multiple languages Created: 10/Feb/14  Updated: 18/Aug/14  Resolved: 18/Mar/14

Status: Closed
Project: Magnolia Diff Module
Component/s: None
Affects Version/s: 1.2
Fix Version/s: 1.2.2

Type: Bug Priority: Major
Reporter: Christian Ringele Assignee: Philip Mundt
Resolution: Fixed Votes: 0
Labels: support
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: JPEG File DefaultLanguage_ENParameter.jpg     JPEG File Dialog_with_three_Language-Links.jpg     JPEG File Diff-Control-LoclasConfig.jpg     JPEG File NotDefaultLanguage_DeParameter.jpg     XML File config.modules.workflow.dialogs.editActivationWorkItem.tabActivation.diff.xml     Text File diff-i18n-aware.patch    
Issue Links:
Cloners
is cloned by MGNLDIFF-74 Diff module is not i18n aware on sing... Closed
causality
dependency
depends upon MAGNOLIA-5719 Add required key to admininterface's ... Closed
relation
is related to MGNLDIFF-73 Add possibility to query for changes,... Closed
is related to MGNLDIFF-80 i18n aware comparison doesn't work in... Closed
Template:
Patch included:
Yes
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Release notes required:
Yes
Date of First Response:

 Description   

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.


 Comments   
Comment by Marcel Stör [ 10/Feb/14 ]

Looks like a good start Thanks!

The locales should be read dynamically from the site definition in use.

Yeah, that is definitely a must-have. Particularly if you have different locales/language per site (e.g. CH:de/fr/it, DE:de).

What would also be a must-have is some kind of indication per language if anything changed at all. If a page is available in 5 languages it'd very inefficient if the publisher had to click all 5 links only to find out that the page changed in only 1 of the languages. Hence, the actual diff needs to be processed before the link is displayed in the edit dialog. Whether you don't display links for non-changed languages or add a "nothing changed"-style suffix to those links is a detail I don't care about.

Comment by Philip Mundt [ 17/Mar/14 ]

Hi!

We have added a feature request for:
MGNLDIFF-73 Add possibility to query for changes, similar to "diff -q"

As this is a completely new feature it is currently only scoped for the Magnolia 5 compatible diff module.

Kind regards
P. Mundt

Comment by Philip Mundt [ 17/Mar/14 ]

Created clone MGNLDIFF-74 (for the Magnolia 5 compatible version) of this issue as the dialog-related changes differ quite a lot.

Comment by Marcel Stör [ 18/Mar/14 ]

If I followed this issue and the support ticket correctly:

Correct?

Comment by Philip Mundt [ 18/Mar/14 ]

Hi!

Yes, that's correct.

  • This fix will be in diff module 1.2.2 (localized comparison links in workitem dialog + enabling locales in diff servlet)
  • The update to magnolia 4.5.18 was required, as there were key/value pairs added to message bundle files
  • The IllegalArgumentException should not occur. The fix implementation uses the same mechanism as default + i18nContentSupport to generate the comparison links.

Regards
Philip

Generated at Mon Feb 12 05:21:05 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.