[MGNLCTS-79] Yaml based Content Apps: Also enable yaml based apps to use content translation. Created: 11/Feb/16  Updated: 22/Apr/20  Resolved: 22/Apr/20

Status: Closed
Project: Content Translation Support
Component/s: None
Affects Version/s: 2.1.2
Fix Version/s: None

Type: Improvement Priority: Neutral
Reporter: Christian Ringele Assignee: Unassigned
Resolution: Not an issue Votes: 1
Labels: support
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: XML File config.modules.training-content-apps.commands.content-translation-support.carsDownloadTranslation.xml     XML File config.modules.training-content-apps.commands.content-translation-support.carsUploadTranslation.xml    
Issue Links:
causality
relation
Template:
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)
Date of First Response:

 Description   

Currently the content translation is not usable for yaml based content apps.

There are a couple of struggles/needed changed involved.
I tested all on a training app called "cars" with workspace "cars"/

I think the imrovement should be done in two steps:
1. Updating the module to be able export and import on yaml based app configs.
So until 2. is done, the configs would have to be added manually, but at least it would work with a yaml app.
2. When MTE 1.0 is ready, adding an automatism for light modules comparable to the AddTranslationActionForDetailSubappTask.
.

Java adaptions needed in content translation

The class DetailPresenterNodeDataToTranslateFinder.java uses the JCR config workspace, instead of operating pure on the App config bean. Then it would also work for a yaml based app.
.

1. The configurations needed:

The "AddTranslationActionForDetailSubappTask" creates a couple of configurations in JCR. Of course it can't be used for a yaml based file.
These would have to be supplied for the yaml world, if not automated, then at least to be able to add them manually.

The two commands needed:

The biggest problem is, that currently light modules don't provide a commands registry (until MTE 1.0)
So the two needed command would have to be registered in some installed module, or some other project Maven module. But it would work as they are referenced by catalog and command name, so they can be registered anywhere.
Here the two form my test:
config.modules.training-content-apps.commands.content-translation-support.carsDownloadTranslation
config.modules.training-content-apps.commands.content-translation-support.carsUploadTranslation

The two dialogs needed:

These could be provided as yaml:
downloadTranslationFile:

actions:
  commit:
    command: roomsDownloadTranslation
    label: content-translation-support.downloadTranslationFile.actions.commit.label
    catalog: content-translation-support
    class: info.magnolia.module.contenttranslationsupport.dialog.action.TranslationFileDownloadDialogActionDefinition
  cancel:
    class: info.magnolia.ui.admincentral.dialog.action.CancelDialogActionDefinition
form:
  description: content-translation-support.downloadTranslationFile.description
  label: content-translation-support.downloadTranslationFile.label
  tabs:
    - name: download
      label:
      fields:
        - name: fileFormat
          importOrExport: export
          type: String
          required: true
          sortOptions: false
          label: content-translation-support.downloadTranslationFile.download.fileFormat.label
          class: info.magnolia.module.contenttranslationsupport.form.field.definition.TranslationFileFormatOptionGroupFieldDefinition

uploadTranslationFile:

actions:
  commit:
    command: roomsUploadTranslation
    label: content-translation-support.uploadTranslationFile.actions.commit.label
    catalog: content-translation-support
    class: info.magnolia.module.contenttranslationsupport.dialog.action.TranslationFileUploadDialogActionDefinition
  cancel:
    class: info.magnolia.ui.admincentral.dialog.action.CancelDialogActionDefinition
form:
  description: content-translation-support.uploadTranslationFile.description
  label: content-translation-support.uploadTranslationFile.label
  tabs:
    - name: upload
      label:
      fields:
        - name: name
          required: true
          label: content-translation-support.uploadTranslationFile.upload.name.label
          binaryNodeName: import
          preview: false
          class: info.magnolia.ui.form.field.definition.BasicUploadFieldDefinition
        - name: fileFormat
          importOrExport: import
          type: String
          required: true
          sortOptions: false
          label: content-translation-support.uploadTranslationFile.upload.fileFormat.label
          class: info.magnolia.module.contenttranslationsupport.form.field.definition.TranslationFileFormatOptionGroupFieldDefinition
        - name: importOptions
          multiselect: true
          sortOptions: false
          label: content-translation-support.uploadTranslationFile.upload.importOptions.label
          class: info.magnolia.ui.form.field.definition.OptionGroupFieldDefinition
          options:
            - name: overwriteExistingValues
              label: content-translation-support.uploadTranslationFile.upload.importOptions.options.overwriteExistingValues
              value: overwriteExistingValues
            - name: importEmptyValues
              label: content-translation-support.uploadTranslationFile.upload.importOptions.options.importEmptyValues
              value: importEmptyValues
The two Actions needed:

These could be provided as yaml:

downloadTranslationFile:
  label: contentTranslationSupport.browser.actions.downloadTranslationFile.label
  icon: icon-export
  dialogName: training-content-apps:downloadTranslationFile
  class: info.magnolia.ui.framework.action.OpenCreateDialogActionDefinition
  availability:
    rules:
      - name: IsNotDeletedRule
        implementationClass: info.magnolia.ui.framework.availability.IsNotDeletedRule
uploadTranslationFile:
  label: contentTranslationSupport.browser.actions.uploadTranslationFile.label
  icon: icon-import
  dialogName: training-content-apps:uploadTranslationFile
  class: info.magnolia.ui.framework.action.OpenCreateDialogActionDefinition
  availability:
    rules:
      - name: IsNotDeletedRule
        implementationClass: info.magnolia.ui.framework.availability.IsNotDeletedRule


 Comments   
Comment by Richard Gange [ 22/Apr/20 ]

As far as I can tell this is not an issue in the latest demo.

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