[Koha-patches] [PATCH] Bug 11505 - Untranslatable table headers in Label batch manager

Owen Leonard oleonard at myacpl.org
Fri Jan 10 22:03:49 CET 2014


The label batch manager script hard-codes the table header cell labels
in order to pass them to an HTML-building function. This obviously isn't
the best solution for internationalization, but picking the whole scheme
apart would be very complicated.

Instead this patch uses a SWITCH statement to check for each possible
case and outputs the correct translatable string for each.

To test, apply the patch and run "perl translate update" for any
translation. Check the revised po file and confirm that the new strings
are present. View the label batch edit page and confirm that the table
headings look correct: Tools -> Labels -> Manage batches -> Edit batch.
---
 .../prog/en/modules/labels/label-edit-batch.tt     |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt
index bde821a..54ff3bd 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-batch.tt
@@ -197,7 +197,20 @@
                                         [% IF ( table_loo.header_fields ) %]
                                         <tr>
                                         [% FOREACH header_field IN table_loo.header_fields %]
-                                            <th>[% header_field.field_label %]</th>
+                                            [% SWITCH header_field.field_label -%]
+                                                [% CASE "Label Number" -%]
+                                                    <th>Label number</th>
+                                                [% CASE "Summary" -%]
+                                                    <th>Summary</th>
+                                                [% CASE "Item Type" %]
+                                                    <th>Item type</th>
+                                                [% CASE "Barcode" %]
+                                                    <th>Barcode</th>
+                                                [% CASE "Select" -%]
+                                                    <th>Select</th>
+                                                [% CASE %]
+                                                    <th>[% header_field.field_label %]</th>
+                                            [% END -%]
                                         [% END %]
                                         </tr>
                                         [% ELSE %]
-- 
1.7.9.5


More information about the Koha-patches mailing list