Bugzilla – Attachment 126581 Details for
Bug 26244
Move translatable strings out of memberentrygen.tt and into JavaScript
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26244: Move translatable strings out of memberentrygen.tt and into JavaScript
Bug-26244-Move-translatable-strings-out-of-membere.patch (text/plain), 6.10 KB, created by
Owen Leonard
on 2021-10-20 11:39:16 UTC
(
hide
)
Description:
Bug 26244: Move translatable strings out of memberentrygen.tt and into JavaScript
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2021-10-20 11:39:16 UTC
Size:
6.10 KB
patch
obsolete
>From a29b32ee7607927fa1200f23485fae1df20b6a1f Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Wed, 19 Aug 2020 00:48:54 +0000 >Subject: [PATCH] Bug 26244: Move translatable strings out of memberentrygen.tt > and into JavaScript > >This patch removes the definition of translatable strings out of >templates and into the corresponding JavaScript file, using the new JS >i81n function. > >Note: I was unable to trigger the confirmation message in the >check_form_borrowers function. I think the form is now structured in a >way that it is never triggered, thus a candidate for removal. > >To test: > >- Apply the patch and go to Patrons. >- Add or edit a patron. >- Select a date of birth at least one month in the past and confirm that > the patron's age is displayed in the hint below. >- Test multiple variations to confirm that the singular and plural of > 'year' and 'month' display correctly. (e.g. 1 year 9 months, 2 years, > etc). >- Set some patron messaging preferences for the patron. >- Change the patron category. >- You should get a confirmation: "Change messaging preferences to > default for this category?" > >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/members.js for translation, e.g.: > > msgid "%s years" > 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. >--- > .../prog/en/modules/members/memberentrygen.tt | 18 ------------------ > koha-tmpl/intranet-tmpl/prog/js/members.js | 10 +++++----- > .../prog/js/messaging-preference-form.js | 2 +- > 3 files changed, 6 insertions(+), 24 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >index ebd034a5f0..7514ee436b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -1773,24 +1773,6 @@ legend:hover { > }); > }); > >- var MSG_SEPARATOR = _("Separator must be / in field %s"); >- var MSG_INCORRECT_DAY = _("Invalid day entered in field %s"); >- var MSG_INCORRECT_MONTH = _("Invalid month entered in field %s"); >- var MSG_INCORRECT_YEAR = _("Invalid year entered in field %s"); >- var MSG_DUPLICATE_PATRON = _("Warning: Duplicate patron"); >- var MSG_DUPLICATE_ORGANIZATION = _("Warning: Duplicate organization"); >- var MSG_LATE_EXPIRY = _("Warning: Expiration date falls before enrollment date"); >- var MSG_DUPLICATE_SUSPICION = _("Please confirm whether this is a duplicate patron"); >- var MSG_MONTH = _("%s month") >- var MSG_MONTHS = _("%s months") >- var MSG_YEAR = _("%s year") >- var MSG_YEARS = _("%s years") >- var LABEL_CHANGE = _("Change"); >- var LABEL_SET_TO_PATRON = _("Set to patron"); >- var LABEL_AGE = _("Age"); >- var MSG_MESSAGING_DFEAULTS = _("Change messaging preferences to default for this category?"); >- var MSG_PASSWORD_LENGTH = _("Minimum password length: %s"); >- > [% IF quickadd && opadd && !check_member %] > $(document).ready(function () { > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/members.js b/koha-tmpl/intranet-tmpl/prog/js/members.js >index a9e6a870ae..1d970db8f0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/members.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/members.js >@@ -17,7 +17,7 @@ function check_form_borrowers(nav){ > //patrons form to test if you checked no to the question of double > if (statut!=1 && document.form.check_member.value > 0 ) { > if (!(document.form.answernodouble.checked)){ >- message_champ+= MSG_DUPLICATE_SUSPICION; >+ message_champ += __("Please confirm whether this is a duplicate patron"); > statut=1; > document.form.nodouble.value=0; > } else { >@@ -72,7 +72,7 @@ function update_category_code(category_code) { > //Change password length hint > var hint = $("#password").siblings(".hint").first(); > var min_length = $('select'+category_selector+' option:selected').data('pwdLength'); >- var hint_string = MSG_PASSWORD_LENGTH.format(min_length); >+ var hint_string = __("Minimum password length: %s").format(min_length); > hint.html(hint_string); > } > >@@ -159,16 +159,16 @@ function write_age() { > > var age_string; > if (age.year || age.month) { >- age_string = LABEL_AGE + ": "; >+ age_string = __("Age") + ": "; > } > > if (age.year) { >- age_string += age.year > 1 ? MSG_YEARS.format(age.year) : MSG_YEAR.format(age.year); >+ age_string += age.year > 1 ? __("%s years").format(age.year) : __("%s year").format(age.year); > age_string += " "; > } > > if (age.month) { >- age_string += age.month > 1 ? MSG_MONTHS.format(age.month) : MSG_MONTH.format(age.month); >+ age_string += age.month > 1 ? __("%s months").format(age.month) : __("%s month").format(age.month); > } > > hint.html(age_string); >diff --git a/koha-tmpl/intranet-tmpl/prog/js/messaging-preference-form.js b/koha-tmpl/intranet-tmpl/prog/js/messaging-preference-form.js >index 3babbbd1f2..752dc9edb1 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/messaging-preference-form.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/messaging-preference-form.js >@@ -13,7 +13,7 @@ $(document).ready(function(){ > messaging_prefs_loading.show(); > var categorycode = $(this).val(); > if (message_prefs_dirty) { >- if (!confirm( MSG_MESSAGING_DFEAULTS )) { >+ if (!confirm( __("Change messaging preferences to default for this category?") )) { > // Not loading messaging defaults. Hide loading indicator > messaging_prefs_loading.hide(); > return; >-- >2.20.1
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 26244
:
108688
|
126581
|
131540
|
132806