mysociety / whatdotheyknow-theme

The Alaveteli theme for WhatDoTheyKnow (UK)
http://www.whatdotheyknow.com/
MIT License
31 stars 26 forks source link

Authority additions from localised sites generate erroneous change requests / notifications #509

Open mdeuk opened 5 years ago

mdeuk commented 5 years ago

When submitting a request to add a new authority in using the Cymraeg version of WDTK an error appears to occur which causes the change request to attempt to update the English version of WDTK rather than the Cymraeg (Welsh).

Example:

I have submitted a request to add a new authority 'Trafnidiaeth Cymru' (Transport for Wales) from the /cy website, which generates a support request:

image

As you can see, the request is fully localised, however, when attempting to action the change request, the localised fields, e.g. body name and request email address populate in the default language fields (English), leaving the Cymraeg fields empty

image

This has the additional side effect of generating notifications back to the user in the wrong language, with no option to correct this, other than to manually change the message.

image

Steps to reproduce

  1. Navigate to https://www.whatdotheyknow.com/cy/change_request/new and add an authority - note that, for the most part, the form is localised.
  2. Submit, note the following message "Mae'ch cais i ychwanegu awdurdod wedi ei anfon. Diolch am gysylltu. Byddwn mewn cysylltiad â chi'n fuan." (aka "Your request to add an authority has been sent. Thanks for contacting. We will be in touch with you soon")
  3. Open support mailbox and click the relevant change request link (or access via Admin console). Note: The alert in the support mailbox will be shown in the correct language (e.g. welsh in this instance)
  4. Note that the 'Cymraeg' tab is not populated and that the email to user template is in the wrong language

I am able to reproduce this issue consistently.

mdeuk commented 5 years ago

Note, change request in question is 3287 (Trafnidiaeth Cymru). I have not added this authority yet, to allow for developers to investigate what might be going wrong. Test authority 'cwango' (3291) has been added to confirm that the bug is reproducible.

[fun fact - BydTermCymru does confirm the translation is correct - quango becomes 'cwango' 🙂]

garethrees commented 5 years ago

Note: The alert in the support mailbox will be shown in the correct language (e.g. welsh in this instance)

FWIW I think this is incorrect – Admins should receive mail in the default language.

garethrees commented 5 years ago

I think the gist of the problem here is that we're assuming that any "change request" adds the details for the default language of the site. This isn't a huge problem for WDTK specifically (I expect 98% of people use EN) but would be a bigger problem for international reusers supporting multiple locales.

@mdeuk Thanks for the really nice reproduction steps. Feel free to add the authority now, as we'll be able to recreate this in our development environments with the info you've given.

You'll want to move the Welsh translations over to the "Cymraeg" tab, and manually fill in the English with the English translation.