Bug 40610: Update OPAC templates to improve ease of translation

This patch updates the markup structure of some OPAC include files in
order to make the translation process easier.

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
  > perl misc/translator/translate update fr-FR

- Open the corresponding .po file for the strings pulled from
  the include file and locate the updated strings.

  - misc/translator/po/fr-FR-messages.po
    - opac-tmpl/bootstrap/en/includes/biblio-title.inc lines 4 & 5
    - opac-tmpl/bootstrap/en/includes/date-format.inc lines 4, 6, 8
    - opac-tmpl/bootstrap/en/includes/holds-table.inc lines 132 & 135
    - opac-tmpl/bootstrap/en/includes/masthead.inc line 498

  - misc/translator/po/fr-FR/fr-FR-opac-bootstrap.po
    - opac-tmpl/bootstrap/en/includes/biblio-title-head.inc
    - opac-tmpl/bootstrap/en/includes/holds-table.inc line 129 & 141

- Edit the "msgstr" string however you want (it's just for testing).
- Remove the "fuzzy, " text if it's there.
- Install the updated translation:

  > perl mis/translator/translate install fr-FR

- Switch to your translated language in the OPAC.
- Confirm that the strings you translated show up correctly on these
  pages:
  - The page title when viewing a bibliographic record detail page for
    a record without a title.
  - On a user summary page, under the hold tab:
    - A hold that is waiting
    - A hold that is in transit
- In Administration -> Identity providers define a new identity provider
  (it doesn't have to be functional).
  - In the OPAC, test that the "Log in with [identity provider]" link is
    correct in each of the three login forms:
    - The modal triggered from the link in the header
    - The form in the right-hand sidebar
    - The form you see if you navigate directly to a user-related page
      e.g. /cgi-bin/koha/opac-user.pl
- The changes to date-format.inc are only visible if JS is turned off
  because Flatpickr hides the format hint when it loads.

Sponsored-by: Athens County Public Libraries
Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
Owen Leonard 2025-08-15 16:18:46 +00:00 committed by Pedro Amorim
parent f7941aee28
commit ea62f3b835
No known key found for this signature in database
GPG Key ID: 06B75BA7F3894D55
7 changed files with 24 additions and 11 deletions

View File

@ -1,7 +1,8 @@
[% PROCESS 'i18n.inc' %]
[% IF ( biblio.title ) %]
[% biblio.title | html %]
[% ELSE %]
No title
[% t("No title") | html %]
[% END %]
[%~ SET subtitles = biblio.subtitle.split(' \| ') ~%]
[%~ FOREACH subtitle IN subtitles ~%]

View File

@ -2,7 +2,7 @@
[%- IF ( link ) -%]
<a href="[%- PROCESS biblio_a_href biblionumber => biblio.biblionumber -%]" class="title">[% PROCESS 'show-biblio-title' %]</a>
[%- ELSIF (deleted) -%]
<span class="deleted-biblio">(Deleted bibliographic record) [%- PROCESS 'show-biblio-title' -%]</span>
<span class="deleted-biblio"> [% t("(Deleted bibliographic record)") | html %] [%- PROCESS 'show-biblio-title' -%] </span>
[%- ELSE -%]
[%- PROCESS 'show-biblio-title' -%]
[%- END -%]

View File

@ -1 +1,11 @@
<span class="dateformat">[% IF ( dateformat == "us" ) %](MM/DD/YYYY)[% ELSIF ( dateformat == "metric" ) %](DD/MM/YYYY)[% ELSE %](YYYY-MM-DD)[% END %]</span>
[% FILTER collapse %]
<span class="dateformat">
[% IF ( dateformat == "us" ) %]
[% t("(MM/DD/YYYY)") | html %]
[% ELSIF ( dateformat == "metric" ) %]
[% t("(DD/MM/YYYY)") | html %]
[% ELSE %]
[% t("(YYYY-MM-DD)") | html %]
[% END %]
</span>
[% END %]

View File

@ -97,7 +97,7 @@
[% IF ( HOLD.expirationdate ) %]
[% HOLD.expirationdate | $KohaDates %]
[% ELSE %]
Never expires
<span>Never expires</span>
[% END %]
[% ELSE %]
-
@ -152,17 +152,19 @@
[% IF ( HOLD.is_waiting ) %]
<i class="fa fa-exclamation-circle text-warning" aria-hidden="true"></i>
[% IF ( HOLD.is_at_destination ) %]
Item waiting at <strong> [% HOLD.branch.branchname | html %]</strong>
<span>Item waiting at <strong> [% HOLD.branch.branchname | html %]</strong></span>
[% IF ( HOLD.desk_id ) %], [% HOLD.desk.desk_name | html %],[% END %]
[% IF ( HOLD.waitingdate ) %]
since [% HOLD.waitingdate | $KohaDates %]
[% tp("On hold since [waiting date]", "since") | html %]
[% HOLD.waitingdate | $KohaDates %]
[% IF HOLD.expirationdate %]
until [% HOLD.expirationdate | $KohaDates %]
[% tp("On hold until [expiration date]", "until") | html %]
[% HOLD.expirationdate | $KohaDates %]
[% END %]
[% END %]
<input type="hidden" name="pickup" value="[% HOLD.branchcode | html %]" />
[% ELSE %]
Item in transit to <strong> [% Branches.GetName( HOLD.branchcode ) | html %]</strong> <input type="hidden" name="pickup" value="[% HOLD.branchcode | html %]" />
<span>Item in transit to</span> <strong> [% Branches.GetName( HOLD.branchcode ) | html %]</strong> <input type="hidden" name="pickup" value="[% HOLD.branchcode | html %]" />
[% END %]
[% ELSE %]
[% IF ( HOLD.is_in_transit ) %]

View File

@ -495,7 +495,7 @@
[% ELSE %]
<i class="fa fa-user" aria-hidden="true"></i>
[% END %]
Log in with [% provider.description | html %]
[% tx("Log in with {identity_provider}", { identity_provider = provider.description } ) | html %]
</a>
</p>
[% END %]

View File

@ -182,7 +182,7 @@
[% ELSE %]
<i class="fa fa-user" aria-hidden="true"></i>
[% END %]
Log in with [% provider.description | html %]
[% tx("Log in with {identity_provider}", { identity_provider = provider.description } ) | html %]
</a>
</p>
[% END %]

View File

@ -189,7 +189,7 @@
[% ELSE %]
<i class="fa fa-user" aria-hidden="true"></i>
[% END %]
Log in with [% provider.description | html %]
[% tx("Log in with {identity_provider}", { identity_provider = provider.description } ) | html %]
</a>
</p>
[% END %]