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 <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:
Owen Leonard 2020-09-01 13:46:35 +00:00 committed by Jonathan Druart
parent 9d056d0364
commit 2ac76aee66
2 changed files with 5 additions and 11 deletions

View file

@ -18,12 +18,6 @@
[% Asset.js("js/acq.js") | $raw %]
[% Asset.js("js/funds_sorts.js") | $raw %]
[% Asset.js("js/addorderiso2709.js") | $raw %]
<script>
var ERR_NO_RECORD_SELECTED = _("There is no record selected");
var ERR_INVALID_QUANTITY = _("quantity values are not filled in or are not numbers");
var ERR_FUNDS_MISSING = _("Some budgets are not defined in item records");
var MSG_LOADING = _("Loading");
</script>
</head>
<body id="acq_addorderiso2709" class="acq">

View file

@ -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("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> " + MSG_LOADING + "</div>");
$("#dataPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> " + __("Loading") + "</div>");
});
});