Bugzilla – Attachment 194205 Details for
Bug 24172
Locale is ignored when saving season name in the database
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24172: (follow-up) Add translation of seasons in catalogue_detail.inc and opac-details.tt
Bug-24172-follow-up-Add-translation-of-seasons-in-.patch (text/plain), 5.93 KB, created by
David Nind
on 2026-02-28 22:24:27 UTC
(
hide
)
Description:
Bug 24172: (follow-up) Add translation of seasons in catalogue_detail.inc and opac-details.tt
Filename:
MIME Type:
Creator:
David Nind
Created:
2026-02-28 22:24:27 UTC
Size:
5.93 KB
patch
obsolete
>From ee932c965bfd97a6d19fe2b910f821d8589c6b8e Mon Sep 17 00:00:00 2001 >From: Hammat Wele <hammat.wele@inlibro.com> >Date: Fri, 13 Feb 2026 12:22:10 +0000 >Subject: [PATCH] Bug 24172: (follow-up) Add translation of seasons in > catalogue_detail.inc and opac-details.tt > >Signed-off-by: David Nind <david@davidnind.com> >--- > .../tables/items/catalogue_detail.inc | 31 ++++++++++++++++--- > .../bootstrap/en/modules/opac-detail.tt | 8 ++--- > 2 files changed, 31 insertions(+), 8 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc >index 9a1a3eaf65..3c9554292b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc >@@ -489,15 +489,15 @@ > [%# FIXME Previously we displayed the column if at least one item of the biblio had an enumchron/serial_issue_number. Now it's only if one item of the ones displayed on the current page, how is that bad? How can it be fixed in an elegant way? Should we display the column only if biblio.serial? %] > let serial = row.serial_item ? row.serial_item.serial : null; > if ( row.serial_issue_number && serial && serial.serialseq ) { >- nodes += '<span class="enum">%s</span>'.format(escape_str(row.serial_issue_number)); >+ nodes += '<span class="enum">%s</span>'.format( localizeNumberingPatternSeason(escape_str(row.serial_issue_number))); > if ( serial.serialseq && row.serial_issue_number != serial.serialseq ) { > nodes += ' <span class="sep"> -- </span>' >- nodes += ' <span class="serialseq">%s</span>'.format(escape_str(serial.serialseq)); >+ nodes += ' <span class="serialseq">%s</span>'.format(localizeNumberingPatternSeason(escape_str(serial.serialseq))); > } > } else if ( row.serial_issue_number ) { >- nodes += ' <span class="enum">%s</span>'.format(escape_str(row.serial_issue_number)); >+ nodes += ' <span class="enum">%s</span>'.format(localizeNumberingPatternSeason(escape_str(row.serial_issue_number))); > } else if ( serial && serial.serialseq ) { >- nodes += '<span class="serialseq">%s</span>'.format(escape_str(serial.serialseq)); >+ nodes += '<span class="serialseq">%s</span>'.format(localizeNumberingPatternSeason(escape_str(serial.serialseq))); > } > [% IF Koha.Preference('DisplayPublishedDate') %] > if ( serial && serial.publisheddate ) { >@@ -933,5 +933,28 @@ > node.textContent = link_text; > return node; > } >+ function localizeNumberingPatternSeason(season) { >+ if (!season) return ""; >+ >+ const patterns = [ >+ { regex: /(.*)Spring(.*)/, label: _("Spring") }, >+ { regex: /(.*)Summer(.*)/, label: _("Summer") }, >+ { regex: /(.*)Fall(.*)/, label: _("Fall") }, >+ { regex: /(.*)Winter(.*)/, label: _("Winter") }, >+ { regex: /(.*)Spr(.*)/, label: _("Spr") }, >+ { regex: /(.*)Sum(.*)/, label: _("Sum") }, >+ { regex: /(.*)Fal(.*)/, label: _("Fal") }, >+ { regex: /(.*)Win(.*)/, label: _("Win") } >+ ]; >+ >+ for (const p of patterns) { >+ const matches = season.match(p.regex); >+ if (matches) { >+ return matches[1] + p.label + matches[2]; >+ } >+ } >+ >+ return season; >+ } > </script> > [% END %] >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 31ebf3f77a..4678a3b8a8 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >@@ -1459,15 +1459,15 @@ > [% SET serial = ITEM_RESULT.serial %] > <td class="vol_info"> > [% IF ITEM_RESULT.enumchron && serial.serialseq %] >- <span class="enum">[% ITEM_RESULT.enumchron | html %]</span> >+ <span class="enum">[% PROCESS localize_numbering_pattern_season season => ITEM_RESULT.enumchron %]</span> > [% IF ( serial.serialseq && ITEM_RESULT.enumchron!=serial.serialseq ) %] > <span class="sep"> -- </span> >- <span class="serialseq">[% serial.serialseq | html %]</span> >+ <span class="serialseq">[% PROCESS localize_numbering_pattern_season season => serial.serialseq %]</span> > [% END %] > [% ELSIF ITEM_RESULT.enumchron %] >- <span class="enum">[% ITEM_RESULT.enumchron | html %]</span> >+ <span class="enum">[% PROCESS localize_numbering_pattern_season season => ITEM_RESULT.enumchron %]</span> > [% ELSIF serial.serialseq %] >- <span class="serialseq">[% serial.serialseq | html %]</span> >+ <span class="serialseq">[% PROCESS localize_numbering_pattern_season season => serial.serialseq %]</span> > [% END %] > [% IF ( Koha.Preference('DisplayPublishedDate') && serial.publisheddate ) %] > <span class="pubdate">([% serial.publisheddate | $KohaDates %])</span> >-- >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 24172
:
95996
|
95998
|
96051
|
100331
|
100332
|
100888
|
139803
|
139804
|
139805
|
139806
|
139807
|
139808
|
139809
|
148921
|
151330
|
158671
|
170319
|
171104
|
172223
|
172230
|
174095
|
175493
|
175494
|
175495
|
177395
|
177396
|
177397
|
177398
|
177633
|
177634
|
177635
|
177636
|
179883
|
179884
|
179885
|
179886
|
185747
|
185748
|
185749
|
191029
|
193056
|
194202
|
194203
|
194204
| 194205