Browse Source

Bug 26256: Move translatable strings out of templates and into serials-toolbar.js

This patch removes the definition of translatable strings out of
templates and into the corresponding JavaScript file, using the new JS
i81n function.

To test:

- Apply the patch and go to Serials and search for a subscription.
- Open the detail page for an open subscription.
- Click the "Close" button. You should get a confirmation, "Are you
  sure you want to close this subscription?"
- Confirm that you want to close it.
- When the page reloads, click the "Reopen" button. You should get a
  confirmation, "Are you sure you want to reopen this subscription?"
- Cancel.
- Choose Edit -> Delete subscription. You should get a confirmation,
  "Are you sure you want to delete this subscription?"
- Perform the same tests from the "Serial collection" page.

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/serials-toolbar.js for translation,
  e.g.:

  msgid "Are you sure you want to delete this subscription?"
  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: Alexis Ripetti <alexis.ripetti@inLibro.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
20.11.x
Owen Leonard 4 years ago
committed by Jonathan Druart
parent
commit
ea72b15480
  1. 3
      koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt
  2. 5
      koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-home.tt
  3. 3
      koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt
  4. 3
      koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt
  5. 8
      koha-tmpl/intranet-tmpl/prog/js/serials-toolbar.js

3
koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt

@ -305,9 +305,6 @@
[% INCLUDE 'datatables.inc' %]
<script>
var subscriptionid = "[% subscriptionid | html %]";
var MSG_CLOSE_SUBSCRIPTION = _("Are you sure you want to close this subscription?");
var MSG_REOPEN_SUBSCRIPTION = _("Are you sure you want to reopen this subscription?");
var CONFIRM_DELETE_SUBSCRIPTION = _("Are you sure you want to delete this subscription?");
</script>
[% Asset.js("js/serials-toolbar.js") | $raw %]
[% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]

5
koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-home.tt

@ -33,11 +33,8 @@
[% MACRO jsinclude BLOCK %]
[% Asset.js("js/serials-toolbar.js") | $raw %]
<script type="text/javascript">
<script>
var subscriptionid = "[% subscriptionid | html %]";
var MSG_CLOSE_SUBSCRIPTION = _("Are you sure you want to close this subscription?");
var MSG_REOPEN_SUBSCRIPTION = _("Are you sure you want to reopen this subscription?");
var CONFIRM_DELETE_SUBSCRIPTION = _("Are you sure you want to delete this subscription?");
</script>
[% END %]

3
koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt

@ -410,9 +410,6 @@
[% INCLUDE 'datatables.inc' %]
<script>
var subscriptionid = "[% subscriptionid | html %]";
var MSG_CLOSE_SUBSCRIPTION = _("Are you sure you want to close this subscription?");
var MSG_REOPEN_SUBSCRIPTION = _("Are you sure you want to reopen this subscription?");
var CONFIRM_DELETE_SUBSCRIPTION = _("Are you sure you want to delete this subscription?");
</script>
[% Asset.js("js/serials-toolbar.js") | $raw %]
<script>

3
koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt

@ -493,9 +493,6 @@
[% MACRO jsinclude BLOCK %]
<script>
var subscriptionid = "[% subscriptionid | html %]";
var MSG_CLOSE_SUBSCRIPTION = _("Are you sure you want to close this subscription?");
var MSG_REOPEN_SUBSCRIPTION = _("Are you sure you want to reopen this subscription?");
var CONFIRM_DELETE_SUBSCRIPTION = _("Are you sure you want to delete this subscription?");
</script>
[% Asset.js("js/serials-toolbar.js") | $raw %]
[% Asset.js("js/mana.js") | $raw %]

8
koha-tmpl/intranet-tmpl/prog/js/serials-toolbar.js

@ -1,20 +1,20 @@
/* global MSG_CLOSE_SUBSCRIPTION MSG_REOPEN_SUBSCRIPTION CONFIRM_DELETE_SUBSCRIPTION subscriptionid */
/* global subscriptionid */
function confirm_close() {
var is_confirmed = confirm( MSG_CLOSE_SUBSCRIPTION );
var is_confirmed = confirm( __("Are you sure you want to close this subscription?") );
if (is_confirmed) {
window.location="subscription-detail.pl?subscriptionid=" + subscriptionid + "&op=close";
}
}
function confirm_reopen() {
var is_confirmed = confirm( MSG_REOPEN_SUBSCRIPTION );
var is_confirmed = confirm( __("Are you sure you want to reopen this subscription?") );
if (is_confirmed) {
window.location="subscription-detail.pl?subscriptionid=" + subscriptionid + "&op=reopen";
}
}
function confirm_deletion() {
var is_confirmed = confirm( CONFIRM_DELETE_SUBSCRIPTION );
var is_confirmed = confirm( __("Are you sure you want to delete this subscription?") );
if (is_confirmed) {
window.location="subscription-detail.pl?subscriptionid=" + subscriptionid + "&op=del";
}

Loading…
Cancel
Save