Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support reverting "foreign language only" mode by choosing English #9570

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Commits on Nov 1, 2024

  1. Support reverting "foreign language only" mode by choosing English

    We had a [support ticket on Zendesk](https://govuk.zendesk.com/agent/#/tickets/5956584)
    recently: a user created an English document, then accidentally
    set it to "Foreign language only" mode when trying to add a Welsh
    translation. The English version became unavailable, and they were
    unable to switch back to English mode - the document was stuck in
    "foreign language only" mode.
    
    Whitehall has [three varying levels of support](https://docs.google.com/document/d/1ma5gzJU8EUl3Yo6J6z3XzkEdpqUVLPLPEoSPff9ZduE/edit)
    for languages:
    
    1. No support (e.g. for Calls for Evidence)
    2. Foreign language only (can change primary locale to something
       other than English, but not provide any other translations)
    3. Translatable (can add any number of translations, but not
       change the primary locale to anything other than English)
    
    There therefore never should be a situation where a publisher
    has a document with a non-English primary locale AND any
    translations. Therefore we shouldn't be breaking any existing
    workflows by triggering the deletion of non-English translations
    under these circumstances.
    
    NB, I did consider not adding a "English" option to the list
    of languages, and instead figure out the user's intention from
    the absence of the checked "foreign language only" checkbox.
    But this felt rather unsafe - all it would take is for a developer
    to rename that checkbox and then the absence check would always
    return `true` and we could find ourselves in a place where
    non-English documents get mistakenly converted to English ones.
    See #9569 for the approach if interested.
    
    Trello: https://trello.com/c/5B60uybX/3062-unable-to-uncheck-the-create-a-foreign-language-only-box
    ChrisBAshton committed Nov 1, 2024
    Configuration menu
    Copy the full SHA
    aa38ba9 View commit details
    Browse the repository at this point in the history
  2. Add safeguard against accidentally deleting multiple translations

    As outlined in the previous commit, there should never be a
    situation where the primary locale has changed AND there are
    multiple translations. It should simply go from (for example)
    
    - `cy` translation (primary)
    - `cy` and `en` translations (`en` being the new primary)
    - `en` translation (`cy` deleted as part of the before_validation
      callback)
    
    That said, Whitehall can be full of surprises, and it's probably
    better that we preserve any translations if we DO find ourselves
    in a state where there are multiple translations and a changing
    primary locale. It is better that the department raise a support
    ticket with us so we can look into it further and step in
    manually, than to make the wrong assumption and delete their
    translations.
    ChrisBAshton committed Nov 1, 2024
    Configuration menu
    Copy the full SHA
    4fc5403 View commit details
    Browse the repository at this point in the history