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> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
ea72b15480
commit
912d911db2
3 changed files with 4 additions and 12 deletions
|
@ -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 %]
|
||||
|
|
|
@ -448,13 +448,6 @@
|
|||
</div> <!-- /.row -->
|
||||
|
||||
[% 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>
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue