Bug 20085: Better translatability of smart-rules.tt
authorFridolin Somers <fridolin.somers@biblibre.com>
Wed, 24 Jan 2018 13:23:30 +0000 (14:23 +0100)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 26 Mar 2018 20:01:10 +0000 (17:01 -0300)
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>
koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt

index e1a5839..ffa8776 100644 (file)
                                                         </td>
 
                                                        <td>[% IF ( rule.unlimited_maxissueqty ) %]
-                                                                       Unlimited
+                                                                       <span>Unlimited</span>
                                                                [% ELSE %]
                                                                        [% rule.maxissueqty %]
                                                                [% END %]
                                                        </td>
                             <td>[% IF rule.unlimited_maxonsiteissueqty %]
-                                    Unlimited
+                                    <span>Unlimited</span>
                                 [% ELSE %]
                                     [% rule.maxonsiteissueqty %]
                                 [% END %]
                                   <input type="hidden" name="hardduedatecomparebackup" value="1" />
                                 [% END %]
                               [% ELSE %]
-                                None defined
+                                <span>None defined</span>
                               [% END %]
                             </td>
                                                        <td>[% rule.fine %]</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.overduefinescap FILTER format("%.2f") %]</td>
                             <td>
                             <td>[% rule.norenewalbefore %]</td>
                             <td>
                                 [% IF ( rule.auto_renew ) %]
-                                Yes
+                                    <span>Yes</span>
                                 [% ELSE %]
-                                No
+                                    <span>No</span>
                                 [% END %]
                             </td>
                             <td>[% rule.no_auto_renewal_after %]</td>
                                                         <td>[% rule.holds_per_record %]</td>
                                                         <td>
                                                             [% IF rule.onshelfholds == 1 %]
-                                                                Yes
+                                                                <span>Yes</span>
                                                             [% ELSIF rule.onshelfholds == 2 %]
-                                                                If all unavailable
+                                                                <span>If all unavailable</span>
+                                                            [% ELSE %]
+                                                                <span>If any unavailable</span>
+                                                            [% END %]
+                                                        </td>
+                                                        <td>
+                                                            [% IF rule.opacitemholds == 'F'%]
+                                                                <span>Force</span>
+                                                            [% ELSIF rule.opacitemholds == 'Y'%]
+                                                                <span>Allow</span>
                                                             [% ELSE %]
-                                                                If any unavailable
-                                                            [% END %]</td>
-                                                        <td>[% IF rule.opacitemholds == 'F'%]Force[% ELSIF rule.opacitemholds == 'Y'%]Allow[% ELSE %]Don't allow[% END %]</td>
+                                                                <span>Don't allow</span>
+                                                            [% END %]
+                                                        </td>
                                                         <td>
                                                             [% IF rule.article_requests == 'no' %]
-                                                                No
+                                                                <span>No</span>
                                                             [% ELSIF rule.article_requests == 'yes' %]
-                                                                Yes
+                                                                <span>Yes</span>
                                                             [% ELSIF rule.article_requests == 'bib_only' %]
-                                                                Record only
+                                                                <span>Record only</span>
                                                             [% ELSIF rule.article_requests == 'item_only' %]
-                                                                Item only
+                                                                <span>Item only</span>
                                                             [% END %]
                                                         </td>
                                                        <td>[% rule.rentaldiscount %]</td>
                             [% END %]
                         </td>
                         <td>[% IF ( branch_cat_rule_loo.unlimited_maxissueqty ) %]
-                                Unlimited
+                                <span>Unlimited</span>
                             [% ELSE %]
                                 [% branch_cat_rule_loo.maxissueqty %]
                             [% END %]
                         </td>
                         <td>[% IF ( branch_cat_rule_loo.unlimited_maxonsiteissueqty ) %]
-                                Unlimited
+                                <span>Unlimited</span>
                             [% ELSE %]
                                 [% branch_cat_rule_loo.maxonsiteissueqty %]
                             [% END %]
                             [% END %]
                         </td>
                         <td>[% IF ( branch_item_rule_loo.holdallowed_any ) %]
-                                From any library
+                                <span>From any library</span>
                             [% ELSIF ( branch_item_rule_loo.holdallowed_same ) %]
-                                From home library
+                                <span>From home library</span>
                             [% ELSE %]
-                                No holds allowed
+                                <span>No holds allowed</span>
                             [% END %]
                         </td>
                         <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' ) %]
-                                item's home library
+                                <span>item's home library</span>
                             [% ELSIF ( branch_item_rule_loo.hold_fulfillment_policy == 'holdingbranch' ) %]
-                                item's holding library
+                                <span>item's holding library</span>
                             [% END %]
                         </td>
                         <td>[% IF ( branch_item_rule_loo.returnbranch == 'homebranch' ) %]
-                                Item returns home
+                                <span>Item returns home</span>
                             [% 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' ) %]
-                                Item floats
+                                <span>Item floats</span>
                             [% ELSE %]
-                                Error - unknown option
+                                <span>Error - unknown option</span>
                             [% END %]
                         </td>
                         <td class="actions">