Bugzilla – Attachment 152530 Details for
Bug 34035
Move translatable strings out of opac-bottom.inc: Tags
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34035: Move translatable strings out of opac-bottom.inc: Tags
Bug-34035-Move-translatable-strings-out-of-opac-bo.patch (text/plain), 10.65 KB, created by
Owen Leonard
on 2023-06-21 15:55:51 UTC
(
hide
)
Description:
Bug 34035: Move translatable strings out of opac-bottom.inc: Tags
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2023-06-21 15:55:51 UTC
Size:
10.65 KB
patch
obsolete
>From 85c51046498b4ae1f3e57c87287f3d8acc5b87df Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Fri, 16 Jun 2023 13:39:40 +0000 >Subject: [PATCH] Bug 34035: Move translatable strings out of opac-bottom.inc: > Tags > >This patch removes the definition of JS variables in opac-bottom.inc >related to the tags feature. These strings can be wrapped in the __() >function inside tags.js and they'll get picked up for translation. > >Some other tags-related JS variable definitions are removed from >templates in favor of embedding them directly in the <script> block. > >To test you must have TagsEnabled set to "Allow." Apply the patch and >log in to the OPAC. > >- Perform a catalog search and select some items in the result list. > - Add the items to the cart and open the cart. > - Check a box next to one of the titles in the cart. > - Click the "Tag" link > - Submit the "New tag" form without entering a tag. You should see > "No tag was specified." > - Perform the same test on the search results page both using the > checkboxes and by clicking the "Add tag" link on an individual > result. > - Perform the same test on the bibliographic detail page. > - When adding tags from the cart, result list, or detail page, confirm > that the "Tags added: X" message is always displayed. > - Test adding a tag to a title which is already attached to that > title. > - Test adding HTML markup, e.g. "<script>" > - Test adding HTML markup and plain text, e.g. "<script>Foo" >--- > .../bootstrap/en/includes/opac-bottom.inc | 16 ------------ > .../bootstrap/en/modules/opac-basket.tt | 2 +- > .../bootstrap/en/modules/opac-detail.tt | 2 +- > .../bootstrap/en/modules/opac-results.tt | 4 +-- > .../bootstrap/en/modules/opac-shelves.tt | 4 +-- > koha-tmpl/opac-tmpl/bootstrap/js/tags.js | 26 +++++++++---------- > 6 files changed, 19 insertions(+), 35 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc >index 9d083a887e..c0b7326e6e 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc >@@ -132,22 +132,6 @@ > [% END %] > > <script> >- [% IF ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'TagsEnabled' ) == 1 ) %] >- var MSG_TAGS_DISABLED = _("Sorry, tags are not enabled on this system."); >- var MSG_TAG_ALL_BAD = _("Error! Your tag was entirely markup code. It was NOT added. Please try again with plain text."); >- var MSG_ILLEGAL_PARAMETER = _("Error! Illegal parameter"); >- var MSG_TAG_SCRUBBED = _("Note: your tag contained markup code that was removed. The tag was added as "); >- var MSG_ADD_TAG_FAILED = _("Error! Adding tags failed at"); >- var MSG_ADD_TAG_FAILED_NOTE = _("Note: you can only tag an item with a given term once. Check 'My Tags' to see your current tags."); >- var MSG_DELETE_TAG_FAILED = _("Error! You cannot delete the tag"); >- var MSG_DELETE_TAG_FAILED_NOTE = _("Note: you can only delete your own tags.") >- var MSG_LOGIN_REQUIRED = _("You must be logged in to add tags."); >- var MSG_TAGS_ADDED = _("Tags added: "); >- var MSG_TAGS_DELETED = _("Tags added: "); >- var MSG_TAGS_ERRORS = _("Errors: "); >- var MSG_MULTI_ADD_TAG_FAILED = _("Unable to add one or more tags."); >- var MSG_NO_TAG_SPECIFIED = _("No tag was specified."); >- [% END %] > [% IF (query_desc) %] > var query_desc = "[% query_desc | html %]"; > var querystring = "[% querystring | html %]"; >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt >index 7b20dad9c3..0ca985ac64 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt >@@ -395,7 +395,7 @@ > > var tag = $("#tagsel_new").val(); > if (!tag || (tag == "")) { >- alert(MSG_NO_TAG_SPECIFIED); >+ alert( _("No tag was specified.") ); > return false; > } > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >index 59b4c05391..32e593541f 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >@@ -1797,7 +1797,7 @@ > var thisid = $(this).attr("title"); > var tag = $("#newtag"+thisid).val(); > if (!tag || (tag == "")) { >- alert(MSG_NO_TAG_SPECIFIED); >+ alert( _("No tag was specified.") ); > return false; > } > KOHA.Tags.add_tag_button(thisid, tag); >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt >index d3d3705421..5e660df3d7 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt >@@ -647,7 +647,7 @@ > > var tag = $("#tagsel_new").val(); > if (!tag || (tag == "")) { >- alert(MSG_NO_TAG_SPECIFIED); >+ alert( _("No tag was specified.") ); > return false; > } > >@@ -888,7 +888,7 @@ > var thisid = $(this).attr("title"); > var tag = $("#newtag"+thisid).val(); > if (!tag || (tag == "")) { >- alert(MSG_NO_TAG_SPECIFIED); >+ alert( _("No tag was specified.") ); > return false; > } > KOHA.Tags.add_tag_button(thisid, tag); >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >index 1bf9ae87d4..3f1153d5f7 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >@@ -882,7 +882,7 @@ var MSG_CONFIRM_REMOVE_SHARE = _("Are you sure you want to remove this share?"); > > var tag = $("#tagsel_new").val(); > if (!tag || (tag == "")) { >- alert(MSG_NO_TAG_SPECIFIED); >+ alert( _("No tag was specified.") ); > return false; > } > >@@ -975,7 +975,7 @@ $(function() { > var thisid = $(this).attr("title"); > var tag = $("#newtag"+thisid).val(); > if (!tag || (tag == "")) { >- alert(MSG_NO_TAG_SPECIFIED); >+ alert( _("No tag was specified.") ); > return false; > } > KOHA.Tags.add_tag_button(thisid, tag); >diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/tags.js b/koha-tmpl/opac-tmpl/bootstrap/js/tags.js >index 5e4bab5bc5..b7b7612c8e 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/js/tags.js >+++ b/koha-tmpl/opac-tmpl/bootstrap/js/tags.js >@@ -39,9 +39,9 @@ KOHA.Tags = { > }, > common_status : function(addcount, delcount, errcount) { > var cstat = ""; >- if (addcount && addcount > 0) {cstat += MSG_TAGS_ADDED + addcount + ". " ;} >- if (delcount && delcount > 0) {cstat += MSG_TAGS_DELETED + delcount + ". " ;} >- if (errcount && errcount > 0) {cstat += MSG_TAGS_ERRORS + errcount + ". " ;} >+ if (addcount && addcount > 0) {cstat += __("Tags added: ") + addcount + ". " ;} >+ if (delcount && delcount > 0) {cstat += __("Tags deleted: ") + delcount + ". " ;} >+ if (errcount && errcount > 0) {cstat += __("Errors: ") + errcount + ". " ;} > return cstat; > }, > set_tag_status : function(tagid, newstatus) { >@@ -57,13 +57,13 @@ KOHA.Tags = { > }, > > tag_message: { >- tagsdisabled : function(arg) {return (MSG_TAGS_DISABLED);}, >- scrubbed_all_bad : function(arg) {return (MSG_TAG_ALL_BAD);}, >- badparam : function(arg) {return (MSG_ILLEGAL_PARAMETER+" "+arg);}, >- scrubbed : function(arg) {return (MSG_TAG_SCRUBBED+" "+arg);}, >- failed_add_tag : function(arg) {return (MSG_ADD_TAG_FAILED+ " '"+arg+"'. \n"+MSG_ADD_TAG_FAILED_NOTE);}, >- failed_delete : function(arg) {return (MSG_DELETE_TAG_FAILED+ " '"+arg+"'. \n"+MSG_DELETE_TAG_FAILED_NOTE);}, >- login : function(arg) {return (MSG_LOGIN_REQUIRED);} >+ tagsdisabled : function(arg) {return ( __("Sorry, tags are not enabled on this system.") );}, >+ scrubbed_all_bad : function(arg) {return ( __("Error! Your tag was entirely markup code. It was NOT added. Please try again with plain text.") );}, >+ badparam : function(arg) {return ( __("Error! Illegal parameter") +" "+arg);}, >+ scrubbed : function(arg) {return ( __("Note: your tag contained markup code that was removed. The tag was added as ") +" "+arg);}, >+ failed_add_tag : function(arg) {return ( __("Error! Adding tags failed at") + " '"+arg+"'. \n"+ __("Note: you can only tag an item with a given term once. Check 'Tags' to see your current tags.") );}, >+ failed_delete : function(arg) {return ( __("Error! You cannot delete the tag") + " '"+arg+"'. \n"+ __("Note: you can only delete your own tags.") );}, >+ login : function(arg) {return ( __("You must be logged in to add tags.") );} > }, > > // Used to tag multiple items at once. The main difference >@@ -93,7 +93,7 @@ KOHA.Tags = { > if (response[bib]) { > var added = response[bib]["added"]; > if (added > 0) { >- status = MSG_TAGS_ADDED + added + ". "; >+ status = __("Tags added: ") + added + ". "; > KOHA.Tags.set_tag_status(mytagid + "_status", status); > } > >@@ -103,7 +103,7 @@ KOHA.Tags = { > bibErrors = true; > var errid = "tagerr_" + bib; > var errstat = "<a id=\"" + errid + "\" class=\"tagerror\" href=\"#\">"; >- errstat += MSG_TAGS_ERRORS + errors.length + ". "; >+ errstat += __("Errors: ") + errors.length + ". "; > errstat += "</a>"; > KOHA.Tags.append_tag_status(mytagid + "_status", errstat); > var errmsg = ""; >@@ -123,7 +123,7 @@ KOHA.Tags = { > if (bibErrors || response["global_errors"]) { > var msg = ""; > if (bibErrors) { >- msg = MSG_MULTI_ADD_TAG_FAILED; >+ msg = __("Unable to add one or more tags."); > } > > // Show global errors in a dialog. >-- >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 34035
:
152416
|
152525
|
152526
|
152529
|
152530
|
156698
|
156699
|
156710
|
156711