Bug 20085: Better translatability of smart-rules.tt

Template smart-rules.tt in administration contains some if/elsif/else with translatable strings.
For example :
[% IF rule.onshelfholds == 1 %]
    Yes
[% ELSIF rule.onshelfholds == 2 %]
    If all unavailable
[% ELSE %]
    If any unavailable
[% END %]

Adding span to translatable strings will allow to have the same translation than :

<select name="onshelfholds" id="onshelfholds">
    <option value="1">Yes</option>
    <option value="0">If any unavailable</option>
    <option value="2">If all unavailable</option>
</select>

This is important to allow editing an existing circulation and fine rule.

Actually for example in french some strings are translated differently :
msgid "%s Yes %s If all unavailable %s If any unavailable %s"
msgstr "%s Oui %s Si tous indisponibles %s Si aucun indisponible %s"

msgid "If any unavailable"
msgstr "Si au moins un exemplaire est indisponible"

Test plan :
1) Look at PO files, for example fr-FR and see there is :
msgid "%s Yes %s If all unavailable %s If any unavailable %s"
msgid "If any unavailable"
2) Apply patch
3) update PO files
4) Look at PO files, for example fr-FR and see there is now only :
msgid "If any unavailable"
5) Install translation
6) Go to Administration > Circulation and fine rule
7) Check that when editing an existing rule, edition comboboxes are set on the correct value
8) Create a default holds policy by item type and check that correct values are displayed in table

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Fridolin Somers 2018-01-24 14:23:30 +01:00 committed by Jonathan Druart
parent 952b2242cf
commit f3dfd5226d

View file

@ -114,13 +114,13 @@
</td> </td>
<td>[% IF ( rule.unlimited_maxissueqty ) %] <td>[% IF ( rule.unlimited_maxissueqty ) %]
Unlimited <span>Unlimited</span>
[% ELSE %] [% ELSE %]
[% rule.maxissueqty %] [% rule.maxissueqty %]
[% END %] [% END %]
</td> </td>
<td>[% IF rule.unlimited_maxonsiteissueqty %] <td>[% IF rule.unlimited_maxonsiteissueqty %]
Unlimited <span>Unlimited</span>
[% ELSE %] [% ELSE %]
[% rule.maxonsiteissueqty %] [% rule.maxonsiteissueqty %]
[% END %] [% END %]
@ -142,12 +142,18 @@
<input type="hidden" name="hardduedatecomparebackup" value="1" /> <input type="hidden" name="hardduedatecomparebackup" value="1" />
[% END %] [% END %]
[% ELSE %] [% ELSE %]
None defined <span>None defined</span>
[% END %] [% END %]
</td> </td>
<td>[% rule.fine %]</td> <td>[% rule.fine %]</td>
<td>[% rule.chargeperiod %]</td> <td>[% rule.chargeperiod %]</td>
<td>[% IF rule.chargeperiod_charge_at %]Start of interval[% ELSE %]End of interval[% END %]</td> <td>
[% IF rule.chargeperiod_charge_at %]
<span>Start of interval</span>
[% ELSE %]
<span>End of interval</span>
[% END %]
</td>
<td>[% rule.firstremind %]</td> <td>[% rule.firstremind %]</td>
<td>[% rule.overduefinescap FILTER format("%.2f") %]</td> <td>[% rule.overduefinescap FILTER format("%.2f") %]</td>
<td> <td>
@ -164,9 +170,9 @@
<td>[% rule.norenewalbefore %]</td> <td>[% rule.norenewalbefore %]</td>
<td> <td>
[% IF ( rule.auto_renew ) %] [% IF ( rule.auto_renew ) %]
Yes <span>Yes</span>
[% ELSE %] [% ELSE %]
No <span>No</span>
[% END %] [% END %]
</td> </td>
<td>[% rule.no_auto_renewal_after %]</td> <td>[% rule.no_auto_renewal_after %]</td>
@ -175,22 +181,31 @@
<td>[% rule.holds_per_record %]</td> <td>[% rule.holds_per_record %]</td>
<td> <td>
[% IF rule.onshelfholds == 1 %] [% IF rule.onshelfholds == 1 %]
Yes <span>Yes</span>
[% ELSIF rule.onshelfholds == 2 %] [% ELSIF rule.onshelfholds == 2 %]
If all unavailable <span>If all unavailable</span>
[% ELSE %] [% ELSE %]
If any unavailable <span>If any unavailable</span>
[% END %]</td> [% END %]
<td>[% IF rule.opacitemholds == 'F'%]Force[% ELSIF rule.opacitemholds == 'Y'%]Allow[% ELSE %]Don't allow[% END %]</td> </td>
<td>
[% IF rule.opacitemholds == 'F'%]
<span>Force</span>
[% ELSIF rule.opacitemholds == 'Y'%]
<span>Allow</span>
[% ELSE %]
<span>Don't allow</span>
[% END %]
</td>
<td> <td>
[% IF rule.article_requests == 'no' %] [% IF rule.article_requests == 'no' %]
No <span>No</span>
[% ELSIF rule.article_requests == 'yes' %] [% ELSIF rule.article_requests == 'yes' %]
Yes <span>Yes</span>
[% ELSIF rule.article_requests == 'bib_only' %] [% ELSIF rule.article_requests == 'bib_only' %]
Record only <span>Record only</span>
[% ELSIF rule.article_requests == 'item_only' %] [% ELSIF rule.article_requests == 'item_only' %]
Item only <span>Item only</span>
[% END %] [% END %]
</td> </td>
<td>[% rule.rentaldiscount %]</td> <td>[% rule.rentaldiscount %]</td>
@ -479,13 +494,13 @@
[% END %] [% END %]
</td> </td>
<td>[% IF ( branch_cat_rule_loo.unlimited_maxissueqty ) %] <td>[% IF ( branch_cat_rule_loo.unlimited_maxissueqty ) %]
Unlimited <span>Unlimited</span>
[% ELSE %] [% ELSE %]
[% branch_cat_rule_loo.maxissueqty %] [% branch_cat_rule_loo.maxissueqty %]
[% END %] [% END %]
</td> </td>
<td>[% IF ( branch_cat_rule_loo.unlimited_maxonsiteissueqty ) %] <td>[% IF ( branch_cat_rule_loo.unlimited_maxonsiteissueqty ) %]
Unlimited <span>Unlimited</span>
[% ELSE %] [% ELSE %]
[% branch_cat_rule_loo.maxonsiteissueqty %] [% branch_cat_rule_loo.maxonsiteissueqty %]
[% END %] [% END %]
@ -635,29 +650,29 @@
[% END %] [% END %]
</td> </td>
<td>[% IF ( branch_item_rule_loo.holdallowed_any ) %] <td>[% IF ( branch_item_rule_loo.holdallowed_any ) %]
From any library <span>From any library</span>
[% ELSIF ( branch_item_rule_loo.holdallowed_same ) %] [% ELSIF ( branch_item_rule_loo.holdallowed_same ) %]
From home library <span>From home library</span>
[% ELSE %] [% ELSE %]
No holds allowed <span>No holds allowed</span>
[% END %] [% END %]
</td> </td>
<td>[% IF ( branch_item_rule_loo.hold_fulfillment_policy == 'any' ) %] <td>[% IF ( branch_item_rule_loo.hold_fulfillment_policy == 'any' ) %]
any library <span>any library</span>
[% ELSIF ( branch_item_rule_loo.hold_fulfillment_policy == 'homebranch' ) %] [% ELSIF ( branch_item_rule_loo.hold_fulfillment_policy == 'homebranch' ) %]
item's home library <span>item's home library</span>
[% ELSIF ( branch_item_rule_loo.hold_fulfillment_policy == 'holdingbranch' ) %] [% ELSIF ( branch_item_rule_loo.hold_fulfillment_policy == 'holdingbranch' ) %]
item's holding library <span>item's holding library</span>
[% END %] [% END %]
</td> </td>
<td>[% IF ( branch_item_rule_loo.returnbranch == 'homebranch' ) %] <td>[% IF ( branch_item_rule_loo.returnbranch == 'homebranch' ) %]
Item returns home <span>Item returns home</span>
[% ELSIF ( branch_item_rule_loo.returnbranch == 'holdingbranch' ) %] [% ELSIF ( branch_item_rule_loo.returnbranch == 'holdingbranch' ) %]
Item returns to issuing branch <span>Item returns to issuing branch</span>
[% ELSIF ( branch_item_rule_loo.returnbranch == 'noreturn' ) %] [% ELSIF ( branch_item_rule_loo.returnbranch == 'noreturn' ) %]
Item floats <span>Item floats</span>
[% ELSE %] [% ELSE %]
Error - unknown option <span>Error - unknown option</span>
[% END %] [% END %]
</td> </td>
<td class="actions"> <td class="actions">