Bug 35769

Summary: Untranslatable strings when placing holds in staff
Product: Koha Reporter: Anneli Österman <anneli.osterman>
Component: I18N/L10NAssignee: Katrin Fischer <katrin.fischer>
Status: Pushed to stable --- QA Contact: Martin Renvoize (ashimema) <martin.renvoize>
Severity: normal    
Priority: P5 - low CC: david, f.demians, jonathan.druart, julian.maurice, lucas, m.de.rooy, martin.renvoize
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.11.00,24.05.06
Circulation function:
Attachments: Screenshot of the untranslatable pop up
Bug 35769: Fix untranslatable strings in request.tt
Bug 35769: Fix untranslatable strings in request.tt
Bug 35769: Fix untranslatable strings in request.tt
Bug 35769: Remove extra parenthesis

Description Anneli Österman 2024-01-11 06:25:45 UTC
Created attachment 160797 [details]
Screenshot of the untranslatable pop up

There is a untranslatable string In requeste.tt: "Please make sure all selected titles have a pickup location set" (line 1552). See the attachment.

The string shows up when you are making a multi-hold and leave one of the titles without pick-up place and then try to save the holds.
Comment 1 Owen Leonard 2024-01-11 14:11:47 UTC
*** Bug 35770 has been marked as a duplicate of this bug. ***
Comment 2 Katrin Fischer 2024-01-13 15:12:49 UTC
Created attachment 161011 [details] [review]
Bug 35769: Fix untranslatable strings in request.tt

This fixes some strings in the JavaScript part of the
template that were missing from the po files.

This is one way to test:
* Apply patch
* Run gulp po:update --lang <language-code>
* Compare strings changed in the patch, with strings
  appearing in <language-code>-staff-prog.po
* Translate the strings and remove "fuzzy" line
* In k-t-d, run:
  sudo koha-translate --install <language-code> --dev <instance>
* Verify that now the translated version of the template contains
  your translated strings
* Verify the translated page works correctly, no errors
Comment 3 Jonathan Druart 2024-01-15 09:43:24 UTC
I think you have extra parenthesis:

msg = (_("- Please select a pickup location for the item") + "\n");

should be

msg = _("- Please select a pickup location for the item") + "\n";
Comment 4 Katrin Fischer 2024-01-15 11:07:48 UTC
I know, but the strings weren't picked up for translation before I added them. 
I copied from another place in the file where it worked.

Do you see why else this did not work before?
Comment 5 David Nind 2024-01-19 20:23:49 UTC
Created attachment 161222 [details] [review]
Bug 35769: Fix untranslatable strings in request.tt

This fixes some strings in the JavaScript part of the
template that were missing from the po files.

This is one way to test:
* Apply patch
* Run gulp po:update --lang <language-code>
* Compare strings changed in the patch, with strings
  appearing in <language-code>-staff-prog.po
* Translate the strings and remove "fuzzy" line
* In k-t-d, run:
  sudo koha-translate --install <language-code> --dev <instance>
* Verify that now the translated version of the template contains
  your translated strings
* Verify the translated page works correctly, no errors

Signed-off-by: David Nind <david@davidnind.com>
Comment 6 David Nind 2024-01-19 20:29:50 UTC
Testing notes (using koha-testing-docker):

1. Replicate the issue:
   1.1 Install another language: sudo koha-translate --install <language-code> --dev <instance> (sudo koha-translate --install fr-CA --dev kohadev)
   1.2 Enable the language in the staff interface: Administration > System preferences > I18N/L10N > language > select the language you installed (for example: Français (fr-CA)) > Save all I18N/L10N...
   1.3 Check the <language-code>-staff-prog.po file for these phrases (in misc/translator/po directory) - they are not found:
       - Please select a pickup location for the item
       - Please select a pickup location for this hold
       - Please make sure all selected titles have a pickup location set
       - Please select at least one title
   1.4 Change the staff interface to the language you have installed
   1.5 Perform actions that generate the messages and note that they are in English:
       - Please make sure all selected titles have a pickup location set: 
         . Perform a search that returns multiple results
         . Select several of the results and then click the 'Place hold' button
         . Enter a patron and for the hold screen make sure the pickup location is empty, and click 'Place hold'
         . Pop up message is not translated and is still in English
       - Not sure how to generate the other ones

2. Apply the patch.

3. Update the translations: gulp po:update --lang <language-code> (gulp po:update --lang fr-CA) 

4. Compare the strings changed in the patch (see step 1.3), with strings appearing in <language-code>-staff-prog.po - they should all now be found in the file.

5. Add a translation for the strings and remove the "fuzzy" line.

6. Update the language: sudo koha-translate --update <language-code> --dev <instance> (sudo koha-translate --install fr-CA --dev kohadev)

7. Repeat step 1.5 - verify that the translated content is now used.

8. Verify that the translated page works correctly, and that there are no errors.
Comment 7 Martin Renvoize (ashimema) 2024-01-23 17:21:02 UTC
Created attachment 161312 [details] [review]
Bug 35769: Fix untranslatable strings in request.tt

This fixes some strings in the JavaScript part of the
template that were missing from the po files.

This is one way to test:
* Apply patch
* Run gulp po:update --lang <language-code>
* Compare strings changed in the patch, with strings
  appearing in <language-code>-staff-prog.po
* Translate the strings and remove "fuzzy" line
* In k-t-d, run:
  sudo koha-translate --install <language-code> --dev <instance>
* Verify that now the translated version of the template contains
  your translated strings
* Verify the translated page works correctly, no errors

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 8 Martin Renvoize (ashimema) 2024-01-23 17:22:38 UTC
(In reply to Jonathan Druart from comment #3)
> I think you have extra parenthesis:
> 
> msg = (_("- Please select a pickup location for the item") + "\n");
> 
> should be
> 
> msg = _("- Please select a pickup location for the item") + "\n";

At first I thought the same, but they don't appear to cause a problem in reality.. it's weird.. but it works.

I'm passing QA, but I'd love to understand better why that's the case.
Comment 9 Katrin Fischer 2024-01-23 21:29:39 UTC
(In reply to Martin Renvoize from comment #8)
> (In reply to Jonathan Druart from comment #3)
> > I think you have extra parenthesis:
> > 
> > msg = (_("- Please select a pickup location for the item") + "\n");
> > 
> > should be
> > 
> > msg = _("- Please select a pickup location for the item") + "\n";
> 
> At first I thought the same, but they don't appear to cause a problem in
> reality.. it's weird.. but it works.
> 
> I'm passing QA, but I'd love to understand better why that's the case.

I have to admit, I found this through trial and error and would like to understand better as well.
Comment 10 Jonathan Druart 2024-01-24 15:21:07 UTC
Created attachment 161346 [details] [review]
Bug 35769: Remove extra parenthesis
Comment 11 Jonathan Druart 2024-01-24 15:21:47 UTC
(In reply to Katrin Fischer from comment #4)
> I know, but the strings weren't picked up for translation before I added
> them. 
> I copied from another place in the file where it worked.
> 
> Do you see why else this did not work before?

This is working for me.
Please try again.
Comment 12 Marcel de Rooy 2024-01-26 08:58:20 UTC
Looks like this is still under consideration. Changing status.
Comment 13 Martin Renvoize (ashimema) 2024-10-18 07:07:14 UTC
Bumping back into the QA queue.. hoping someone with a little more translation structure knowledge can pick it off.
Comment 14 Jonathan Druart 2024-10-22 08:00:42 UTC
Sending to Katrin's. We were waiting for her.
Comment 15 Katrin Fischer 2024-10-22 08:28:15 UTC
Sorry missing the time :( 
If someone has a moment before me, happy to turn this over.
Comment 16 Katrin Fischer 2024-10-23 16:54:45 UTC
Sometimes it's good to come back a bit later, I see what I missed before now. Thanks Jonathan!
Comment 17 Katrin Fischer 2024-10-23 17:18:37 UTC
Pushed for 24.11!

Well done everyone, thank you!
Comment 18 Lucas Gass (lukeg) 2024-11-20 18:27:03 UTC
Backported to 24.05.x for upcoming 24.05.06