Problem/Motivation
Be able to select Same as translation in the Xliff File provider so any existing translation can be included in the xlf file.
This is a variation of #3092262: Include existing translation content in file translator export file that tries to change the config to
- not copy at all (current behaviour of tmgmt file)
- copy the source in any case (current behaviour of tmgmt file)
- copy the translation in any case, with no fallback to the source
- copy the translation with a fallback to the source (3092262)
Then propose an integration with content moderation #2978341: Support pending revisions and accepting translation as a specific moderation state (should be a follow up).
Proposed resolution
Add Same as translation to the existing Empty and Same as source options,
so the current behaviour doesn't change on existing setups and plugins that are extending FileTranslator
could provide a distinct configuration.
As it requires to choose between including the source or not in the initial translation, a more flexible approach could be to use checkboxes here. E.g. unchecked = Empty then Same as source and/or Same as translation. So if only Same as translation is checked it should mean that the initial translation might not be included in the source.
Comment | File | Size | Author |
---|---|---|---|
#10 | configure-xlf-target-content_3130344-10.patch | 12.92 KB | eyilmaz |
#9 | configure-xlf-target-content_3130344-9.patch | 10.26 KB | eyilmaz |
#7 | tmgmt-target-content.png | 25.71 KB | colorfield |
#7 | configure-xlf-target-content_3130344-7.patch | 9.36 KB | colorfield |
Comments
Comment #2
colorfieldHere is a first approach for this, without tests. Presumes that Same as source is the fallback if no translation is available yet.
Comment #4
colorfieldPatch above requires at least to review
SourcePluginInterface::getData
or perhaps introducegetTranslationData
will continue on this a bit later, currently reviewing how to integrate with #2978341: Support pending revisions and accepting translation as a specific moderation stateComment #5
colorfieldComment #6
colorfieldAbout the content moderation integration, if we continue with the initial approach, we could change the
ContentEntitySource::loadMultiple()
from https://www.drupal.org/project/tmgmt/issues/2978341#comment-13209387like this to get the latest translated revision, using
EntityRepository::getActiveMultiple()
with a language context.I will also continue to look a the proposed implementation with checkboxes so the site builder can choose to include the source or not in the initial translation.
Comment #7
colorfieldImplementation with checkboxes: allows
- empty
- source
- translation
- translation with fallback to source
Also fixes the target configuration that was not displayed on the form after save.
Still requires
- configuration update from single valued to multi valued configuration for 'target' (copy old configuration and initialise new - update or post update hook of the tmgmt_file module)
- tests
Comment #8
colorfieldComment #9
eyilmazRerolled.
ContentEntitySource::getData ignored the new $langcode parameter. Adjusted that.
Also the schema file for tmgmt_file in tmgmt_file.schema.yml is updated to reflect the new possible values for format_configuration.target.
Comment #10
eyilmazApplied change to SourcePluginInterface::getData also to other inheriting classes.
Comment #11
BerdirDon't forget to set an issue to needs review when uploading a patch, so that tests can run.
That said, this is introducing an API change for several interfaces, that is not something we can do. There are some ways to work around it like not adding it to the interface, but that makes things quite complicated and ugly.
Will need to do a more detailed review.
Comment #14
GuillaumeG CreditAttribution: GuillaumeG as a volunteer commentedUsing the patch in production without issues so far, thanks.