@@ -, +, @@ into categories.js - Apply the patch, go to Administration -> Patron categories - Click "New category" - Enter some special characters in the "Category code" field, e.g. "%^&*" - Try to submit the form without filling in any other details. - The category code field should have a validation message, "Category code can only contain the following characters: letters, numbers, - and _." - The enrollment period fields should have a validation message, "Please choose an enrollment period in months OR by date." - Enter valid data and confirm that the form can be submitted. - 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/categories.js for translation, e.g.: msgid "Please choose an enrollment period in months OR by date." 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. --- koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt | 2 -- koha-tmpl/intranet-tmpl/prog/js/categories.js | 10 ++++++---- 2 files changed, 6 insertions(+), 6 deletions(-) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt @@ -624,8 +624,6 @@ [% INCLUDE 'datatables.inc' %] [% INCLUDE 'columns_settings.inc' %] [% Asset.js("js/categories.js") | $raw %] --- a/koha-tmpl/intranet-tmpl/prog/js/categories.js +++ a/koha-tmpl/intranet-tmpl/prog/js/categories.js @@ -1,3 +1,5 @@ +/* global __ */ + jQuery.validator.addMethod( "letters_numbers", function(value,element){ var patt = /^[a-zA-Z0-9\-_]+$/g; if (patt.test(element.value)) { @@ -5,7 +7,7 @@ jQuery.validator.addMethod( "letters_numbers", function(value,element){ } else { return false; } - }, MSG_CATEGORYCODE_CHARS + }, __("Category code can only contain the following characters: letters, numbers, - and _.") ); jQuery.validator.addMethod( "enrollment_period", function(){ @@ -16,7 +18,7 @@ jQuery.validator.addMethod( "enrollment_period", function(){ } else { return true; } - }, MSG_ONE_ENROLLMENTPERIOD + }, __("Please choose an enrollment period in months OR by date.") ); @@ -91,10 +93,10 @@ $(document).ready(function() { }, messages: { enrolmentperiod: { - required: MSG_ONE_ENROLLMENTPERIOD + required: __("Please choose an enrollment period in months OR by date.") }, enrolmentperioddate: { - required: MSG_ONE_ENROLLMENTPERIOD + required: __("Please choose an enrollment period in months OR by date.") } } --