Translations are unpublished and can't be changed

Created on 11 March 2025, 2 months ago

Problem/Motivation

Translations are marked with status 0, and it can't be changed.

Steps to reproduce

Enable translation. Create a translation. The status is 0.

Proposed resolution

Allow published status to be changed on the edit form.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States oknate Greater New York City Area

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @oknate
  • Merge request !55Expose published field β†’ (Open) created by oknate
  • Pipeline finished with Success
    2 months ago
    Total: 418s
    #446102
  • πŸ‡ΊπŸ‡ΈUnited States oknate Greater New York City Area

    I have added a PR to expose the published field. Please review.

  • πŸ‡¬πŸ‡§United Kingdom scott_euser

    scott_euser β†’ changed the visibility of the branch 3512340-translations-are-unpublished to hidden.

  • πŸ‡¬πŸ‡§United Kingdom scott_euser

    scott_euser β†’ changed the visibility of the branch 2.0.x to hidden.

  • πŸ‡¬πŸ‡§United Kingdom scott_euser

    Thanks for the contribution! The most common use case (I believe) is global settings for things that appear on all pages, so having published checkbox everywhere isn't ideal as it complicates the user interface when it normally does not matter (but of course that default for translation is unpublished is proper bug).

    So we have a precedent for optionally showing/hiding things in the UI like this:

    So I think on top of your current MR we should ideally:

    1. Maintain the status quo of published being hidden - ie, update hook setting hide_published true
    2. Let people opt-in to managing published status - ie, new hide_published in SiteSettingsConfigForm
    3. Default to published for new translations if managing published status is disabled - I believe in SiteSettingEntity field status can be with ->setDefaultValue(TRUE)

    Thank you!

  • First commit to issue fork.
  • πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels

    I don't think it's necessary to add a custom setting to control the visibility of the status field. That's what the form display UI is for. I'll change it so the field is hidden by default and can be displayed by moving it in the form display. I also changed the default value of the publishing status to TRUE.

  • πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels

    I also added a custom translation handler to actually make publishing of translations work. The code is mostly based on Drupal\node\NodeTranslationHandler and Drupal\eck\EckTranslationHandler.

  • πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels
  • πŸ‡¬πŸ‡§United Kingdom scott_euser

    The reason the behaviour exists for controlling/overriding it centrally is that sites can have many many site setting types, using manage form display for each one is time consuming via the UI (yes I realise you could bulk do via config/sync/ but I think its fair to say the average site builder won't know how to do that)

Production build 0.71.5 2024