Bug 41105: (QA follow-up) Fix gender label translation

The batch patron modification "Gender" column and edit dropdown
hardcoded "Female"/"Male"/"Other" as data passed from
tools/modborrowers.pl, and the "Other" gender label was displayed as
plain text.

Values coming from Perl as template data are never picked up by the
PO extractor, so the gender select options in the edit form could
never be translated. Elsewhere in Koha (moremember.tt,
moremember-brief.tt, memberentrygen.tt, opac-memberentry.tt) the
"Other" gender label is wrapped with tp('gender', 'Other') to give
translators context, since "Other" is ambiguous out of context.

This makes the "Gender" dropdown options translatable directly from
the template, and aligns "Other" with the existing tp('gender', ...)
convention used everywhere else gender is displayed.

Test plan:
1. Navigate to Patrons and click Search, to display a list of patrons.
2. Select all results and click "Batch patron modification".
3. Verify the "Gender" column and "Gender" edit dropdown still work as
   expected.
4. Confirm (e.g. via the .pot file or misc/translator/translate) that
   "Female", "Male" and the "Other" (gender) msgctxt string are now
   extracted for translation from this template.

Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
Martin Renvoize 2026-07-01 13:50:07 +01:00 committed by Pedro Amorim
parent 0bb26abd5a
commit b51a3f111a
No known key found for this signature in database
GPG Key ID: 06B75BA7F3894D55
1 changed files with 12 additions and 2 deletions

View File

@ -264,7 +264,7 @@
[% ELSIF borrower.sex == 'M' %]
Male
[% ELSIF borrower.sex == 'O' %]
Other
[% tp('gender', 'Other') | html %]
[% END %]
</td>
<td>[% Branches.GetName( borrower.branchcode ) | html %]</td>
@ -421,7 +421,17 @@
[% IF field.option.size %]
<select id="[% field.name | html %]" name="[% field.name | html %]">
[% FOREACH opt IN field.option %]
<option value="[% opt.value | html %]">[% opt.lib | html %]</option>
<option value="[% opt.value | html %]">
[% IF field.name == 'sex' && opt.value == 'F' %]
Female
[% ELSIF field.name == 'sex' && opt.value == 'M' %]
Male
[% ELSIF field.name == 'sex' && opt.value == 'O' %]
[% tp('gender', 'Other') | html %]
[% ELSE %]
[% opt.lib | html %]
[% END %]
</option>
[% END %]
</select>
[% ELSE %]