From 12e4b053d2c8e80e2035d61467d0d533967778b2 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Tue, 1 Sep 2020 13:46:35 +0000 Subject: [PATCH] Bug 26339: Move translatable strings out of addorderiso2709.tt into addorderiso2709.js This patch moves strings defined for translation in addorderiso2709.tt into addorderiso2709.js for translation using the new double-underscore i81n function. To test, apply the patch and go to Acquisitions -> Vendor -> Basket -> Add orders from MARC file. - Click "Add orders" next to a staged file. - Without making any selections, click "Save." You should get an error, "There is no record selected." - Select a record and click "Save." You should get an error, "Some budgets are not defined in item records." - Enter a non-numeric value in the "Quantity" field and click "Save." You should get an error, "1 quantity values are not filled in or are not numbers." 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/addorderiso2709.js for translation, e.g.: msgid "Some budgets are not defined in item records" 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 Signed-off-by: Katrin Fischer Signed-off-by: Jonathan Druart (cherry picked from commit 2ac76aee66c5114a944bc0b00d952b3df5dad85a) Signed-off-by: Lucas Gass --- .../prog/en/modules/acqui/addorderiso2709.tt | 6 ------ koha-tmpl/intranet-tmpl/prog/js/addorderiso2709.js | 10 +++++----- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt index 1ae8d429d4..f27ebfa848 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt @@ -18,12 +18,6 @@ [% Asset.js("js/acq.js") | $raw %] [% Asset.js("js/funds_sorts.js") | $raw %] [% Asset.js("js/addorderiso2709.js") | $raw %] - diff --git a/koha-tmpl/intranet-tmpl/prog/js/addorderiso2709.js b/koha-tmpl/intranet-tmpl/prog/js/addorderiso2709.js index 04b8851936..3211017af9 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/addorderiso2709.js +++ b/koha-tmpl/intranet-tmpl/prog/js/addorderiso2709.js @@ -1,4 +1,4 @@ -/* global dataTablesDefaults ERR_NO_RECORD_SELECTED ERR_INVALID_QUANTITY ERR_FUNDS_MISSING MSG_LOADING */ +/* global dataTablesDefaults __ */ $(document).ready(function() { $("#Aform").preventDoubleFormSubmit(); @@ -50,7 +50,7 @@ $(document).ready(function() { e.preventDefault(); if ( $("input:checkbox[name='import_record_id']:checked").length < 1 ) { - alert( ERR_NO_RECORD_SELECTED ); + alert( __("There is no record selected") ); return false; } @@ -61,14 +61,14 @@ $(document).ready(function() { } }); if ( error > 0 ) { - alert( error + " " + ERR_INVALID_QUANTITY ); + alert(error + " " + __("quantity values are not filled in or are not numbers") ); return false; } error = checkOrderBudgets(); if ( error > 0 ) { - alert( ERR_FUNDS_MISSING ); + alert( __("Some budgets are not defined in item records") ); return false; } @@ -88,7 +88,7 @@ $(document).ready(function() { }); $("#dataPreview").on("hidden.bs.modal", function(){ $("#dataPreviewLabel").html(""); - $("#dataPreview .modal-body").html("
\"\" " + MSG_LOADING + "
"); + $("#dataPreview .modal-body").html("
\"\" " + __("Loading") + "
"); }); }); -- 2.39.5