Bugzilla – Attachment 107656 Details for
Bug 26118
Move translatable strings out of tags/review.tt and into tags-review.js
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26118: Move translatable strings out of tags/review.tt and into tags-review.js
Bug-26118-Move-translatable-strings-out-of-tagsrev.patch (text/plain), 8.42 KB, created by
Owen Leonard
on 2020-07-31 18:56:42 UTC
(
hide
)
Description:
Bug 26118: Move translatable strings out of tags/review.tt and into tags-review.js
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2020-07-31 18:56:42 UTC
Size:
8.42 KB
patch
obsolete
>From fdd8601cd1e30ef34643c0545785bf6c312b0dff Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Fri, 31 Jul 2020 17:19:00 +0000 >Subject: [PATCH] Bug 26118: Move translatable strings out of tags/review.tt > and into tags-review.js > >This patch removes the section of the tags review template which defined >strings for translation. They can now be embedded in the JavaScript >file, wrapped in the __() function. > >To test, apply the patch and clear your browser cache if necessary. > >- Go to Tools -> Tags and perform some actions which will trigger the > use of translated strings in the interface. For instance: > - Approving and rejecting tags > - Testing tags which are approved, rejected, or unclassified. > - Status messages for these operations should work correctly. > >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/tags-review.js for > translation, e.g.: > > msgid "Both subfield values should be filled or empty." > 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. >--- > .../intranet-tmpl/prog/en/modules/tags/review.tt | 16 ------------- > .../intranet-tmpl/prog/js/pages/tags-review.js | 28 +++++++++++----------- > 2 files changed, 14 insertions(+), 30 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tags/review.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tags/review.tt >index aa052ca7d9..32af227d02 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tags/review.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tags/review.tt >@@ -230,22 +230,6 @@ tr > td input,td input[type="submit"] { font-size: 85%; padding: 1px; } > [% INCLUDE 'calendar.inc' %] > [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %] > [% Asset.js("js/pages/tags-review.js") | $raw %] >- <script> >- var MSG_AJAX_APPROVE_FAILED = _("AJAX failed to approve tag: %s"); >- var MSG_AJAX_REJECTION_FAILED = _("AJAX failed to reject tag: %s"); >- var MSG_AJAX_TAG_PERMITTED = _("%s is permitted!"); >- var MSG_AJAX_TAG_PROHIBITED = _("%s is prohibited!"); >- var MSG_AJAX_TAG_UNCLASSIFIED = _("%s is neither permitted nor prohibited!"); >- var MSG_AJAX_ERROR = _("AJAX error (%s alert)"); >- var LABEL_SELECT_ALL = _("Select all"); >- var LABEL_CLEAR_ALL = _("Clear all"); >- var LABEL_SELECT_ALL_PENDING = _("Select all pending"); >- var LABEL_APPROVE = _("Approve"); >- var LABEL_APPROVED = _("Approved"); >- var LABEL_REJECT = _("Reject"); >- var LABEL_REJECTED = _("Rejected"); >- var LABEL_TESTING = _("Testing..."); >- </script> > [% END %] > > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/js/pages/tags-review.js b/koha-tmpl/intranet-tmpl/prog/js/pages/tags-review.js >index 7130d2f93f..842ffb9acf 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/pages/tags-review.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/pages/tags-review.js >@@ -35,22 +35,22 @@ var success_approve = function(tag){ > // window.alert(_("AJAX approved tag: ") + tag); > }; > var failure_approve = function(tag){ >- window.alert(MSG_AJAX_APPROVE_FAILED.format(decodeURIComponent( tag ))); >+ window.alert( __("AJAX failed to approve tag: %s").format(decodeURIComponent(tag)) ); > }; > var success_reject = function(tag){ > // window.alert(_("AJAX rejected tag: ") + tag); > }; > var failure_reject = function(tag){ >- window.alert(MSG_AJAX_REJECTION_FAILED.format(decodeURIComponent( tag ))); >+ window.alert( __("AJAX failed to reject tag: %s").format(decodeURIComponent(tag)) ); > }; > var success_test = function(tag){ >- $('#verdict').html(MSG_AJAX_TAG_PERMITTED.format( decodeURIComponent( tag ) )); >+ $('#verdict').html( __("%s is permitted!").format(decodeURIComponent(tag)) ); > }; > var failure_test = function(tag){ >- $('#verdict').html(MSG_AJAX_TAG_PROHIBITED.format( decodeURIComponent( tag ) )); >+ $('#verdict').html( __("%s is prohibited!").format(decodeURIComponent(tag)) ); > }; > var indeterminate_test = function(tag){ >- $('#verdict').html(MSG_AJAX_TAG_UNCLASSIFIED.format( decodeURIComponent( tag ) )); >+ $('#verdict').html( __("%s is neither permitted nor prohibited!").format(decodeURIComponent(tag)) ); > }; > > var success_test_call = function() { >@@ -69,7 +69,7 @@ $(document).ready(function() { > "sPaginationType": "full" > })); > $('.ajax_buttons' ).css({visibility:"visible"}); >- $("p.check").html("<div id=\"searchheader\"><a id=\"CheckAll\" href=\"/cgi-bin/koha/tags/review.pl\"><i class=\"fa fa-check\"><\/i> "+ LABEL_SELECT_ALL +"<\/a> | <a id=\"CheckNone\" href=\"/cgi-bin/koha/tags/review.pl\"><i class=\"fa fa-remove\"><\/i> "+ LABEL_CLEAR_ALL +"<\/a> | <a id=\"CheckPending\" href=\"/cgi-bin/koha/tags/review.pl\"> "+ LABEL_SELECT_ALL_PENDING +"<\/a><\/div>"); >+ $("p.check").html("<div id=\"searchheader\"><a id=\"CheckAll\" href=\"/cgi-bin/koha/tags/review.pl\"><i class=\"fa fa-check\" aria-hidden=\"false\"><\/i> " + __("Select all") + "<\/a> | <a id=\"CheckNone\" href=\"/cgi-bin/koha/tags/review.pl\"><i class=\"fa fa-remove\" aria-hidden=\"false\"><\/i> " + __("Clear all") + "<\/a> | <a id=\"CheckPending\" href=\"/cgi-bin/koha/tags/review.pl\"> " + __("Select all pending") + "<\/a><\/div>"); > $("#CheckAll").click(function(){ > $(".checkboxed").checkCheckboxes(); > return false; >@@ -96,12 +96,12 @@ $(document).ready(function() { > success: count_approve // success_approve > }); > $(event.target).next(".rej").prop('disabled', false).css("color","#000"); >- $(event.target).next(".rej").html("<i class='fa fa-remove'></i> " + _("Reject")); >+ $(event.target).next(".rej").html("<i class='fa fa-remove' aria-hidden='false'></i> " + __("Reject")); > $(event.target).prop('disabled', true).css("color","#666"); >- $(event.target).html("<i class='fa fa-check'></i> " + LABEL_APPROVED ); >+ $(event.target).html("<i class='fa fa-check' aria-hidden='false'></i> " + __("Approved") ); > getelement = $(event.target).data("num"); > gettitle = ".status" + getelement; >- $(gettitle).text( LABEL_APPROVED ); >+ $(gettitle).text( __("Approved") ); > if ($(gettitle).hasClass("pending") ){ > $(gettitle).toggleClass("pending approved"); > } else { >@@ -116,12 +116,12 @@ $(document).ready(function() { > success: count_reject // success_reject > }); > $(event.target).prev(".ok").prop('disabled', false).css("color","#000"); >- $(event.target).prev(".ok").html("<i class='fa fa-check'></i> " + LABEL_APPROVE ); >+ $(event.target).prev(".ok").html("<i class='fa fa-check' aria-hidden='false'></i> " + __("Approve")); > $(event.target).prop('disabled', true).css("color","#666"); >- $(event.target).html("<i class='fa fa-remove'></i> " + LABEL_REJECTED ); >+ $(event.target).html("<i class='fa fa-remove' aria-hidden='false'></i> " + __("Rejected")); > getelement = $(event.target).data("num"); > gettitle = ".status" + getelement; >- $(gettitle).text( LABEL_REJECTED ); >+ $(gettitle).text( __("Rejected") ); > if ($(gettitle).hasClass("pending") ){ > $(gettitle).toggleClass("pending rejected"); > } else { >@@ -130,7 +130,7 @@ $(document).ready(function() { > return false; // cancel submit > } > if ($(event.target).is('#test_button')) { >- $(event.target).text( LABEL_TESTING ).prop('disabled', true); >+ $(event.target).text( __("Testing...") ).prop('disabled', true); > $.ajax({ > data: { > test: $('#test').attr("value") >@@ -141,7 +141,7 @@ $(document).ready(function() { > } > }); > $("*").ajaxError(function(evt, request, settings){ >- if ((alerted +=1) <= 1){ window.alert(MSG_AJAX_ERROR.format(alerted)); } >+ if ((alerted +=1) <= 1){ window.alert( __("AJAX error (%s alert)").format(alerted) ); } > }); > > var reviewerField = $("#approver"); >-- >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 26118
:
107656
|
110755
|
110784