Bugzilla – Attachment 130026 Details for
Bug 26257
Move translatable strings out of subscription-add.tt and into subscription-add.js
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26257: Move translatable strings out of subscription-add.tt and into subscription-add.js
Bug-26257-Move-translatable-strings-out-of-subscri.patch (text/plain), 14.19 KB, created by
Katrin Fischer
on 2022-01-31 22:24:08 UTC
(
hide
)
Description:
Bug 26257: Move translatable strings out of subscription-add.tt and into subscription-add.js
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2022-01-31 22:24:08 UTC
Size:
14.19 KB
patch
obsolete
>From ef2fa981ee35062d27fe23366a7ebed8a301296f Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Wed, 19 Aug 2020 19:50:01 +0000 >Subject: [PATCH] Bug 26257: Move translatable strings out of > subscription-add.tt and into subscription-add.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 go to Serials -> New subscription >- Click "Next" without filling out any fields. You should get two > confirmations, "If you wish to claim late or missing issues you must > link this subscription to a vendor. Click OK to ignore or Cancel to > return and enter a vendor" and "You must choose or create a > bibliographic record." >- Manually enter a vendor number which doesn't exist and click "Next." > Error: "The vendor does not exist." >- Manually enter a record number which doesn't exist and click "Next." > Error: "Bibliographic record does not exist!" >- Select a valid vendor and bibliographic record and proceed to the next > page. >- Click "Test prediction pattern" without filling in any fields. Error: > "Cannot test prediction pattern for the following reason(s): Frequency > is not defined. - First publication date is not defined" >- Click "Save subscription" without filling in any information. Error: > "You must choose a first publication date." >- Fill in a date and click "Save subscription." Error: "You must choose > a subscription length or an end date." >- Enter a frequency and subscription start date and click "Save > subscription." Error: "Please click on 'Test prediction pattern' > before saving subscription." >- Click "Show advanced pattern" and then "Save subscription." Error: > "You have modified the advanced prediction pattern. Please save your > work or cancel modifications." > >Testing numbering patterns: > >- There are several strings related to setting and editing numbering > patterns but I don't think they can be tested live while Bug 28012 is > unfixed. > >Testing Mana integration: > >- To test Mana integration you must have Mana enabled, and a > bibliographic record in your catalog which has an ISSN > matching a record in Mana. You can go to "Search on Mana" > from the Serials sidebar menu to locate a working record. >- Add a subscription using the bibliographic record which will match a > record in Mana. When you click "Next" you should see a message at the > top of the page saying, "Searching for subscription in Mana Knowledge > Base" >- After a moment this message should be replaced with "Subscription > found on Mana Knowledge Base: Show Mana results" >- Clicking the "Show Mana results" should trigger a modal window with > the heading "Results from Mana Knowledge Base." > >- Test the subscription add process using a bibliographic record which > doesn't match anything in Mana. The message at the top of the page > should read, "No subscription found on Mana Knowledge Base" > >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/subscription-add.js for translation, > e.g.: > > msgid "Next issue publication date is not defined" > 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> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > .../en/modules/serials/subscription-add.tt | 23 ---------- > .../intranet-tmpl/prog/js/subscription-add.js | 44 +++++++++---------- > 2 files changed, 22 insertions(+), 45 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt >index 6c22b7cdd1..a757000338 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt >@@ -562,29 +562,6 @@ fieldset.rows table { clear: none; margin: 0; } > [%- ELSE -%] > var mana_enabled = 0; > [%- END -%] >- var MSG_LINK_TO_VENDOR = _("If you wish to claim late or missing issues you must link this subscription to a vendor. Click OK to ignore or Cancel to return and enter a vendor"); >- var MSG_LINK_BIBLIO = _("You must choose or create a bibliographic record"); >- var MSG_BIBLIO_NOT_EXIST = _("Bibliographic record does not exist!"); >- var MSG_REQUIRED_SUB_LENGTH = _("You must choose a subscription length or an end date."); >- var MSG_TEST_PREDICTION = _("Please click on 'Test prediction pattern' before saving subscription."); >- var MSG_REQUIRED_PUB_DATE = _("You must choose a first publication date"); >- var MSG_SAVE_PREDICTION_PATTERN = _("You have modified the advanced prediction pattern. Please save your work or cancel modifications."); >- var MSG_PATTERN_IRREG = _("Warning! Present pattern has planned irregularities. Click on 'Test prediction pattern' to check if it's still valid"); >- var MSG_PATTERN_NAME = _("Please enter a name for this pattern"); >- var MSG_PATTERN_NAME_EXISTS = _("This pattern name already exists. Do you want to modify it?"); >- var MSG_OVERWRITE_PATTERNS = _("Warning: This will modify the pattern for all subscriptions that are using it."); >- var MSG_PATTERN_CREATE_FAILED = _("Something went wrong. Unable to create a new numbering pattern."); >- var MSG_PATTERN_TEST_FAILED = _("Cannot test prediction pattern for the following reason(s): %s"); >- var MSG_FREQUENCY_UNDEFINED = _("Frequency is not defined"); >- var MSG_PUB_DATE_UNDEFINED = _("First publication date is not defined"); >- var MSG_NEXT_ISSUE_UNDEFINED = _("Next issue publication date is not defined"); >- var MSG_MANA_SEARCHING = _("Searching for subscription in Mana Knowledge Base"); >- var MSG_MANA_RESULTS = _("Results from Mana Knowledge Base"); >- var MSG_MANA_SUBSCRIPTION_FOUND = _("Subscription found on Mana Knowledge Base:"); >- var MSG_MANA_SHOW_DETAILS = _("Show Mana results"); >- var MSG_MANA_NO_SUBSCRIPTION_FOUND = _("No subscription found on Mana Knowledge Base"); >- var MSG_MANA_SHARE_PATTERN = _("Please feel free to share your pattern with all others librarians once you are done"); >- > var BOOKSELLER_IDS = [% To.json( bookseller_ids ) || '[]' | $raw %]; > </script> > [% Asset.js("js/subscription-add.js") | $raw %] >diff --git a/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js b/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js >index 297756b59e..557b5b18a7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js >@@ -16,7 +16,7 @@ function check_issues(){ > if (document.f.subtype.value == globalfreqdata.unit){ > document.f.issuelengthcount.value=(document.f.sublength.value*globalfreqdata.issuesperunit)/globalfreqdata.unitsperissue; > } else if (document.f.subtype.value != "issues"){ >- alert( MSG_FREQUENCY_LENGTH_ERROR ); >+ alert( __("Frequency and subscription length provided doesn't combine well. Please consider entering an issue count rather than a time period.") ); > } > } > } >@@ -48,7 +48,7 @@ function Clear(id) { > function Check_page1() { > var bookseller_id = $("#aqbooksellerid").val(); > if ( bookseller_id.length == 0) { >- input_box = confirm( MSG_LINK_TO_VENDOR ); >+ input_box = confirm( __("If you wish to claim late or missing issues you must link this subscription to a vendor. Click OK to ignore or Cancel to return and enter a vendor") ); > if (input_box==false) { > return false; > } >@@ -62,36 +62,36 @@ function Check_page1() { > > var biblionumber = $("#biblionumber").val() > if ( biblionumber.length == 0 ) { >- alert( MSG_LINK_BIBLIO ); >+ alert( __("You must choose or create a bibliographic record") ); > return false; > } > > var bib_exists = $("input[name='title']").val().length; > >- if (!bib_exists) alert(MSG_BIBLIO_NOT_EXIST); >+ if (!bib_exists) alert( __("Bibliographic record does not exist!") ); > return bib_exists; > } > > function Check_page2(){ > if( more_than_one_serial == "" ){ > if($("#acqui_date").val().length == 0){ >- alert( MSG_REQUIRED_PUB_DATE ); >+ alert( __("You must choose a first publication date") ); > return false; > } > } > if($("#sublength").val().length == 0 && $("input[name='enddate']").val().length == 0){ >- alert( MSG_REQUIRED_SUB_LENGTH ); >+ alert( __("You must choose a subscription length or an end date.") ); > return false; > } > if(advancedpatternlocked == 0){ >- alert( MSG_SAVE_PREDICTION_PATTERN ); >+ alert( __("You have modified the advanced prediction pattern. Please save your work or cancel modifications.") ); > return false; > } > if(patternneedtobetested){ > if( irregularity !== "" ){ >- alert( MSG_PATTERN_IRREG ); >+ alert( __("Warning! Present pattern has planned irregularities. Click on 'Test prediction pattern' to check if it's still valid") ); > } else { >- alert( MSG_TEST_PREDICTION ); >+ alert( __("Please click on 'Test prediction pattern' before saving subscription.") ); > } > return false; > } >@@ -272,24 +272,24 @@ function testPredictionPattern() { > var error = 0; > var error_msg = ""; > if(frequencyid == undefined || frequencyid == ""){ >- error_msg += "- " + MSG_FREQUENCY_UNDEFINED + "\n"; >+ error_msg += "- " + __("Frequency is not defined") + "\n"; > error ++; > } > acquidate = $("#acqui_date").val(); > if(acquidate == undefined || acquidate == ""){ >- error_msg += "-" + MSG_PUB_DATE_UNDEFINED + "\n"; >+ error_msg += "-" + __("First publication date is not defined") + "\n"; > error ++; > } > if( more_than_one_serial !== "" ){ > var nextacquidate = $("#nextacquidate").val(); > if(nextacquidate == undefined || nextacquidate == ""){ >- error_msg += "-" + MSG_NEXT_ISSUE_UNDEFINED + "\n"; >+ error_msg += "-" + __("Next issue publication date is not defined") + "\n"; > error ++; > } > } > > if(error){ >- alert( MSG_PATTERN_TEST_FAILED.format(error_msg) ); >+ alert( __("Cannot test prediction pattern for the following reason(s): %s").format(error_msg) ); > return false; > } > >@@ -338,7 +338,7 @@ function testPredictionPattern() { > > function saveAdvancedPattern() { > if ($("#patternname").val().length == 0) { >- alert( MSG_PATTERN_NAME ); >+ alert( __("Please enter a name for this pattern") ); > return false; > } > >@@ -353,8 +353,8 @@ function saveAdvancedPattern() { > }); > var cnfrm = 1; > if(found){ >- var msg = MSG_PATTERN_NAME_EXISTS >- + "\n" + MSG_OVERWRITE_PATTERNS; >+ var msg = __("This pattern name already exists. Do you want to modify it?") >+ +"\n" + __("Warning: This will modify the pattern for all subscriptions that are using it."); > cnfrm = confirm(msg); > } > >@@ -384,7 +384,7 @@ function saveAdvancedPattern() { > $("#numberpattern").val(data.numberpatternid); > numberpatternload(); > } else { >- alert( MSG_PATTERN_CREATE_FAILED ); >+ alert( __("Something went wrong. Unable to create a new numbering pattern.") ); > } > } > ); >@@ -405,7 +405,7 @@ function show_page_2() { > } > > function mana_search() { >- $("#mana_search").html("<p>" + MSG_MANA_SEARCHING + "... <img src='" + interface + "/" + theme + "/img/spinner-small.gif' /></p>"); >+ $("#mana_search").html("<p>" + __("Searching for subscription in Mana Knowledge Base") + "... <img src='" + interface + "/" + theme + "/img/spinner-small.gif' /></p>"); > $("#mana_search").show(); > > $.ajax({ >@@ -416,7 +416,7 @@ function mana_search() { > }) > .done( function( result ) { > $("#mana_search_result .modal-body").html(result); >- $("#mana_search_result_label").text( MSG_MANA_RESULTS ); >+ $("#mana_search_result_label").text( __("Results from Mana Knowledge Base") ); > $("#mana_results_datatable").dataTable($.extend(true, {}, dataTablesDefaults, { > "sPaginationType": "full", > "order":[[4, "desc"], [5, "desc"]], >@@ -430,10 +430,10 @@ function mana_search() { > ] > })); > if( $("#mana_results_datatable").length && $("td.dataTables_empty").length == 0){ >- $("#mana_search").html("<p>" + MSG_MANA_SUBSCRIPTION_FOUND + "</p><p> <a href=\"#\" data-toggle=\"modal\" data-target=\"#mana_search_result\"><i class=\"fa fa-window-maximize\"></i> " + MSG_MANA_SHOW_DETAILS + "</a></p>"); >+ $("#mana_search").html("<p>" + __("Subscription found on Mana Knowledge Base:") + "</p><p> <a href=\"#\" data-toggle=\"modal\" data-target=\"#mana_search_result\"><i class=\"fa fa-window-maximize\"></i> " + __("Show Mana results") + "</a></p>"); > } > else if ( $("#mana_results_datatable").length ){ >- $("#mana_search").html("<p>" + MSG_MANA_NO_SUBSCRIPTION_FOUND + "</p><p>" + MSG_MANA_SHARE_PATTERN + "</p>"); >+ $("#mana_search").html("<p>" + __("No subscription found on Mana Knowledge Base") + "</p><p>" + __("Please feel free to share your pattern with all others librarians once you are done") + "</p>"); > } > else{ > $("#mana_search").html( result ); >@@ -721,7 +721,7 @@ $(document).ready(function() { > }, > error: function (x) { > $("input[name='title']").val(''); >- $("#error_bib_not_exist").html("This bibliographic record does not exist"); >+ $("#error_bib_not_exist").html( __("This bibliographic record does not exist") ); > } > }); > }); >-- >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 26257
:
126675
|
128058
|
128059
| 130026