Bugzilla – Attachment 110811 Details for
Bug 26291
Move translatable strings out of z3950_search.inc into z3950_search.js
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26291: Move translatable strings out of z3950_search.inc into z3950_search.js
Bug-26291-Move-translatable-strings-out-of-z3950se.patch (text/plain), 7.41 KB, created by
David Nind
on 2020-09-27 02:19:21 UTC
(
hide
)
Description:
Bug 26291: Move translatable strings out of z3950_search.inc into z3950_search.js
Filename:
MIME Type:
Creator:
David Nind
Created:
2020-09-27 02:19:21 UTC
Size:
7.41 KB
patch
obsolete
>From ae4e8569357410c13a7e0ea84855d5c875c9cc4f Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Mon, 24 Aug 2020 18:25:35 +0000 >Subject: [PATCH] Bug 26291: Move translatable strings out of z3950_search.inc > into z3950_search.js > >This patch moves translatable strings out of z3950_search.inc into >z3950_search.js, wrapped in the double-underscore function for >translation. > >To test, apply the patch and go to Cataloging. > > - Click "New from Z39.50/SRU" > - In the search form, uncheck all search targets and submit the form. > You should get an error: "Please choose at least one external target" > - Peform a search which will return multiple pages of results. > - Test that you can enter a number in the "Go to page" form to > navigate to a specific page. > - Enter a non-number in the field and submit. You should get an error, > "The page entered is not a number." > - Enter a number in the field which is greater than the number of pages > of results. Submitting the form should trigger an error, "The page > should be a number between 1 and 10." > > - Perform the same tests from the other Z39.50 search results > interfaces: > - Acquisitions -> Add to basket -> From an external source. > - Authorities -> New authority -> New from Z39.50/SRU. > >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, e.g. > misc/translator/po/fr-FR-messages-js.po >- Locate strings pulled from > koha-tmpl/intranet-tmpl/prog/js/z3950_search.js for translation, > e.g.: > > msgid "The page entered is not a number." > msgstr "" > >- Edit the "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 in the staff client > and repeat the test plan above. The translated strings should > appear. > >Signed-off-by: David Nind <david@davidnind.com> >--- > .../prog/en/includes/z3950_search.inc | 23 +--------------------- > .../prog/en/modules/acqui/z3950_search.tt | 2 +- > .../en/modules/cataloguing/z3950_auth_search.tt | 2 +- > .../prog/en/modules/cataloguing/z3950_search.tt | 6 +++--- > koha-tmpl/intranet-tmpl/prog/js/z3950_search.js | 16 ++++++++++++++- > 5 files changed, 21 insertions(+), 28 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/z3950_search.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/z3950_search.inc >index a4bf326b2a..56d262d5db 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/z3950_search.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/z3950_search.inc >@@ -1,28 +1,7 @@ > <!-- z3950_search.inc --> > <script> >- >- var MSG_CHOOSE_Z3950 = _("Please choose at least one external target"); >- >-[% IF ( total_pages ) %] > var interface = "[% interface | html %]"; > var theme = "[% theme | html %]"; >- var MSG_LOADING = _("Loading"); >- >-function validate_goto_page(){ >- var page = $('#goto_page').val(); >- if(isNaN(page)) { >- alert(_("The page entered is not a number.")); >- return false; >- } >- else if(page < 1 || page > [% total_pages | html %] ) { >- alert(_("The page should be a number between 1 and %s.").format([% total_pages | html %])); >- return false; >- } >- else { >- return true; >- } >-} >-[% END %] >- >+ var total_pages = new Number("[% total_pages | html %]"); > </script> > <!-- / z3950_search.inc --> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/z3950_search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/z3950_search.tt >index 7958e89d26..e8dc607e1a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/z3950_search.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/z3950_search.tt >@@ -230,6 +230,7 @@ tr.selected { background-color : #FFFFCC; } tr.selected td { background-color : > [% MACRO jsinclude BLOCK %] > [% Asset.js("js/acquisitions-menu.js") | $raw %] > [% INCLUDE 'datatables.inc' %] >+ [% INCLUDE 'z3950_search.inc' %] > [% Asset.js("js/z3950_search.js") | $raw %] > <script> > $(document).ready(function(){ >@@ -243,7 +244,6 @@ tr.selected { background-color : #FFFFCC; } tr.selected td { background-color : > })); > }); > </script> >- [% INCLUDE 'z3950_search.inc' %] > [% END %] > > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_auth_search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_auth_search.tt >index 7335ac67ea..51aa454619 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_auth_search.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_auth_search.tt >@@ -169,6 +169,7 @@ > > [% MACRO jsinclude BLOCK %] > [% INCLUDE 'datatables.inc' %] >+ [% INCLUDE 'z3950_search.inc' %] > [% Asset.js("js/z3950_search.js") | $raw %] > <script> > $(document).ready(function(){ >@@ -182,7 +183,6 @@ > })); > }); > </script> >- [% INCLUDE 'z3950_search.inc' %] > [% END %] > > [% INCLUDE 'intranet-bottom.inc' popup_window=1 %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_search.tt >index 7053d81a25..8649164d41 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_search.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_search.tt >@@ -236,9 +236,10 @@ > [% END %] > > [% MACRO jsinclude BLOCK %] >- [% Asset.js("js/z3950_search.js") | $raw %] >- [% INCLUDE 'datatables.inc' %] > [% INCLUDE 'columns_settings.inc' %] >+ [% INCLUDE 'datatables.inc' %] >+ [% INCLUDE 'z3950_search.inc' %] >+ [% Asset.js("js/z3950_search.js") | $raw %] > <script> > $(document).ready(function(){ > var columns_settings = [% TablesSettings.GetColumns( 'cataloguing', 'z3950_search', 'resultst', 'json' ) | $raw %]; >@@ -256,7 +257,6 @@ > $("#result_pagenumbers").hide(); > } > </script> >- [% INCLUDE 'z3950_search.inc' %] > [% END %] > > [% INCLUDE 'intranet-bottom.inc' popup_window=1 %] >diff --git a/koha-tmpl/intranet-tmpl/prog/js/z3950_search.js b/koha-tmpl/intranet-tmpl/prog/js/z3950_search.js >index 368aacb22d..83170e9ed2 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/z3950_search.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/z3950_search.js >@@ -1,3 +1,4 @@ >+/* global __ total_pages */ > //z3950_search.js for Authorities, Bib records and Acquisitions module > function Import(Breeding, recordid, AuthType, FrameworkCode) { > >@@ -11,6 +12,19 @@ function Import(Breeding, recordid, AuthType, FrameworkCode) { > > } > >+function validate_goto_page() { >+ var page = $('#goto_page').val(); >+ if (isNaN(page)) { >+ alert( __("The page entered is not a number.") ); >+ return false; >+ } else if (page < 1 || page > total_pages) { >+ alert( __("The page should be a number between 1 and %s.").format(total_pages) ); >+ return false; >+ } else { >+ return true; >+ } >+} >+ > $( document ).ready( function() { > > $( "#CheckAll" ).click( function(e) { >@@ -44,7 +58,7 @@ $( document ).ready( function() { > }); > $( "form[name='f']" ).submit( function() { > if ( $( 'input[type=checkbox]' ).filter( ':checked' ).length == 0 ) { >- alert( MSG_CHOOSE_Z3950 ); >+ alert( __("Please choose at least one external target") ); > $( "body" ).css( "cursor", "default" ); > return false; > } else { >-- >2.11.0
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 26291
:
109032
|
110811
|
110828
|
110904