Bugzilla – Attachment 183216 Details for
Bug 37926
Bookings - "to" untranslatable
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37926: Allow for translation of "to" in date range selection
Bug-37926-Allow-for-translation-of-to-in-date-rang.patch (text/plain), 3.48 KB, created by
David Flater
on 2025-06-12 20:09:51 UTC
(
hide
)
Description:
Bug 37926: Allow for translation of "to" in date range selection
Filename:
MIME Type:
Creator:
David Flater
Created:
2025-06-12 20:09:51 UTC
Size:
3.48 KB
patch
obsolete
>From 58c2d483a0f43db134bfee79a5cc4ddf3dab0ca7 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Fri, 6 Jun 2025 14:36:38 +0000 >Subject: [PATCH] Bug 37926: Allow for translation of "to" in date range > selection > >When a calendar widget has been initiated as a date range selector (as >it is when creating a new booking), the selected dates are added to the >input field as "0000-00-00 to 0000-00-00". This "to" needs to be >translatable. > >To test, apply the patch and test that the correct strings are >translatable. In this example I'm testing fr-FR: > >- Update a translation: > > gulp po:update --lang fr-FR > > cd misc/translator > > perl translate update fr-FR > >- Open the corresponding .po file for the strings pulled from > JavaScript e.g. misc/translator/po/fr-FR-messages-js.po > - Locate strings pulled from intranet-tmpl/prog/js/calendar.js for > translation, e.g.: > > #: koha-tmpl/intranet-tmpl/prog/js/calendar.js:144 > msgctxt "As in, from date1 to date2" > msgid "to" > msgstr "" > > - Edit the "msgstr" string however you want (it's just for testing) > - Install the updated translation: > > > perl translate install fr-FR > >- In the staff interface, locate an bibliographic record with items and > change the "Bookable" option from the item details screen. >- Switch to your updated translation in the staff interface. >- Click the "Place booking" button. >- Fill out all the fields in the "Place booking" modal. >- After you select a date range, the "Booking dates" input field should > show your translated text. > >Sponsored-by: Athens County Public Libraries >Signed-off-by: David Flater <flaterdavid@gmail.com> >--- > koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc | 5 +++-- > koha-tmpl/intranet-tmpl/prog/js/calendar.js | 5 ++++- > 2 files changed, 7 insertions(+), 3 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc >index 681e8cc401..1437f2e157 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc >@@ -43,8 +43,9 @@ > [% Asset.js("lib/maskito/maskito.core.js") | $raw %] > [% Asset.js("lib/maskito/maskito.kit.js") | $raw %] > <script> >- flatpickr.l10ns.default.weekdays = flatpickr_weekdays; >- flatpickr.l10ns.default.months = flatpickr_months; >+ flatpickr.l10ns.default.weekdays = flatpickr_weekdays; >+ flatpickr.l10ns.default.months = flatpickr_months; >+ flatpickr.l10ns.default.rangeSeparator = flatpickr_rangeSeparator; > let flatpickr_defaults = { > allowInput: true, > dateFormat: "Y-m-d", >diff --git a/koha-tmpl/intranet-tmpl/prog/js/calendar.js b/koha-tmpl/intranet-tmpl/prog/js/calendar.js >index d5af71b562..e1637b2ba7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/calendar.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/calendar.js >@@ -1,4 +1,4 @@ >-/* global debug sentmsg __ dateformat_pref flatpickr_dateformat_string bidi calendarFirstDayOfWeek */ >+/* global debug sentmsg __ dateformat_pref flatpickr_dateformat_string bidi calendarFirstDayOfWeek __p */ > /* exported DateTime_from_syspref flatpickr_weekdays flatpickr_months */ > var MSG_PLEASE_ENTER_A_VALID_DATE = __( > "Please enter a valid date (should match %s)." >@@ -141,6 +141,9 @@ jQuery.validator.addMethod( > } > ); > >+var flatpickr_rangeSeparator = >+ " " + __p("As in, from date1 to date2", "to") + " "; >+ > var flatpickr_weekdays = { > shorthand: [ > __("Sun"), >-- >2.39.5
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 37926
:
183096
|
183129
| 183216