Bugzilla – Attachment 110816 Details for
Bug 26229
Move translatable strings out of categories.tt and into categories.js
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26229: Move translatable strings out of categories.tt and into categories.js
Bug-26229-Move-translatable-strings-out-of-categor.patch (text/plain), 4.13 KB, created by
David Nind
on 2020-09-27 07:12:07 UTC
(
hide
)
Description:
Bug 26229: Move translatable strings out of categories.tt and into categories.js
Filename:
MIME Type:
Creator:
David Nind
Created:
2020-09-27 07:12:07 UTC
Size:
4.13 KB
patch
obsolete
>From 946cf65fa3a8c2f3bca944212dbccef7727c7b25 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Mon, 17 Aug 2020 14:50:46 +0000 >Subject: [PATCH] Bug 26229: Move translatable strings out of categories.tt and > into categories.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, 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. > >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/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. > >Signed-off-by: David Nind <david@davidnind.com> >--- > 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(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt >index 0c836f418b..d83d7d27d3 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt >@@ -624,8 +624,6 @@ > [% INCLUDE 'datatables.inc' %] > [% INCLUDE 'columns_settings.inc' %] > <script> >- var MSG_CATEGORYCODE_CHARS = _("Category code can only contain the following characters: letters, numbers, - and _."); >- var MSG_ONE_ENROLLMENTPERIOD = ("Please choose an enrollment period in months OR by date."); > var columns_settings = [% TablesSettings.GetColumns( 'admin', 'categories', 'patron_categories', 'json' ) | $raw %]; > </script> > [% Asset.js("js/categories.js") | $raw %] >diff --git a/koha-tmpl/intranet-tmpl/prog/js/categories.js b/koha-tmpl/intranet-tmpl/prog/js/categories.js >index 8031fff535..28f4ad700c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/categories.js >+++ b/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.") > } > } > >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 26229
:
108401
|
110816
|
110823