From 6986fed283f5d0dc7c310c095737ad9bd808d011 Mon Sep 17 00:00:00 2001
From: Pasi Kallinen <pasi.kallinen@joensuu.fi>
Date: Mon, 5 Feb 2018 14:45:25 +0200
Subject: [PATCH] Bug 20139: Improve MARC mapping translatable strings

- Allow translating one error message
- Use string formatting with placeholders instead of concatenation

Test plan:

1) Go to Home -> Administration -> Koha to MARC Mapping
2) Click on the "Add" button to add a new mapping
3) Note the popup text looks correct
4) Enter something invalid
5) Note the error message
6) Click on any of the "Remove" buttons to remove a mapping
7) Note the popup text looks correct
8) Update, translate the new msgid's, and install a language
9) Repeat 1-7, note how the message are in the correct
   language

Signed-off-by: Pasi Kallinen <pasi.kallinen@joensuu.fi>
---
 koha-tmpl/intranet-tmpl/prog/en/modules/admin/koha2marclinks.tt | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/koha2marclinks.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/koha2marclinks.tt
index d171710ea9..d4c7ef5033 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/koha2marclinks.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/koha2marclinks.tt
@@ -71,18 +71,18 @@
     <script type="text/javascript" src="[% interface %]/[% theme %]/js/admin-menu.js"></script>
     <script type="text/javascript">
         function AddFld(kohafield) {
-            var fieldstr = prompt( _("Adding a mapping for: ") + kohafield + ".\n" + _("Please enter field tag and subfield code, separated by a comma. (For control fields: add '@' as subfield code.)\nThe change will be applied immediately.") );
+            var fieldstr = prompt( _("Adding a mapping for: %s.").format(kohafield) + "\n" + _("Please enter field tag and subfield code, separated by a comma. (For control fields: add '@' as subfield code.)\nThe change will be applied immediately.") );
             var temp = fieldstr.split(',');
             if( temp.length == 2 ) {
                 $('#add_field').val( kohafield+','+fieldstr );
                 $('#koha2marc').submit();
             } else {
-                alert( "Invalid input. Enter something like: 245,a" );
+                alert( _("Invalid input. Enter something like: 245,a") );
             }
         }
 
         function RemFld(tagfield, subfield ) {
-            if( confirm( _("Mapping will be removed for: ") + tagfield + subfield + ".\n" + _("The change will be applied immediately." ))) {
+            if( confirm( _("Mapping will be removed for: %s.").format(tagfield + subfield) + "\n" + _("The change will be applied immediately." ))) {
                 $('#remove_field').val(tagfield+','+subfield);
                 $('#koha2marc').submit();
             }
-- 
2.11.0