Bugzilla – Attachment 110814 Details for
Bug 26217
Move translatable strings out of templates into acq.js
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26217: Move translatable strings out of templates into acq.js
Bug-26217-Move-translatable-strings-out-of-templat.patch (text/plain), 5.21 KB, created by
David Nind
on 2020-09-27 04:55:29 UTC
(
hide
)
Description:
Bug 26217: Move translatable strings out of templates into acq.js
Filename:
MIME Type:
Creator:
David Nind
Created:
2020-09-27 04:55:29 UTC
Size:
5.21 KB
patch
obsolete
>From f381e765aea74fc0d25ad986487551f19bf4f709 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Fri, 14 Aug 2020 18:12:09 +0000 >Subject: [PATCH] Bug 26217: Move translatable strings out of templates into > acq.js > >This patch removes the definition of translatable strings out of >templates and into the JavaScript file, using the new JS i81n function. > >To test: > >- Apply the patch, go to acquisitions, and view a vendor. >- Click "Uncertain prices" in the sidebar menu. >- In the table of orders, enter something in the "price" form field > which isn't a valid price. You should get an error message. > >- Test the validation of fund amounts: Go to Administration -> Budgets > and create an active budget if necessary. >- Add a fund to that budget. Try to save the fund with a fund amount > which exceed the amount in the budget. >- You should get an error message: "Fund amount exceeds period > allocation" >- Add a fund with valid data and then go to Administration -> Funds and > locate the fun you just created. >- Use the "Actions" menu to add a sub fund to that fund. >- Try to save this new fund with an amount which exceeds the amount in > the parent fund. >- You should get an error message, "Fund amount exceeds parent > allocation." > >Note: I was unable to properly test the error message "New budget-parent >is beneath budget." I couldn't figure out how to trigger it. > >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/acq.js for translation, e.g.: > > msgid "Fund amount exceeds period allocation" > 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> >--- > koha-tmpl/intranet-tmpl/prog/en/modules/acqui/uncertainprice.tt | 1 - > koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt | 7 ------- > koha-tmpl/intranet-tmpl/prog/js/acq.js | 8 ++++---- > 3 files changed, 4 insertions(+), 12 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/uncertainprice.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/uncertainprice.tt >index 940127c0ca..20f1fbe302 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/uncertainprice.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/uncertainprice.tt >@@ -156,7 +156,6 @@ > uncheckbox( form, ordernumber ); > }); > }); >- var MSG_INVALIDPRICE = _("ERROR: Price is not a valid number, please check the price and try again!"); > </script> > [% Asset.js("js/acq.js") | $raw %] > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt >index ce88e2865c..0fc2223de9 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt >@@ -449,13 +449,6 @@ > > [% MACRO jsinclude BLOCK %] > [% Asset.js("js/acq.js") | $raw %] >- <script> >- var MSG_BUDGET_PARENT_ALLOCATION = "- " + _("Fund amount exceeds parent allocation") + "\n"; >- var MSG_BUDGET_PERIOD_ALLOCATION = "- " + _("Fund amount exceeds period allocation") + "\n"; >- var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") + "\n"; >- </script> >- >- [% Asset.js("js/acq.js") | $raw %] > [% IF op == 'add_form' %] > <script> > //<![CDATA[ >diff --git a/koha-tmpl/intranet-tmpl/prog/js/acq.js b/koha-tmpl/intranet-tmpl/prog/js/acq.js >index e12be33513..f1028faf58 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/acq.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/acq.js >@@ -4,7 +4,7 @@ > function uncheckbox(form, field) { > var price = new Number(form.elements['price' + field].value); > var tmpprice = ""; >- var errmsg = MSG_INVALIDPRICE; >+ var errmsg = __("ERROR: Price is not a valid number, please check the price and try again!"); > if (isNaN(price)) { > alert(errmsg); > for(var i=0; i<form.elements['price' + field].value.length; ++i) { >@@ -304,9 +304,9 @@ if ( newBudgetParent ) { url += '&parent_id=' + newBudgetParent}; > var result = eval ( xmlhttp.responseText ); > > if (result == '1') { >- return MSG_BUDGET_PARENT_ALLOCATION; >+ return "- " + __("Fund amount exceeds parent allocation") + "\n"; > } else if (result == '2') { >- return MSG_BUDGET_PERIOD_ALLOCATION; >+ return "- " + __("Fund amount exceeds period allocation") + "\n"; > } else { > return false; > } >@@ -338,7 +338,7 @@ function checkBudgetParent(budgetId, newBudgetParent) { > var result = eval ( xmlhttp.responseText ); > > if (result == '1') { >- return MSG_PARENT_BENEATH_BUDGET; >+ return "- " + __("New budget-parent is beneath budget") + "\n"; > // } else if (result == '2') { > // return "- New budget-parent has insufficent funds\n"; > // } else { >-- >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 26217
:
108393
|
110814
|
110825