Bugzilla – Attachment 156702 Details for
Bug 33983
Move translatable strings out of OPAC's datatables.inc into JavaScript
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33983: Move translatable strings out of OPAC's datatables.inc into JavaScript
Bug-33983-Move-translatable-strings-out-of-OPACs-d.patch (text/plain), 7.75 KB, created by
David Nind
on 2023-10-07 21:22:49 UTC
(
hide
)
Description:
Bug 33983: Move translatable strings out of OPAC's datatables.inc into JavaScript
Filename:
MIME Type:
Creator:
David Nind
Created:
2023-10-07 21:22:49 UTC
Size:
7.75 KB
patch
obsolete
>From 1fc48367079f0f7003f7a77a4905221906686864 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Fri, 16 Jun 2023 14:22:08 +0000 >Subject: [PATCH] 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> >--- > .../bootstrap/en/includes/datatables.inc | 22 ---------- > .../opac-tmpl/bootstrap/js/datatables.js | 40 +++++++++---------- > 2 files changed, 20 insertions(+), 42 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/datatables.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/datatables.inc >index 91a6f1ccb1..23f98c23c0 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/datatables.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/datatables.inc >@@ -2,26 +2,4 @@ > [% USE Asset %] > [% Asset.js("lib/jquery/plugins/jquery.dataTables.min.js") | $raw %] > [% Asset.js("lib/jquery/plugins/dataTables.responsive.min.js") | $raw %] >-<script> >- var MSG_DT_FIRST = _("First"); >- var MSG_DT_LAST = _("Last"); >- var MSG_DT_NEXT = _("Next"); >- var MSG_DT_PREVIOUS = _("Previous"); >- var MSG_DT_EMPTY_TABLE = _("No data available in table"); >- var MSG_DT_INFO = _("Showing _START_ to _END_ of _TOTAL_"); >- var MSG_DT_INFO_EMPTY = _("No entries to show"); >- var MSG_DT_INFO_FILTERED = _("(filtered from _MAX_ total entries)"); >- var MSG_DT_LENGTH_MENU = _("Show _MENU_ entries"); >- var MSG_DT_LOADING_RECORDS = _("Loading..."); >- var MSG_DT_PROCESSING = _("Processing..."); >- var MSG_DT_SEARCH = _("Search:"); >- var MSG_DT_ZERO_RECORDS = _("No matching records found"); >- var MSG_DT_COPY_TO_CLIPBOARD = _("Copy to clipboard"); >- var MSG_DT_COPY_KEYS = _("Press <i>ctrl</i> or <i>â</i> + <i>C</i> to copy the table data<br>to your system clipboard.<br><br>To cancel, click this message or press escape."); >- var MSG_DT_COPIED_ROWS = _("Copied %d rows to clipboard"); >- var MSG_DT_COPIED_ONE_ROW = _("Copied one row to clipboard"); >- var MSG_CLEAR_FILTER = _("Clear filter"); >- var MSG_DT_ALL = _("All"); >- var CONFIG_EXCLUDE_ARTICLES_FROM_SORT = _("a an the"); >-</script> > [% Asset.js("js/datatables.js") | $raw %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/datatables.js b/koha-tmpl/opac-tmpl/bootstrap/js/datatables.js >index 776b3bbdc7..185df7b7b4 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/js/datatables.js >+++ b/koha-tmpl/opac-tmpl/bootstrap/js/datatables.js >@@ -8,26 +8,26 @@ > var dataTablesDefaults = { > "language": { > "paginate": { >- "first" : window.MSG_DT_FIRST || "First", >- "last" : window.MSG_DT_LAST || "Last", >- "next" : window.MSG_DT_NEXT || "Next", >- "previous" : window.MSG_DT_PREVIOUS || "Previous" >+ "first" : __("First"), >+ "last" : __("Last"), >+ "next" : __("Next"), >+ "previous" : __("Previous") > }, >- "emptyTable" : window.MSG_DT_EMPTY_TABLE || "No data available in table", >- "info" : window.MSG_DT_INFO || "Showing _START_ to _END_ of _TOTAL_ entries", >- "infoEmpty" : window.MSG_DT_INFO_EMPTY || "No entries to show", >- "infoFiltered" : window.MSG_DT_INFO_FILTERED || "(filtered from _MAX_ total entries)", >- "lengthMenu" : window.MSG_DT_LENGTH_MENU || "Show _MENU_ entries", >- "loadingRecords" : window.MSG_DT_LOADING_RECORDS || "Loading...", >- "processing" : window.MSG_DT_PROCESSING || "Processing...", >- "search" : window.MSG_DT_SEARCH || "Search:", >- "zeroRecords" : window.MSG_DT_ZERO_RECORDS || "No matching records found", >+ "emptyTable" : __("No data available in table"), >+ "info" : __("Showing _START_ to _END_ of _TOTAL_ entries"), >+ "infoEmpty" : __("No entries to show"), >+ "infoFiltered" : __("(filtered from _MAX_ total entries)"), >+ "lengthMenu" : __("Show _MENU_ entries"), >+ "loadingRecords" : __("Loading..."), >+ "processing" : __("Processing..."), >+ "search" : __("Search:"), >+ "zeroRecords" : __("No matching records found"), > buttons: { >- "copyTitle" : window.MSG_DT_COPY_TO_CLIPBOARD || "Copy to clipboard", >- "copyKeys" : window.MSG_DT_COPY_KEYS || "Press <i>ctrl</i> or <i>â</i> + <i>C</i> to copy the table data<br>to your system clipboard.<br><br>To cancel, click this message or press escape.", >+ "copyTitle" : __("Copy to clipboard"), >+ "copyKeys" : __("Press <i>ctrl</i> or <i>â</i> + <i>C</i> to copy the table data<br>to your system clipboard.<br><br>To cancel, click this message or press escape."), > "copySuccess": { >- _: window.MSG_DT_COPIED_ROWS || "Copied %d rows to clipboard", >- 1: window.MSG_DT_COPIED_ONE_ROW || "Copied one row to clipboard", >+ _: __("Copied %d rows to clipboard"), >+ 1: __("Copied one row to clipboard"), > }, > "print": __("Print") > } >@@ -55,9 +55,9 @@ var dataTablesDefaults = { > $.fn.dataTable.ext.buttons.clearFilter = { > fade: 100, > className: "dt_button_clear_filter", >- titleAttr: window.MSG_CLEAR_FILTER, >+ titleAttr: __("Clear filter"), > enabled: false, >- text: '<i class="fa fa-lg fa-times"></i> <span class="dt-button-text">' + window.MSG_CLEAR_FILTER + '</span>', >+ text: '<i class="fa fa-lg fa-times"></i> <span class="dt-button-text">' + __("Clear filter") + '</span>', > available: function ( dt ) { > // The "clear filter" button is made available if this test returns true > if( dt.settings()[0].aanFeatures.f ){ // aanFeatures.f is null if there is no search form >@@ -85,7 +85,7 @@ $.fn.dataTable.ext.buttons.clearFilter = { > * from a configuration file (in English, "a," "an," and "the") > */ > >- var config_exclude_articles_from_sort = window.CONFIG_EXCLUDE_ARTICLES_FROM_SORT || "a an the"; >+ var config_exclude_articles_from_sort = __("a an the"); > if (config_exclude_articles_from_sort){ > var articles = config_exclude_articles_from_sort.split(" "); > var rpattern = ""; >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 33983
:
152277
|
152419
|
156702
|
156705