Bug 33983 - Move translatable strings out of OPAC's datatables.inc into JavaScript
Summary: Move translatable strings out of OPAC's datatables.inc into JavaScript
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Owen Leonard
QA Contact: Katrin Fischer
URL:
Keywords:
Depends on: 21156
Blocks: 34026
  Show dependency treegraph
 
Reported: 2023-06-12 13:10 UTC by Owen Leonard
Modified: 2023-10-14 12:15 UTC (History)
4 users (show)

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


Attachments
Bug 33983: Move translatable strings out of OPAC's datatables.inc into JavaScript (20.86 KB, patch)
2023-06-12 16:35 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 33983: Move translatable strings out of OPAC's datatables.inc into JavaScript (7.70 KB, patch)
2023-06-16 14:26 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 33983: Move translatable strings out of OPAC's datatables.inc into JavaScript (7.75 KB, patch)
2023-10-07 21:22 UTC, David Nind
Details | Diff | Splinter Review
Bug 33983: Move translatable strings out of OPAC's datatables.inc into JavaScript (7.80 KB, patch)
2023-10-08 13:43 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Owen Leonard 2023-06-12 13:10:24 UTC
Strings defined for translation in datatables.inc in the OPAC can should be wrapped in the new translation function inside datatables.js.
Comment 1 Owen Leonard 2023-06-12 16:35:42 UTC Comment hidden (obsolete)
Comment 2 Jonathan Druart 2023-06-14 09:04:53 UTC
I would add the PROCESS i18n in doc-head-close
Comment 3 Owen Leonard 2023-06-15 18:33:40 UTC
(In reply to Jonathan Druart from comment #2)
> I would add the PROCESS i18n in doc-head-close

In my experience this doesn't work. I love to know why not and whether there's an alternative to updating individual templates.
Comment 4 Jonathan Druart 2023-06-16 14:02:34 UTC
Actually I don't understand why you are adding the PROCESS to the different templates.

__ is defined in js/i18n.js

Here you don't remove/move lines that are using the I18N TT plugin.
Comment 5 Owen Leonard 2023-06-16 14:26:53 UTC
Created attachment 152419 [details] [review]
Bug 33983: Move translatable strings out of OPAC's datatables.inc into JavaScript

This patch removes the definition of translatable strings out of
the OPAC datatables.inc file and into datatables.js using the new JS
i81n function.

To test apply the patch and test some DataTable-driven tables in the
OPAC. A list of possible examples:

- Cart
- Bibliographic detail page
  - Place hold (with OPAC item level holds enabled in circulation rules)
    - Show more options ->
      - A specific item
- Bibliographic detail page for a serial record ->
  - More details ->
    - Full history
- Most popular
- Self checkout
- Logged in user ->
  - Charges
  - Curbside pickups
  - Messaging
  - Checkout history
  - Suggestions
  - Holds history
  - Tags
  - Recalls history
  - Search history
  - ILL requests

DataTables functionality should be unaffected. Check that the strings
defined for translation are still working. For instance the "Clear
filter" label on user summary checkouts, or the "No matching records
found" text displayed when you search a table for a string that doesn't
exist.

TESTING TRANSLATABILITY

- Update a translation, e.g. fr-FR:

  > cd misc/translator
  > perl translate update fr-FR

- Open the corresponding .po file for JavaScript strings, in this case
  misc/translator/po/fr-FR-messages-js.po
- Locate strings pulled from
  koha-tmpl/intranet-tmpl/prog/js/members.js for translation, e.g.:

  msgid "Clear filter"

- Edit the corresponding "msgstr" string however you want (it's just for
  testing).
- Install the updated translation:

  > perl translate install fr-FR

- Switch to your newly translated language and repeat the test plan
  above. The translated strings should appear.
Comment 6 David Nind 2023-10-07 21:22:49 UTC
Created attachment 156702 [details] [review]
Bug 33983: Move translatable strings out of OPAC's datatables.inc into JavaScript

This patch removes the definition of translatable strings out of
the OPAC datatables.inc file and into datatables.js using the new JS
i81n function.

To test apply the patch and test some DataTable-driven tables in the
OPAC. A list of possible examples:

- Cart
- Bibliographic detail page
  - Place hold (with OPAC item level holds enabled in circulation rules)
    - Show more options ->
      - A specific item
- Bibliographic detail page for a serial record ->
  - More details ->
    - Full history
- Most popular
- Self checkout
- Logged in user ->
  - Charges
  - Curbside pickups
  - Messaging
  - Checkout history
  - Suggestions
  - Holds history
  - Tags
  - Recalls history
  - Search history
  - ILL requests

DataTables functionality should be unaffected. Check that the strings
defined for translation are still working. For instance the "Clear
filter" label on user summary checkouts, or the "No matching records
found" text displayed when you search a table for a string that doesn't
exist.

TESTING TRANSLATABILITY

- Update a translation, e.g. fr-FR:

  > cd misc/translator
  > perl translate update fr-FR

- Open the corresponding .po file for JavaScript strings, in this case
  misc/translator/po/fr-FR-messages-js.po
- Locate strings pulled from
  koha-tmpl/intranet-tmpl/prog/js/members.js for translation, e.g.:

  msgid "Clear filter"

- Edit the corresponding "msgstr" string however you want (it's just for
  testing).
- Install the updated translation:

  > perl translate install fr-FR

- Switch to your newly translated language and repeat the test plan
  above. The translated strings should appear.

Signed-off-by: David Nind <david@davidnind.com>
Comment 7 David Nind 2023-10-07 21:29:06 UTC
Testing notes (using KTD):

1. I tested all the suggested areas, except for ILL requests.

2. Two things I noted that are not related to this bug (new bugs required if they don't exist already):
   2.1 OPAC detail page - holdings table: sorting for the 'Current library' column doesn't work, for example using record 126 (Intermediate Perl)
   2.2 Self checkout page: table heading row colour - for the checkout tab it has a background colour, for the other tabs (such as accounting) the backgroudn colour is white
Comment 8 Katrin Fischer 2023-10-08 13:34:31 UTC
(In reply to David Nind from comment #7)
> Testing notes (using KTD):
> 
> 1. I tested all the suggested areas, except for ILL requests.
> 
> 2. Two things I noted that are not related to this bug (new bugs required if
> they don't exist already):
>    2.1 OPAC detail page - holdings table: sorting for the 'Current library'
> column doesn't work, for example using record 126 (Intermediate Perl)
>    2.2 Self checkout page: table heading row colour - for the checkout tab
> it has a background colour, for the other tabs (such as accounting) the
> backgroudn colour is white

I haven't seen bugs for these yet.
Comment 9 Katrin Fischer 2023-10-08 13:39:47 UTC
I wonder why we haven't made these configurable (unrelated to patch):
-    var config_exclude_articles_from_sort = window.CONFIG_EXCLUDE_ARTICLES_FROM_SORT || "a an the";
+    var config_exclude_articles_from_sort = __("a an the");
Comment 10 Katrin Fischer 2023-10-08 13:43:17 UTC
Created attachment 156705 [details] [review]
Bug 33983: Move translatable strings out of OPAC's datatables.inc into JavaScript

This patch removes the definition of translatable strings out of
the OPAC datatables.inc file and into datatables.js using the new JS
i81n function.

To test apply the patch and test some DataTable-driven tables in the
OPAC. A list of possible examples:

- Cart
- Bibliographic detail page
  - Place hold (with OPAC item level holds enabled in circulation rules)
    - Show more options ->
      - A specific item
- Bibliographic detail page for a serial record ->
  - More details ->
    - Full history
- Most popular
- Self checkout
- Logged in user ->
  - Charges
  - Curbside pickups
  - Messaging
  - Checkout history
  - Suggestions
  - Holds history
  - Tags
  - Recalls history
  - Search history
  - ILL requests

DataTables functionality should be unaffected. Check that the strings
defined for translation are still working. For instance the "Clear
filter" label on user summary checkouts, or the "No matching records
found" text displayed when you search a table for a string that doesn't
exist.

TESTING TRANSLATABILITY

- Update a translation, e.g. fr-FR:

  > cd misc/translator
  > perl translate update fr-FR

- Open the corresponding .po file for JavaScript strings, in this case
  misc/translator/po/fr-FR-messages-js.po
- Locate strings pulled from
  koha-tmpl/intranet-tmpl/prog/js/members.js for translation, e.g.:

  msgid "Clear filter"

- Edit the corresponding "msgstr" string however you want (it's just for
  testing).
- Install the updated translation:

  > perl translate install fr-FR

- Switch to your newly translated language and repeat the test plan
  above. The translated strings should appear.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 11 David Nind 2023-10-08 18:53:11 UTC
(In reply to Katrin Fischer from comment #8)

> I haven't seen bugs for these yet.

I've now created two bugs for these:
- Bug 35006 - OPAC holdings table - sort for current library column doesn't work
- Bug 35007 - Self checkout system (SCO) - table heading row background colour in tabs is inconsistent
Comment 12 Tomás Cohen Arazi 2023-10-09 14:42:35 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 13 Fridolin Somers 2023-10-09 17:00:41 UTC
Enhancement not pushed to 23.05.x