[Koha-patches] [PATCH] Fix for Bug 4504, Confirmation messages in opac account not translated
Owen Leonard
oleonard at myacpl.org
Wed Jun 2 18:55:53 CEST 2010
Strings within JavaScript onclick attributes are not getting picked
up by the translator:
onclick="return confirmDelete(_('Are you sure you want to cancel this
hold?'));"
This patch converts those to use variables defined in the main
script block:
onclick="return confirmDelete(MSG_CONFIRM_DELETE_HOLD);"
---
.../prog/en/modules/opac-search-history.tmpl | 3 ++-
.../opac-tmpl/prog/en/modules/opac-shelves.tmpl | 13 +++++++------
koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tmpl | 3 ++-
3 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-search-history.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-search-history.tmpl
index f129925..1847017 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-search-history.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-search-history.tmpl
@@ -4,6 +4,7 @@
<script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
<script type="text/JavaScript" language="JavaScript">
//<![CDATA[
+ var MSG_CONFIRM_DELETE_HISTORY = _("Are you sure you want to delete your search history?");
$(document).ready(function() {
// We show table ordered by descending dates by default
// (so that the more recent query is shown first)
@@ -32,7 +33,7 @@
<div class="yui-b"><div class="yui-g">
<div id="searchhistory" class="container">
<h1>Search history</h1>
- <!-- TMPL_IF NAME="recentSearches" --><form action="/cgi-bin/koha/opac-search-history.pl" method="get"><input type="hidden" name="action" value="delete" /><input type="submit" class="deleteshelf" value="Delete your search history" onclick="return confirm(_('Are you sure you want to delete your search history?'));" /></form><!-- TMPL_ELSE --><!-- TMPL_IF NAME="previousSearches" --><form action="/cgi-bin/koha/opac-search-history.pl" method="get"><input type="hidden" name="action" value="delete" /><input type="submit" class="deleteshelf" value="Delete your search history" onclick="return confirm(_('Are you sure you want to delete your search history?'));" /></form><!-- /TMPL_IF --><!-- /TMPL_IF -->
+ <!-- TMPL_IF NAME="recentSearches" --><form action="/cgi-bin/koha/opac-search-history.pl" method="get"><input type="hidden" name="action" value="delete" /><input type="submit" class="deleteshelf" value="Delete your search history" onclick="return confirm(MSG_CONFIRM_DELETE_HISTORY);" /></form><!-- TMPL_ELSE --><!-- TMPL_IF NAME="previousSearches" --><form action="/cgi-bin/koha/opac-search-history.pl" method="get"><input type="hidden" name="action" value="delete" /><input type="submit" class="deleteshelf" value="Delete your search history" onclick="return confirm(MSG_CONFIRM_DELETE_HISTORY);" /></form><!-- /TMPL_IF --><!-- /TMPL_IF -->
<!-- TMPL_IF NAME="recentSearches" -->
<table class="historyt">
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tmpl
index 30bde25..217993c 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tmpl
@@ -4,7 +4,8 @@
<script type="text/JavaScript" language="JavaScript">
//<![CDATA[
var MSG_NO_TAG_SPECIFIED = _("No tag was specified.");
-
+var MSG_REMOVE_FROM_LIST = _("Are you sure you want to remove these items from the list?");
+var MSG_CONFIRM_DELETE_LIST = _("Are you sure you want to delete this list?");
$.tablesorter.addParser({
id: 'articles',
is: function(s) {return false; },
@@ -225,7 +226,7 @@ $(function() {
<input type="hidden" name="display" value="privateshelves" />
<!-- /TMPL_IF -->
<input type="hidden" value="1" name="DEL-<!-- TMPL_VAR NAME="shelfnumber" -->"/>
- <input type="submit" class="deleteshelf" value="Delete List" onclick="return confirmDelete(_('Are you sure you want to remove this List?'));"/>
+ <input type="submit" class="deleteshelf" value="Delete List" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST);"/>
</form> <!-- /TMPL_IF -->
<a class="print tag_hides" href="opac-shelves.pl" onclick="print(); return false;">Print List</a>
@@ -304,12 +305,12 @@ $(function() {
<!-- TMPL_IF NAME="itemsloop" -->
<input type="hidden" name="shelfnumber" value="<!-- TMPL_VAR NAME="shelfnumber" -->" />
<input type="hidden" name="modifyshelfcontents" value="1" />
- <input type="hidden" name="viewshelf" value="<!-- TMPL_VAR NAME="shelfnumber" -->" /><input type="submit" value="Remove Selected Items" class="icon delete" onclick="return confirmDelete(_('Are you sure you want to remove these items from the list?'))" />
+ <input type="hidden" name="viewshelf" value="<!-- TMPL_VAR NAME="shelfnumber" -->" /><input type="submit" value="Remove Selected Items" class="icon delete" onclick="return confirmDelete(MSG_REMOVE_FROM_LIST)" />
<!-- TMPL_ELSE -->
<form method="post" action="opac-shelves.pl">
<input type="hidden" name="DEL-<!-- TMPL_VAR NAME="shelfnumber" -->" value="1" />
<input type="hidden" name="shelves" value="1" />
- <input type="submit" class="icon delete" value="Delete this List" onclick="return confirmDelete(_('Are you sure you want to delete this List?'))" />
+ <input type="submit" class="icon delete" value="Delete this List" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST)" />
<!-- /TMPL_IF -->
</form>
<!-- /TMPL_IF -->
@@ -411,7 +412,7 @@ $(function() {
<input type="hidden" name="CONFIRM-<!-- TMPL_VAR NAME="confirm" -->" value="1" />
<input type="submit" class="confirm" value="Confirm" />
<!-- TMPL_ELSE -->
- <input type="submit" class="deleteshelf" onclick="return confirmDelete(_('Are you sure you want to remove this List?'));" value="Delete" />
+ <input type="submit" class="deleteshelf" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST);" value="Delete" />
<!-- /TMPL_IF -->
</form>
<!-- /TMPL_IF -->
@@ -477,7 +478,7 @@ $(function() {
<input type="hidden" name="CONFIRM-<!-- TMPL_VAR NAME="confirm" -->" value="1" />
<input type="submit" class="confirm" value="Confirm" />
<!-- TMPL_ELSE -->
- <input type="submit" class="deleteshelf" onclick="return confirmDelete(_('Are you sure you want to remove this List?'));" value="Delete" />
+ <input type="submit" class="deleteshelf" onclick="return confirmDelete(MSG_CONFIRM_DELETE_LIST);" value="Delete" />
<!-- /TMPL_IF -->
</form>
<!-- /TMPL_IF -->
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tmpl
index 4749985..2b62407 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tmpl
@@ -7,6 +7,7 @@
<script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
<script type="text/JavaScript" language="JavaScript">
//<![CDATA[
+var MSG_CONFIRM_DELETE_HOLD = _("Are you sure you want to cancel this hold?");
$.tablesorter.addParser({
id: 'articles',
is: function(s) {return false; },
@@ -399,7 +400,7 @@ $.tablesorter.addParser({
<!-- TMPL_IF NAME="cancelable" -->
<form action="/cgi-bin/koha/opac-modrequest.pl" method="post">
<input type="hidden" name="biblionumber" value="<!-- TMPL_VAR NAME="biblionumber" -->" />
- <input type="submit" name="submit" class="icon delete cancel" value="Cancel" onclick="return confirmDelete('Are you sure you want to cancel this hold?');" /></form>
+ <input type="submit" name="submit" class="icon delete cancel" value="Cancel" onclick="return confirmDelete(MSG_CONFIRM_DELETE_HOLD);" /></form>
<!-- TMPL_ELSE -->
<!-- /TMPL_IF -->
--
1.7.0.4
More information about the Koha-patches
mailing list