Hi
This mail contains a modification we made to make Koha template
translation a lot more easier.
Here is the idea :
We created a table in Koha named opac_text containing three field
- id : the identifier of the text
- lang : corresponding language
- label : the text to be used
Using the Label.pm, we use a gettexttemplate to get the label
corresponding to the requested id. This way, with only one .tmpl file,
unlimited languages are available without any changes in the .tmpl file.
To prove this trick is usable and not so hard to implement we've
attached 4 files : Label.pm, opac-detail.pl, opac-detail.tmpl and
opac_text.sql.
Here is how to test it :
1 - Create the table containing the labels :
mysql -u root -p < opac_text.sql
2 - Copy the Label.pm in the C4 module directory
3 - Copy opac-detail.pl to the opac/ cgi-bin directory
4 - Copy opac-detail.tmpl to the opac/htdocs/opac-tmpl/default/en
directory. Make a link to this file in the
opac/htdocs/opac-tmpl/default/fr so that no physical duplication is
needed. This way changing the opaclanguages preference will still use
the generic template.
Now try and search a book and click on one of the result to show the
details. If you're using either 'en' or 'fr' opaclanguages option.
Changing the preference will change the language in the display.
For sure, it requires a little more cpu to display the page but with a
PII 350 (our test machine) no noticable slow down was reported.
Using a system like the authorised value builder, creation of new
languages would be made easier.
We need some feedback on this please :)