Bugzilla – Attachment 110810 Details for
Bug 25317
Move translatable strings out of additem.js.inc
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25317: Move translatable strings out of additem.js.inc
Bug-25317-Move-translatable-strings-out-of-additem.patch (text/plain), 12.10 KB, created by
David Nind
on 2020-09-27 01:55:50 UTC
(
hide
)
Description:
Bug 25317: Move translatable strings out of additem.js.inc
Filename:
MIME Type:
Creator:
David Nind
Created:
2020-09-27 01:55:50 UTC
Size:
12.10 KB
patch
obsolete
>From 630da4bcdaa2dcc47ed67393e365421f08b31a5f Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Thu, 20 Aug 2020 15:53:28 +0000 >Subject: [PATCH] Bug 25317: Move translatable strings out of additem.js.inc > >This patch moves the definition of translatable strings out of >additem.js.inc and into additem.js using the new JS i81n function. >additem.js.inc is removed, being obsolete. > >To test: > >When creating an order: > >- Go to Administration -> System preferences and set "AcqCreateItem" to > "when placing an order." >- Apply the patch and go to Acquisitions -> Vendor -> Add to basket -> > From a new (empty) record. >- In the "Item" section, confirm that the buttons at the bottom of the > form are correct: "Add item," "Clear," and "Add multiple items." >- Click "Add multiple items." The placeholder in the revealed form field > should read "Number of items to add." The corresponding button should > be labeled "Add." >- You should see a note, "NOTE: Fields listed in the 'UniqueItemsFields' > system preference will not be copied." >- Fill out the item entry form and add a number to the "multiple items" > field. Click "Add." >- A table of items should be displayed with "Edit" and "Delete" buttons > for each new item. >- Click one of the "Edit" buttons. The item form should be populated > with the item's data, with an "Update item" button at the bottom. > >When receiving an order: > >- Go to Administration -> System preferences and set "AcqCreateItem" to > "when receiving an order." >- Go to Acquisitions -> Vendor -> Receive shipments. >- Select or create an invoice. >- Click "Receive" on an order which has a quantity greater than 1. >- Add two items, duplicating in each at least one value which is marked > as unique by the "UniqueItemFields" system preference (e.g. fill in > the same barcode number for each item). >- Click "Save." You should get an alert about duplicated values, and > there should be an alert message on the page, "barcode 'XXX' is > duplicated." >- Edit one of the two items and change the barcode to one which already > exists in your database. >- Click "Save." An alert message should be shown on the page, "barcode > 'XXX' already exists in the database." >- Note: I was unable to find out how to trigger this error, "You can't > receive any more items." It may be obsolete. > >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/additem.js for translation, > e.g.: > > msgid "Add multiple items" > 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> >--- > .../intranet-tmpl/prog/en/includes/additem.js.inc | 16 ------------ > .../prog/en/modules/acqui/neworderempty.tt | 1 - > .../prog/en/modules/acqui/orderreceive.tt | 1 - > koha-tmpl/intranet-tmpl/prog/js/additem.js | 29 +++++++++++----------- > 4 files changed, 14 insertions(+), 33 deletions(-) > delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/additem.js.inc > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/additem.js.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/additem.js.inc >deleted file mode 100644 >index 12f5be7a1a..0000000000 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/additem.js.inc >+++ /dev/null >@@ -1,16 +0,0 @@ >-<!-- additem.js.inc --> >-<script> >- var MSG_ADDITEM_JS_ADDITEM = _("Add item"); >- var MSG_ADDITEM_JS_ADDMULTI = _("Add multiple items"); >- var MSG_ADDITEM_JS_MULTIVAL = _("Number of items to add"); >- var MSG_ADDITEM_JS_MULTI_UNIQUE_NOTE = _("NOTE: Fields listed in the \'UniqueItemsFields\' system preference will not be copied"); >- var MSG_ADDITEM_JS_SUBMITMULTI = _("Add"); >- var MSG_ADDITEM_JS_UPDATEITEM = _("Update item"); >- var MSG_ADDITEM_JS_EDIT = _("Edit"); >- var MSG_ADDITEM_JS_DELETE = _("Delete"); >- var MSG_ADDITEM_JS_CLEAR = _("Clear"); >- var MSG_ADDITEM_JS_CANT_RECEIVE_MORE_ITEMS = _("You can't receive any more items"); >- var MSG_ADDITEM_JS_IS_DUPLICATE = _("is duplicated"); >- var MSG_ADDITEM_JS_ALREADY_EXISTS_IN_DB = _("already exists in database"); >-</script> >-<!-- / additem.js.inc --> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >index 955cfc6b17..37d4f99cce 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >@@ -504,7 +504,6 @@ > [% MACRO jsinclude BLOCK %] > [% Asset.js("js/acquisitions-menu.js") | $raw %] > [% Asset.js("js/acq.js") | $raw %] >- [% INCLUDE 'additem.js.inc' %] > [% Asset.js("js/additem.js") | $raw %] > [% Asset.js("js/cataloging.js") | $raw %] > [% INCLUDE 'calendar.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >index c02a783c19..9dcff30a26 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >@@ -371,7 +371,6 @@ > [% MACRO jsinclude BLOCK %] > [% Asset.js("js/acquisitions-menu.js") | $raw %] > [% INCLUDE 'calendar.inc' %] >- [% INCLUDE 'additem.js.inc' %] > [% Asset.js("js/additem.js") | $raw %] > [% Asset.js("js/cataloging.js") | $raw %] > <script> >diff --git a/koha-tmpl/intranet-tmpl/prog/js/additem.js b/koha-tmpl/intranet-tmpl/prog/js/additem.js >index 1ceedd1372..d6f95772a6 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/additem.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/additem.js >@@ -1,3 +1,4 @@ >+/* global __ */ > function addItem( node, unique_item_fields ) { > var index = $(node).closest("div").attr('id'); > var current_qty = parseInt($("#quantity").val()); >@@ -12,13 +13,12 @@ function addItem( node, unique_item_fields ) { > if ( current_qty < max_qty - 1 ) > cloneItemBlock(index, unique_item_fields); > addItemInList(index, unique_item_fields); >- $("#" + index).find("input[name='buttonPlus']").val( (window.MSG_ADDITEM_JS_UPDATEITEM ) ); >+ $("#" + index).find("input[name='buttonPlus']").val( __("Update item") ); > $("#"+ index).find("input[name='buttonPlusMulti']").remove(); > $("#" + index).find("input[name='multiValue']").remove(); > $("#quantity").val(current_qty + 1).change(); > } else if ( current_qty >= max_qty ) { >- alert(window.MSG_ADDITEM_JS_CANT_RECEIVE_MORE_ITEMS >- || "You can't receive any more items."); >+ alert( __("You can't receive any more items") ); > } > } else { > if ( current_qty < max_qty ) >@@ -46,7 +46,7 @@ function addMulti( count, node, unique_item_fields){ > $("#procModal").modal('hide'); > } > }); >- $("#" + cloneIndex).find("input[name='buttonPlus']").val( (window.MSG_ADDITEM_JS_UPDATEITEM ) ); >+ $("#" + cloneIndex).find("input[name='buttonPlus']").val( ( __("Update item") ) ); > $("#" + cloneIndex).find("input[name='buttonPlusMulti']").remove(); > $("#" + cloneIndex).find("input[name='multiValue']").remove(); > $("#" + cloneIndex).hide(); >@@ -88,10 +88,10 @@ function constructTrNode(index, unique_item_fields) { > > var result = "<tr idblock='" + index + "'>"; > var edit_link = "<a href='#itemfieldset' style='text-decoration:none' onclick='showItem(\"" + index + "\");' class='btn btn-default btn-xs'><i class='fa fa-pencil'></i> " >- + (window.MSG_ADDITEM_JS_EDIT || "Edit") + "</a>"; >+ + ( __("Edit") ) + "</a>"; > var del_link = "<a style='cursor:pointer' " > + "onclick='deleteItemBlock(this, \"" + index + "\", \"" + unique_item_fields + "\");' class='btn btn-default btn-xs'><i class='fa fa-trash'></i> " >- + (window.MSG_ADDITEM_JS_DELETE || "Delete") + "</a>"; >+ + ( __("Delete") ) + "</a>"; > result += "<td class='actions'>" + edit_link + " " + del_link + "</td>"; > for(i in fields) { > var field = fields[i]; >@@ -178,13 +178,13 @@ function cloneItemBlock(index, unique_item_fields, callback) { > }); > /* Add buttons + and Clear */ > var buttonPlus = "<fieldset class=\"action\">"; >- buttonPlus += '<input type="button" class="addItemControl" name="buttonPlus" style="cursor:pointer; margin:0 1em;" onclick="addItem(this,\'' + unique_item_fields + '\')" value="' + (window.MSG_ADDITEM_JS_ADDITEM || 'Add item')+ '" />'; >- buttonPlus += '<input type="button" class="addItemControl cancel" name="buttonClear" style="cursor:pointer;" onclick="clearItemBlock(this)" value="' + (window.MSG_ADDITEM_JS_CLEAR || 'Clear')+ '" />'; >- buttonPlus += '<input type="button" class="addItemControl" name="buttonPlusMulti" onclick="javascript:this.nextSibling.style.display=\'inline\'; return false;" style="cursor:pointer; margin:0 1em;" value="' + (window.MSG_ADDITEM_JS_ADDMULTI || 'Add multiple items')+ '" />'; >+ buttonPlus += '<input type="button" class="addItemControl" name="buttonPlus" style="cursor:pointer; margin:0 1em;" onclick="addItem(this,\'' + unique_item_fields + '\')" value="' + ( __("Add item") )+ '" />'; >+ buttonPlus += '<input type="button" class="addItemControl cancel" name="buttonClear" style="cursor:pointer;" onclick="clearItemBlock(this)" value="' + __("Clear") + '" />'; >+ buttonPlus += '<input type="button" class="addItemControl" name="buttonPlusMulti" onclick="javascript:this.nextSibling.style.display=\'inline\'; return false;" style="cursor:pointer; margin:0 1em;" value="' + __("Add multiple items") + '" />'; > buttonPlus += '<span id="add_multiple_copies" style="display:none">' >- + '<input type="number" class="addItemControl" id="multiValue" name="multiValue" placeholder="'+window.MSG_ADDITEM_JS_MULTIVAL+'" />' >- + '<input type="button" class="addItemControl" name=buttonAddMulti" style="cursor:pointer; margin:0 1em;" onclick="checkCount( this ,\'' + unique_item_fields + '\')" value="' + (window.MSG_ADDITEM_JS_SUBMITMULTI || 'Add') + '" />' >- + '<div class="dialog message">' + window.MSG_ADDITEM_JS_MULTI_UNIQUE_NOTE + '</div>' >+ + '<input type="number" class="addItemControl" id="multiValue" name="multiValue" placeholder="' + __("Number of items to add") + '" />' >+ + '<input type="button" class="addItemControl" name=buttonAddMulti" style="cursor:pointer; margin:0 1em;" onclick="checkCount( this ,\'' + unique_item_fields + '\')" value="' + __("Add") + '" />' >+ + '<div class="dialog message">' + __("NOTE: Fields listed in the 'UniqueItemsFields' system preference will not be copied") + '</div>' > + '</span>'; > buttonPlus += "</fieldset>"; > $(clone).append(buttonPlus); >@@ -271,7 +271,7 @@ function check_additem(unique_item_fields) { > if (sorted_arr[i + 1] == sorted_arr[i]) { > $(".order_error").append( > fieldname + " '" + sorted_arr[i] + "' " >- + (window.MSG_ADDITEM_JS_IS_DUPLICATE || "is duplicated") >+ + __("is duplicated") > + "<br/>"); > success = false; > } >@@ -296,8 +296,7 @@ function check_additem(unique_item_fields) { > var value = data[field][i]; > $(".order_error").append( > field + " '" + value + "' " >- + (window.MSG_ADDITEM_JS_ALREADY_EXISTS_IN_DB >- || "already exists in database") >+ + __("already exists in database") > + "<br />" > ); > } >-- >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 25317
:
108745
|
110810
|
110829