From e9e169f5d31bca20900345b2e42942dc410a2314 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 cd1ebf26b1..a14a6a7a19 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -8,6 +8,7 @@ [% USE Biblio %] [% USE Price %] [% USE TablesSettings %] +[% PROCESS 'localizer.inc' %] [% PROCESS 'i18n.inc' %] [% IF Koha.Preference('AmazonAssocTag') %] @@ -803,7 +804,9 @@ Note that permanent location is a code, and location may be an authval. [% FOREACH latestserial IN subscription.latestserials %] - [% latestserial.serialseq | html %] + + [% PROCESS localize_numbering_pattern_season season => latestserial.serialseq %] + [% latestserial.planneddate | $KohaDates %] [% latestserial.publisheddate | $KohaDates %] 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 19cc576664..69419f32fc 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 @@ -3,6 +3,7 @@ [% USE AuthorisedValues %] [% USE Branches %] [% USE KohaDates %] +[% PROCESS 'localizer.inc' %] [% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] Serial collection information for [% bibliotitle | html %] › Serials › Koha @@ -269,25 +270,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 %] [% IF ( serial.status1 ) %]Expected[% END %] 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 fdea3ee1be..3cf093c996 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' %] @@ -142,7 +143,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 8fac9a8cfc..3b74e2c784 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' %] @@ -268,7 +269,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 ab2f28e615..5861fee90a 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -6,6 +6,7 @@ [% USE Branches %] [% USE TablesSettings %] [% USE AuthorisedValues %] +[% PROCESS 'localizer.inc' %] [% SET TagsShowEnabled = ( ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsShowOnDetail ) %] [% SET TagsInputEnabled = ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'TagsEnabled' ) == 1 ) && TagsInputOnDetail ) %] [% IF Koha.Preference('AmazonAssocTag') %] @@ -761,7 +762,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