9e9088049c
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>
160 lines
7.2 KiB
Text
160 lines
7.2 KiB
Text
[% INCLUDE 'doc-head-open.inc' %]
|
|
<title>Koha › Tools › Patron cards › Manage patron card elements</title>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
[% INCLUDE 'greybox.inc' %]
|
|
<script type="text/javascript">
|
|
//<![CDATA[
|
|
function DeleteConfirm() {
|
|
var element_id = selected_layout("delete");
|
|
if (element_id>-1) {
|
|
var msg = _("Are you sure you want to delete %s %s?").format("[% card_element %]", element_id);
|
|
var answer = confirm(msg);
|
|
if (answer) {
|
|
window.location = "/cgi-bin/koha/patroncards/manage.pl?op=delete&card_element=[% card_element %]&element_id=" + element_id;
|
|
}
|
|
else {
|
|
return; // abort delete
|
|
}
|
|
}
|
|
else {
|
|
return; // no layout selected
|
|
};
|
|
};
|
|
function Edit() {
|
|
var element_id = selected_layout("edit");
|
|
if (element_id>-1) {
|
|
window.location = "/cgi-bin/koha/patroncards/edit-[% card_element %].pl?op=edit&element_id=" + element_id;
|
|
}
|
|
else {
|
|
return; // no layout selected
|
|
};
|
|
};
|
|
function Xport() {
|
|
batches= new Array;
|
|
if(document.layouts.action.length > 0) {
|
|
for (var i=0; i < document.layouts.action.length; i++) {
|
|
if (document.layouts.action[i].checked) {
|
|
batches.push("batch_id=" + document.layouts.action[i].value);
|
|
}
|
|
}
|
|
if (batches.length < 1) {
|
|
alert(_("Please select at least one batch to export."));
|
|
return; // no batch selected
|
|
}
|
|
getstr = batches.join("&");
|
|
}
|
|
else if (document.layouts.action.checked) {
|
|
getstr = "batch_id="+document.layouts.action.value;
|
|
}
|
|
else {
|
|
alert(_("Please select at least one batch to export."));
|
|
return; // no batch selected
|
|
}
|
|
return GB_showCenter(_("Export patron cards"), "/cgi-bin/koha/patroncards/print.pl?" + getstr, 700, 800);
|
|
};
|
|
function selected_layout(op) {
|
|
var selected = new Array;
|
|
if (document.layouts.action.length) {
|
|
for (i=0;i<document.layouts.action.length;i++){
|
|
if (document.layouts.action[i].checked){
|
|
selected.push(i);
|
|
}
|
|
};
|
|
if (selected.length == 1) {
|
|
return(document.layouts.action[selected[0]].value);
|
|
}
|
|
else {
|
|
alert(_("Please select only one %s to %s.").format("[% card_element %]", op));
|
|
return (-1);
|
|
}
|
|
}
|
|
else {
|
|
if (document.layouts.action.checked){
|
|
return(document.layouts.action.value);
|
|
}
|
|
};
|
|
alert(_("Please select a %s.").format("[% card_element %]"));
|
|
return (-1);
|
|
};
|
|
|
|
$(document).ready(function() {
|
|
$("#edit").click(function(){
|
|
Edit();
|
|
return false;
|
|
});
|
|
$("#delete").click(function(){
|
|
DeleteConfirm();
|
|
return false;
|
|
});
|
|
$("#print").click(function(){
|
|
Xport();
|
|
return false;
|
|
});
|
|
});
|
|
//]]>
|
|
</script>
|
|
</head>
|
|
<body id="pcard_manage" class="tools pcard">
|
|
[% INCLUDE 'header.inc' %]
|
|
[% INCLUDE 'cat-search.inc' %]
|
|
<div id="breadcrumbs">
|
|
<a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
|
|
<a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> ›
|
|
<a href="/cgi-bin/koha/patroncards/home.pl">Patron card creator</a> ›
|
|
Manage card [% card_element_title %]
|
|
</div>
|
|
<div id="doc3" class="yui-t2">
|
|
<div id="bd">
|
|
<div id="yui-main">
|
|
<div class="yui-b">
|
|
[% INCLUDE 'patroncards-toolbar.inc' %]
|
|
[% INCLUDE 'patroncards-errors.inc' %]
|
|
<div class="yui-gc">
|
|
<div class="yui-u first" id="manage-patroncards-layouts">
|
|
<div class="hint">Current library: [% LoginBranchname %]</div>
|
|
[% IF ( table_loop ) %]
|
|
<form name="layouts" action="/cgi-bin/koha/manage.pl?card_element=[% card_element %]">
|
|
<h2>Currently Available [% card_element_title %]</h2>
|
|
<table>
|
|
[% FOREACH table_loo IN table_loop %]
|
|
[% IF ( table_loo.header_fields ) %]
|
|
<tr>
|
|
[% FOREACH header_field IN table_loo.header_fields %]
|
|
<th>[% header_field.field_label %]</th>
|
|
[% END %]
|
|
</tr>
|
|
[% ELSE %]
|
|
<tr>
|
|
[% FOREACH text_field IN table_loo.text_fields %]
|
|
[% IF ( text_field.select_field ) %]
|
|
<td align="center"><input type="checkbox" name="action" value="[% text_field.field_value %]" /></td>
|
|
[% ELSIF ( text_field.field_value ) %]
|
|
<td>[% text_field.field_value %]</td>
|
|
[% ELSE %]
|
|
<td> </td>
|
|
[% END %]
|
|
[% END %]
|
|
</tr>
|
|
[% END %]
|
|
[% END %]
|
|
</table>
|
|
<fieldset class="action">
|
|
<input type="button" id="edit" value="Edit" />
|
|
<input type="button" id="delete" value="Delete" />
|
|
[% IF ( print ) %]<input type="button" id="print" value="Export" />[% END %]
|
|
</fieldset>
|
|
</form>
|
|
[% ELSE %]
|
|
<div class="dialog message">
|
|
<h4>There are no [% card_element_title %] currently available.</h4>
|
|
<p>Use the toolbar above to create a new [% card_element %].</p></div>
|
|
[% END %]
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="yui-b">
|
|
[% INCLUDE 'patroncards-menu.inc' %]
|
|
</div>
|
|
</div>
|
|
[% INCLUDE 'intranet-bottom.inc' %]
|