Bug 37257 - Copy in OPAC datatable untranslatable
Summary: Copy in OPAC datatable untranslatable
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: I18N/L10N (show other bugs)
Version: Main
Hardware: All All
: P5 - low trivial (vote)
Assignee: Owen Leonard
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-07-04 16:19 UTC by Caroline Cyr La Rose
Modified: 2024-07-13 12:05 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.11.00


Attachments
Screenshot of the patron's account in the OPAC in fr-CA, the Copy button is highlighted (77.35 KB, image/png)
2024-07-04 16:19 UTC, Caroline Cyr La Rose
Details
Bug 37257: Enable translation of Copy control in OPAC user summary (5.48 KB, patch)
2024-07-05 14:49 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 37257: Enable translation of Copy control in OPAC user summary (5.55 KB, patch)
2024-07-05 21:05 UTC, Caroline Cyr La Rose
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Caroline Cyr La Rose 2024-07-04 16:19:45 UTC
Created attachment 168509 [details]
Screenshot of the patron's account in the OPAC in fr-CA, the Copy button is highlighted

I can't find where to translate the "Copy" button in the OPAC datatables (I'm specifically looking at the checkouts table in the patron's account, but it's also in the holds tab, and I'm sure it's elsewhere too).

To recreate:
0. Install fr-CA or another language in the OPAC
   0.1. Run the following commands
   ./misc/translator/translate update fr-CA
   ./misc/translator/translate install fr-CA
   0.2. Go to Administration > System preferences
   0.3. Search for OPACLanguages and check fr-CA
   0.4. Set opaclanguagesdisplay to Allow
   0.5. Click Save all I18N/L10N preferences

1. Check that "Copy" is translated in the .po files
   1.1. In the terminal, open misc/translator/po/fr-CA-opac-bootstrap.po
   1.2. Search for Copy
        --> It should be translated to Copier
   1.3. Open misc/translator/po/fr-CA-messages-js.po
   1.4. Search for Copy
        --> It should be translated to Copier

2. Checkout an item to yourself (or to another patron)
   2.1. At the top right, click you username and choose My checkouts
   2.2. Enter the barcode 39999000010114 (or another barcode)
   2.3. Press Enter or click Check out

3. Log into the OPAC 

4. Switch the language to Français Canada

5. Access the user summary
   --> Notice the toolbar at the top of the checkouts table contains untranslated "Copy". "Imprimer" is translated. The others are hard to tell since they are the same in French and English (CSV, iCal)


I looked at the koha-tmpl/opac-tmpl/bootstrap/js/datatables.js file and the Copy section looks the same (to me) as the Print section
Comment 1 Owen Leonard 2024-07-05 14:49:02 UTC
Created attachment 168554 [details] [review]
Bug 37257: Enable translation of Copy control in OPAC user summary

Currently we define translatable labels for DataTables "export" options
(Copy, CSV, Excel, and Print) in the section of datatables.js for adding
our own configuration to these buttons. This works fine until we
redefine a button without redefining the translatable label as we do in
opac-user.pl.

The correct solution is to define these strings in the default set of
language strings we use for all other DataTable strings. This patch
makes that change in both the staff interface and the OPAC (although the
problem only currently manifests in the OPAC).

To test, apply the patch and start the translation process:

- Install fr-CA or another language in the OPAC
    1. Run the following commands:
        - gulp po:update
        - ./misc/translator/translate update fr-CA
        - ./misc/translator/translate install fr-CA
    2. Go to Administration > System preferences
    3. Search for OPACLanguages and check fr-CA
    4. Set opaclanguagesdisplay to Allow
    5. Click "Save all I18N/L10N preferences"

- Check that "Copy" is translated in the .po files
   1. Open misc/translator/po/fr-CA-messages-js.po
   2. Search for "Copy"
        --> It should be translated as "Copier"

- Log in to the OPAC as a user with checkouts.
- Switch to the language you translated.
- View the user summary page.
  - The controls at the top of the table of checkouts should be
    correctly translated.

- In the staff interface, switch to the language you translated.
- Test any DataTable with export controls, e.g. Administration ->
  Libraries, to confirm that the "Export" menu items are still
  translated correctly.

Sponsored-by: Athens County Public Libraries
Comment 2 Caroline Cyr La Rose 2024-07-05 21:05:41 UTC
Created attachment 168565 [details] [review]
Bug 37257: Enable translation of Copy control in OPAC user summary

Currently we define translatable labels for DataTables "export" options
(Copy, CSV, Excel, and Print) in the section of datatables.js for adding
our own configuration to these buttons. This works fine until we
redefine a button without redefining the translatable label as we do in
opac-user.pl.

The correct solution is to define these strings in the default set of
language strings we use for all other DataTable strings. This patch
makes that change in both the staff interface and the OPAC (although the
problem only currently manifests in the OPAC).

To test, apply the patch and start the translation process:

- Install fr-CA or another language in the OPAC
    1. Run the following commands:
        - gulp po:update
        - ./misc/translator/translate update fr-CA
        - ./misc/translator/translate install fr-CA
    2. Go to Administration > System preferences
    3. Search for OPACLanguages and check fr-CA
    4. Set opaclanguagesdisplay to Allow
    5. Click "Save all I18N/L10N preferences"

- Check that "Copy" is translated in the .po files
   1. Open misc/translator/po/fr-CA-messages-js.po
   2. Search for "Copy"
        --> It should be translated as "Copier"

- Log in to the OPAC as a user with checkouts.
- Switch to the language you translated.
- View the user summary page.
  - The controls at the top of the table of checkouts should be
    correctly translated.

- In the staff interface, switch to the language you translated.
- Test any DataTable with export controls, e.g. Administration ->
  Libraries, to confirm that the "Export" menu items are still
  translated correctly.

Sponsored-by: Athens County Public Libraries
Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Comment 3 Katrin Fischer 2024-07-09 12:39:39 UTC
Picked from QA queue by RM ;)
Comment 4 Katrin Fischer 2024-07-09 12:57:02 UTC
Pushed for 24.11!

Well done everyone, thank you!