Koha/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/booksellers.tt
Pasi Kallinen 9e9088049c Bug 12138 - Use placeholders in translatable Javascript strings
Currently translating Javascript strings with variables in them is hard,
because the strings are created from separate parts. For example:

 _("Are you sure you want to delete the") + " " + count + " " +
_("attached items?")

This is translated in two different parts, and the translator cannot
affect the place where the count-variable is.

Now, if the javascript strings allowed placeholders, similar to how the
template strings do, the above could be written as:

_("Are you sure you want to delete the %s attached
items?").format(count)

This would make translation much easier.

Attached patch adds a Javascript string formatter, and changes all the
concatenated translatable JS strings used in intranet to use that.

To test:
1) cd misc/translator
2) perl translate update xx-YY
3) grep ^msgid po/xx-YY-i-staff-t-prog-v-3006000.po | sort | uniq >
xx-YY-pre
4) apply patch
5) perl translate update xx-YY
6) grep ^msgid po/xx-YY-i-staff-t-prog-v-3006000.po | sort | uniq >
xx-YY-post
7) compare the files: diff -Nurd xx-YY-pre xx-yy-post | less
   should show the javascript strings that changed.
8) Test the UIs where the formatted js strings are used.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

I tested *most* of the changed files. There were some instances where it
wasn't clear to me how to trigger the warnings which were modified,
especially tags/review.tt, admin/manage-marc-import.tt, and holidays.tt.
Everything I was able to test worked correctly.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>

Works nicely, no regressions found. Thx!

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-27 21:24:04 +00:00

192 lines
9.6 KiB
Text

[% USE KohaDates %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Search for vendor [% supplier %]</title>
[% INCLUDE 'doc-head-close.inc' %]
<style type="text/css">
#vendors td{
vertical-align: top;
}
</style>
<link rel="stylesheet" href="[% themelang %]/css/datatables.css" />
[% INCLUDE 'datatables.inc' %]
<script type="text/javascript">
//<![CDATA[
$(document).ready(function() {
$("table.baskets").dataTable($.extend(true, {}, dataTablesDefaults, {
'sDom': 't',
'bPaginate': false,
'bFilter': false,
'bInfo': false,
"aaSorting": [[ 1, "asc" ]],
"aoColumns": [
null,null,null,null,null,null,{ "sType": "title-string" },null,{ "sType": "title-string" },null
],
'aoColumnDefs': [
{ 'aTargets': [-1], 'bSortable': false }
]
}));
$("#supplierlist").change(function() {
var id = $(this).find("option:selected").val();
window.location.href = "#" + id;
});
$(".modal").on("show", function(){
var basket = $(this).data("basketno");
var legend = _("Add order to basket %s").format(basket);
$(this).find("legend").html(legend);
});
});
//]]>
</script>
</head>
<body id="acq_booksellers" class="acq">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'acquisitions-search.inc' %]
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; Search for vendor <em>[% supplier %]</em> </div>
<div id="doc3" class="yui-t2">
<div id="bd">
<div id="yui-main">
<div class="yui-b">
[% INCLUDE 'acquisitions-toolbar.inc' %]
[% UNLESS ( count == 1 ) %]
<h1>You searched on <b>vendor [% supplier %],</b> [% count %] results found</h1>
[% END %]
[% IF ( loop_suppliers.size ) %]
[% UNLESS (count == 1) %]
<p>Choose a vendor in the list to jump directly to the right place.
<select id="supplierlist">
[% FOREACH supplier1 IN loop_suppliers %]
<option value="[% supplier1.booksellerid %]">[% supplier1.name %]</option>
[% END %]
</select>
</p>
[% END %]
[% IF ( allbaskets ) %]
<p><a href="/cgi-bin/koha/acqui/booksellers.pl?supplier=[% supplier %]&amp;booksellerid=[% booksellerid %]">Show active baskets only</a></p>
[% ELSE %]
<p><a href="/cgi-bin/koha/acqui/booksellers.pl?supplier=[% supplier %]&amp;booksellerid=[% booksellerid %]&amp;allbaskets=1">Show all baskets</a></p>
[% END %]
<div id="acqui_order_supplierlist">
[% FOREACH supplier IN loop_suppliers %]
<div class="supplier">
<span class="suppliername">
[% IF (supplier.name) %]
<a name="[% supplier.booksellerid %]" href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% supplier.booksellerid %]">[% supplier.name %]</a>
[% ELSE %]
<a name="[% supplier.booksellerid %]" href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% supplier.booksellerid %]">NO NAME</a>
[% END %]
</span>
<span class="action">
[% IF ( CAN_user_acquisition_order_manage ) %]
[% IF ( supplier.active ) %]
<a class="btn btn-small" href="/cgi-bin/koha/acqui/basketheader.pl?booksellerid=[% supplier.booksellerid %]&amp;op=add_form"><i class="icon-plus"></i> New basket</a>
[% ELSE %]
(inactive)
[% END %]
[% END %]
<a class="btn btn-small" href="/cgi-bin/koha/acqui/parcels.pl?booksellerid=[% supplier.booksellerid %]"><i class="icon-inbox"></i> Receive shipment</a>
</span>
<div class="baskets">
[% IF ( supplier.loop_basket.size ) %]
<table class="baskets">
<thead>
<tr>
<th>No.</th>
<th>Name</th>
<th>Item count</th>
<th>Biblio count</th>
<th>Items expected</th>
<th>Created by</th>
<th>Date</th>
<th>Basket group</th>
<th>Closed</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
[% FOREACH basket IN supplier.loop_basket %]
[% IF ( basket.uncertainprices ) %]
<tr class="problem">
[% ELSE %]
<tr>
[% END %]
<td>[% basket.basketno %]</td>
<td>[% basket.basketname %]</td>
<td>
[% basket.total_items %]
[% IF basket.total_items_cancelled %]
([% basket.total_items_cancelled %] cancelled)
[% END %]
</td>
<td>
[% basket.total_biblios %]
[% IF basket.total_biblios_cancelled %]
([% basket.total_biblios_cancelled %] cancelled)
[% END %]
</td>
<td>[% basket.expected_items %]</td>
<td>
[% basket.authorisedby_firstname %]
[% basket.authorisedby_surname %]
</td>
<td><span title="[% basket.creationdate %]">[% basket.creationdate | $KohaDates %]</span></td>
<td>
[% IF basket.basketgroup %]
[% basketgroup = basket.basketgroup %]
[% IF basketgroup.closed %]
[% basketgroup.name %] (closed)
[% ELSE %]
<a href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&booksellerid=[% basket.booksellerid %]&basketgroupid=[% basketgroup.id %]">[% basketgroup.name %]</a>
[% END %]
[% END %]
</td>
<td>
[% IF ( basket.closedate ) %]
<span title="[% basket.closedate %]">[% basket.closedate | $KohaDates %]</span>
[% ELSE %]
<span title="9999-99-99"></span>
[% END %]
</td>
<td>
<a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basket.basketno %]">View</a>
[% UNLESS ( basket.closedate ) %]
| <a id="addtoBasketLabel[% basket.basketno %]" href="#addtoBasket[% basket.basketno %]" role="button" data-toggle="modal">Add to basket</a>
<!-- Modal -->
<div id="addtoBasket[% basket.basketno %]" class="modal hide" tabindex="-1" role="dialog" aria-labelledby="addtoBasketLabel[% basket.basketno %]" aria-hidden="true" data-basketno="[% basket.basketname %]">
<div class="modal-body">
[% INCLUDE 'acquisitions-add-to-basket.inc' booksellerid=supplier.booksellerid basketno=basket.basketno %]
</div>
<div class="modal-footer">
<a href="#" class="cancel" data-dismiss="modal" aria-hidden="true">Cancel</a>
</div>
</div>
[% END %]
</td>
</tr>
[% END %][%# FOREACH basket IN supplier.loop_basket %]
</tbody>
</table>
[% ELSE %]
<p>No pending baskets</p>
[% END %][%# IF ( supplier.loop_basket.size ) %]
</div>
</div>
[% END %][%# FOREACH supplier IN loop_suppliers %]
</div>
[% END %][%# IF ( loop_suppliers.size ) %]
</div>
</div>
<div class="yui-b">
[% IF ( booksellerid ) %]
[% INCLUDE 'vendor-menu.inc' %]
[% END %]
[% INCLUDE 'acquisitions-menu.inc' %]
</div>
</div>
[% INCLUDE 'intranet-bottom.inc' %]