Bugzilla – Attachment 109772 Details for
Bug 26242
Move translatable strings out of results.tt and into results.js
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26242: Move translatable strings out of results.tt and into results.js
Bug-26242-Move-translatable-strings-out-of-results.patch (text/plain), 6.24 KB, created by
Alexis Ripetti
on 2020-09-08 20:52:57 UTC
(
hide
)
Description:
Bug 26242: Move translatable strings out of results.tt and into results.js
Filename:
MIME Type:
Creator:
Alexis Ripetti
Created:
2020-09-08 20:52:57 UTC
Size:
6.24 KB
patch
obsolete
>From 6fa1b42d915a06ebd09c1ae1f4c4cd8cdcac0ea1 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Tue, 18 Aug 2020 17:43:22 +0000 >Subject: [PATCH] Bug 26242: Move translatable strings out of results.tt and > into results.js > >This patch removes the definition of translatable strings out of >templates and into the corresponding JavaScript file, using the new JS >i81n function. > >To test: > >- Apply the patch and perform a catalog search which will return > multiple results. >- Without checking any checkboxes, click the "Add to Cart" button. You > should see a message, "No item was selected." >- The same should happen if you select an item from the "Add to list" > menu or click the "Place hold" button. >- Click the "Select all" link to check all checkboxes. >- Click the "Place hold" button. >- You will inevitably get a "One or more selected items cannot be placed > on hold." message. If you were to want to complete this process you > would have to painstakingly sift through each search result to find > which item couldn't be placed on hold so that you could uncheck the > corresponding checkbox. Luckily this test plan doesn't require you to > do that. >- If you don't get an error message you're living in a catalog utopia > unlike any I have ever seen. > >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/pages/results.js for translation, > e.g.: > > msgid "Nothing is selected" > 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: Alexis Ripetti <alexis.ripetti@inLibro.com> >--- > .../prog/en/modules/catalogue/results.tt | 2 -- > koha-tmpl/intranet-tmpl/prog/js/pages/results.js | 14 +++++++------- > 2 files changed, 7 insertions(+), 9 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt >index 912e3c8d35..442249e735 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt >@@ -709,8 +709,6 @@ > [% Asset.js("lib/hc-sticky.js") | $raw %] > [% Asset.js("js/coce.js") | $raw %] > <script> >- var MSG_NO_ITEM_SELECTED = _("Nothing is selected."); >- var MSG_NON_RESERVES_SELECTED = _("One or more selected items cannot be placed on hold."); > var PREF_AmazonCoverImages = parseInt( "[% Koha.Preference('AmazonCoverImages') | html %]", 10); > var q_array = new Array(); // will hold search terms, if present > var PREF_LocalCoverImages = parseInt( "[% Koha.Preference('LocalCoverImages') | html %]", 10); >diff --git a/koha-tmpl/intranet-tmpl/prog/js/pages/results.js b/koha-tmpl/intranet-tmpl/prog/js/pages/results.js >index d9978b08df..3ed034ee5a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/pages/results.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/pages/results.js >@@ -1,4 +1,4 @@ >-/* global KOHA biblionumber new_results_browser addMultiple vShelfAdd openWindow search_result SEARCH_RESULTS PREF_AmazonCoverImages PREF_LocalCoverImages PREF_IntranetCoce PREF_CoceProviders CoceHost CoceProviders addRecord delSingleRecord PREF_BrowseResultSelection resetSearchContext addBibToContext delBibToContext getContextBiblioNumbers MSG_NO_ITEM_SELECTED MSG_NO_ITEM_SELECTED holdfor_cardnumber holdforclub strQuery MSG_NON_RESERVES_SELECTED PREF_NotHighlightedWords PLACE_HOLD __ */ >+/* global KOHA biblionumber new_results_browser addMultiple vShelfAdd openWindow search_result SEARCH_RESULTS PREF_AmazonCoverImages PREF_LocalCoverImages PREF_IntranetCoce PREF_CoceProviders CoceHost CoceProviders addRecord delSingleRecord PREF_BrowseResultSelection resetSearchContext addBibToContext delBibToContext getContextBiblioNumbers holdfor_cardnumber holdforclub strQuery PREF_NotHighlightedWords PLACE_HOLD __ */ > > if( PREF_AmazonCoverImages ){ > $(window).load(function() { >@@ -223,7 +223,7 @@ function clearAll () { > function placeHold () { > var checkedItems = $(".selection:checked"); > if ($(checkedItems).size() == 0) { >- alert(MSG_NO_ITEM_SELECTED); >+ alert( __("Nothing is selected") ); > return false; > } > var bibs = ""; >@@ -231,7 +231,7 @@ function placeHold () { > $(checkedItems).each(function() { > var bib = $(this).val(); > if ($("#reserve_" + bib).size() == 0) { >- alert(MSG_NON_RESERVES_SELECTED); >+ alert( __("One or more selected items cannot be placed on hold.") ); > badBibs = true; > return false; > } >@@ -259,7 +259,7 @@ function browse_selection () { > browser.create(1, search_result.query_cgi, search_result.limit_cgi, search_result.sort_by, bibnums, bibnums.length); > window.location = '/cgi-bin/koha/catalogue/detail.pl?biblionumber=' + bibnums[0] + '&searchid='+browser.searchid; > } else { >- alert(MSG_NO_ITEM_SELECTED); >+ alert( __("Nothing is selected") ); > } > return false; > } >@@ -267,7 +267,7 @@ function browse_selection () { > function addToList () { > var checkedItems = $(".selection:checked"); > if ($(checkedItems).size() == 0) { >- alert(MSG_NO_ITEM_SELECTED); >+ alert( __("Nothing is selected") ); > return false; > } > var bibs = ""; >@@ -310,9 +310,9 @@ function verify_images() { > var w = this.width; > var h = this.height; > if ((w == 1) || (h == 1)) { >- $(this).parent().html('<span class="no-image">'+__("No cover image available")+'</span>'); >+ $(this).parent().html('<span class="no-image">'+ __("No cover image available") +'</span>'); > } else if ((this.complete != null) && (!this.complete)) { >- $(this).parent().html('<span class="no-image">'+__("No cover image available")+'</span>'); >+ $(this).parent().html('<span class="no-image">'+ __("No cover image available") +'</span>'); > } > } > }); >-- >2.25.1
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 26242
:
108535
|
109772
|
109992
|
110891