From 37a6c7a28caf478b0b4cc6b4efb15fd541cbc14c Mon Sep 17 00:00:00 2001 From: Blou Date: Wed, 4 Dec 2019 11:49:01 -0500 Subject: [PATCH] Bug 24172: Allow translation of seasons in serials-edit.tt and subscription-detail.tt Seasons are not handled by locales. Those generated are stored in English in the database, and the display in serials-collection.tt is translating them. But once you click on "Edit serials" or if you go straight to the subscription's display, those are displayed as in the database: in English. This patch reproduces the same trick as in serial-collection.tt and allow for the display to be translated. NOTE: this patch's testing require knowledge of translation tools. Reproducing Caroline's test: 0- Make sure you have at least one language other than English installed 1- With staff interface in English, create a subscription with a seasonal numbering pattern and frequency, with locale in your other language 2- Check the prediction pattern, note that the season names are in English not the locale language 3- Change the staff interface to other language, redo the prediction pattern test with locale in other language, note that the season names are in other language 4- Save the subscription 5- Receive an issue, note that the season name in the "Numbered" column on serials-edit.pl is in English 6- Save your issue 7- Switch interface in other language 8- Note that the season name on serials-collection is in other language 9- If you check the database, you will see the season name is in English, even though the subscription.locale is something else 10- validate the different pages: - serials-collection.pl: display is translated - serials-edit.pl: name pulled directly from db - subscription-detail.pl: name pulled directly from db - detail.pl: name pulled directly from db - opac-detail.pl: name pulled directly from db 11- APPLY THE PATCH 12- translate the string a) ./translate update b) find the strings, translate them c) ./translate install 13- restart Plack ? 14- validate the pages again. Signed-off-by: Martin Renvoize Bug 24172: Allow translation of seasons in details.tt and opac-details.tt Signed-off-by: Martin Renvoize Bug 24172: Move duplicated code to an include file --- .../prog/en/includes/localizer.inc | 21 +++++++++++++++++++ .../prog/en/modules/catalogue/detail.tt | 5 ++++- .../en/modules/serials/serials-collection.tt | 21 ++----------------- .../prog/en/modules/serials/serials-edit.tt | 5 ++++- .../modules/serials/showpredictionpattern.tt | 21 ++----------------- .../en/modules/serials/subscription-detail.tt | 3 ++- .../bootstrap/en/modules/opac-detail.tt | 5 ++++- 7 files changed, 39 insertions(+), 42 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/localizer.inc diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/localizer.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/localizer.inc new file mode 100644 index 0000000000..864dbc276f --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/localizer.inc @@ -0,0 +1,21 @@ +[%~ BLOCK localize_numbering_pattern_season ~%] + [%~ IF ( matches = season.match('(.*)Spring(.*)') ) ~%] + [%~ matches.0 | html ~%]Spring[%~ matches.1 | html ~%] + [%~ ELSIF ( matches = season.match('(.*)Summer(.*)') ) ~%] + [%~ matches.0 | html ~%]Summer[%~ matches.1 | html ~%] + [%~ ELSIF ( matches = season.match('(.*)Fall(.*)') ) ~%] + [%~ matches.0 | html ~%]Fall[%~ matches.1 | html ~%] + [%~ ELSIF ( matches = season.match('(.*)Winter(.*)') ) ~%] + [%~ matches.0 | html ~%]Winter[%~ matches.1 | html ~%] + [%~ ELSIF ( matches = season.match('(.*)Spr(.*)') ) ~%] + [%~ matches.0 | html ~%]Spr[%~ matches.1 | html ~%] + [%~ ELSIF ( matches = season.match('(.*)Sum(.*)') ) ~%] + [%~ matches.0 | html ~%]Sum[%~ matches.1 | html ~%] + [%~ ELSIF ( matches = season.match('(.*)Fal(.*)') ) ~%] + [%~ matches.0 | html ~%]Fal[%~ matches.1 | html ~%] + [%~ ELSIF ( matches = season.match('(.*)Win(.*)') ) ~%] + [%~ matches.0 | html ~%]Win[%~ matches.1 | html ~%] + [%~ ELSE ~%] + [%~ season | html ~%] + [%~ END ~%] +[%~ END ~%] \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index 96096417e0..9f392e0d75 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -9,6 +9,7 @@ [% USE Frameworks %] [% USE Price %] [% USE TablesSettings %] +[% PROCESS 'localizer.inc' %] [% PROCESS 'i18n.inc' %] [% SET CoverImagePlugins = KohaPlugins.get_plugins_intranet_cover_images %] @@ -798,7 +799,9 @@ [% FOREACH latestserial IN subscription.latestserials %] - [% latestserial.serialseq | html %] + + [% PROCESS localize_numbering_pattern_season season => latestserial.serialseq %] + [% latestserial.planneddate | $KohaDates %] [% latestserial.publisheddate | $KohaDates %] [% latestserial.publisheddatetext | html %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt index ff542c79ed..2f64cf5ad0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt @@ -4,6 +4,7 @@ [% USE Branches %] [% USE HtmlTags %] [% USE KohaDates %] +[% PROCESS 'localizer.inc' %] [% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] Serial collection information for [% bibliotitle | html %] › Serials › Koha @@ -266,25 +267,7 @@ [% END %] - [% IF ( matches = serial.serialseq.match('(.*)Spring(.*)') ) %] - [% matches.0 | html %]Spring[% matches.1 | html %] - [% ELSIF ( matches = serial.serialseq.match('(.*)Summer(.*)') ) %] - [% matches.0 | html %]Summer[% matches.1 | html %] - [% ELSIF ( matches = serial.serialseq.match('(.*)Fall(.*)') ) %] - [% matches.0 | html %]Fall[% matches.1 | html %] - [% ELSIF ( matches = serial.serialseq.match('(.*)Winter(.*)') ) %] - [% matches.0 | html %]Winter[% matches.1 | html %] - [% ELSIF ( matches = prediction.number.match('(.*)Spr(.*)') ) %] - [% matches.0 | html %]Spr[% matches.1 | html %] - [% ELSIF ( matches = prediction.number.match('(.*)Sum(.*)') ) %] - [% matches.0 | html %]Sum[% matches.1 | html %] - [% ELSIF ( matches = prediction.number.match('(.*)Fal(.*)') ) %] - [% matches.0 | html %]Fal[% matches.1 | html %] - [% ELSIF ( matches = prediction.number.match('(.*)Win(.*)') ) %] - [% matches.0 | html %]Win[% matches.1 | html %] - [% ELSE %] - [% serial.serialseq | html %] - [% END %] + [% PROCESS localize_numbering_pattern_season season => serial.serialseq %] [% INCLUDE 'serial-status.inc' serial = serial %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt index 8c5ba5d8db..11e4be993b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-edit.tt @@ -1,6 +1,7 @@ [% USE raw %] [% USE Asset %] [% USE AuthorisedValues %] +[% PROCESS 'localizer.inc' %] [% INCLUDE 'doc-head-open.inc' %] Serial edition [% bibliotitle | html %] › Serials › Koha [% INCLUDE 'doc-head-close.inc' %] @@ -138,7 +139,9 @@ $(document).ready(function() { - Issue + Issue diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/showpredictionpattern.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/showpredictionpattern.tt index ea6e6ab46d..255c90363c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/showpredictionpattern.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/showpredictionpattern.tt @@ -1,4 +1,5 @@ [% USE KohaDates %] +[% PROCESS 'localizer.inc' %]

Prediction pattern

[% IF (not_consistent_end_date) %]

End date is not consistent with subscription length.

@@ -41,25 +42,7 @@ [% FOREACH prediction IN predictions_loop %] - [% IF ( matches = prediction.number.match('(.*)Spring(.*)') ) %] - [% matches.0 | html %]Spring[% matches.1 | html %] - [% ELSIF ( matches = prediction.number.match('(.*)Summer(.*)') ) %] - [% matches.0 | html %]Summer[% matches.1 | html %] - [% ELSIF ( matches = prediction.number.match('(.*)Fall(.*)') ) %] - [% matches.0 | html %]Fall[% matches.1 | html %] - [% ELSIF ( matches = prediction.number.match('(.*)Winter(.*)') ) %] - [% matches.0 | html %]Winter[% matches.1 | html %] - [% ELSIF ( matches = prediction.number.match('(.*)Spr(.*)') ) %] - [% matches.0 | html %]Spr[% matches.1 | html %] - [% ELSIF ( matches = prediction.number.match('(.*)Sum(.*)') ) %] - [% matches.0 | html %]Sum[% matches.1 | html %] - [% ELSIF ( matches = prediction.number.match('(.*)Fal(.*)') ) %] - [% matches.0 | html %]Fal[% matches.1 | html %] - [% ELSIF ( matches = prediction.number.match('(.*)Win(.*)') ) %] - [% matches.0 | html %]Win[% matches.1 | html %] - [% ELSE %] - [% prediction.number | html %] - [% END %] + [% PROCESS localize_numbering_pattern_season season => prediction.number %] [% IF (prediction.publicationdate) %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt index 73e97e992a..6efaf60092 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt @@ -7,6 +7,7 @@ [% USE Price %] [% USE TablesSettings %] [% SET footerjs = 1 %] +[% PROCESS 'localizer.inc' %] [% INCLUDE 'doc-head-open.inc' %] Details for subscription #[% subscriptionid | html %] › Serials › Koha [% INCLUDE 'doc-head-close.inc' %] @@ -257,7 +258,7 @@ [% FOREACH serialslis IN serialslist %] - [% serialslis.serialseq | html %] + [% PROCESS localize_numbering_pattern_season season => serialslis.serialseq %] [% IF serialslis.planneddate %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt index 4ef51c19c4..726e885aa7 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -7,6 +7,7 @@ [% USE TablesSettings %] [% USE AuthorisedValues %] [% USE KohaPlugins %] +[% PROCESS 'localizer.inc' %] [% SET TagsShowEnabled = ( ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsShowOnDetail ) %] [% SET TagsInputEnabled = ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsInputOnDetail ) %] [% SET CoverImagePlugins = KohaPlugins.get_plugins_opac_cover_images %] @@ -763,7 +764,9 @@ [% FOREACH latestserial IN subscription.latestserials %] - [% latestserial.serialseq | html %] + + [% PROCESS localize_numbering_pattern_season season => latestserial.serialseq %] + [% latestserial.publisheddate | $KohaDates %] [% latestserial.planneddate | $KohaDates %] -- 2.34.1