When placing a booking, where we choose the dates of the booking, the "to" between the two dates is not translatable. To get there: 1. In a detailed record, click on the Items tab on the left 2. Where it says Bookable, choose Yes and click Update 3. Click Place booking 4. Find and select a patron to enable the other fields 5. Under Booking dates, choose two dates --> Dates are displayed as date1 to date2 6. Translate the interface gulp po:update --lang fr-CA ./misc/translator/translate update fr-CA 7. In the system preference StaffInterfaceLanguage, select the other language and click Save all I18N/L10N preferences 8. Change the interface in the other language 9. Redo steps 3 to 5 --> Dates are still displayed as date1 to date2 I searched the various po files, but I didn't take the time to check all occurrences of "to", obviously. I mostly searched for "%s to %s" and modals/place_booking.inc.
Created attachment 183096 [details] [review] Bug 37926: Allow for translation of "to" in date range selection 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
Created attachment 183129 [details] [review] 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
Created attachment 183216 [details] [review] 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>
Hi Owen, How is this __p call supposed to work: + " " + __p("As in, from date1 to date2", "to") + " "; The As in.. is provided as context? How does that match work? How should the translation file look ?
> - 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 ""
(In reply to Owen Leonard from comment #5) > > - 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 "" Ok, thanks. So if someone wants to use this translation on another page in a date range context, he should know that he needs to add this specific context string "As in, from date1 to date2". As the use of these context translations increases, we will probably need some more direction on how to formulate them for efficient use.
Created attachment 185087 [details] [review] 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> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Nice work everyone! Pushed to main for 25.11