Bug 20139: Improve MARC mapping translatable strings
authorPasi Kallinen <pasi.kallinen@joensuu.fi>
Mon, 5 Feb 2018 12:45:25 +0000 (14:45 +0200)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 27 Feb 2018 16:53:15 +0000 (13:53 -0300)
- 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>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

koha-tmpl/intranet-tmpl/prog/en/modules/admin/koha2marclinks.tt

index 3dc367f..a402183 100644 (file)
     <script type="text/javascript" src="[% interface %]/[% theme %]/js/admin-menu_[% KOHA_VERSION %].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();
             }