<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=iso-8859-1"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:DengXian;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"\@DengXian";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-AU link="#0563C1" vlink="#954F72" style='word-wrap:break-word'><div class=WordSection1><p class=MsoNormal>Hi all,<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>While I mostly work in English, I occasionally do support libraries in other languages like French, Arabic, and Chinese. And more recently I’ve been looking at the Languages dropdown in the OPAC advanced search.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>In the templates, I notice that we often translate HTML, but what if we translated strings for a Template::Toolkit data structure instead? <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Consider the following:<o:p></o:p></p><p class=MsoNormal>[% BLOCK en %]Anglais[% END %]<o:p></o:p></p><p class=MsoNormal>[% BLOCK fr %]Français[% END %]<o:p></o:p></p><p class=MsoNormal>[% langs.en = INCLUDE en %]<o:p></o:p></p><p class=MsoNormal>[% langs.fr = INCLUDE fr %]<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I suppose it’s not very beautiful, but the translation process should be simple and in the end we have a re-usable hash map rather than static HTML. <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>As I commented on Bug 12017 (<a href="https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12017">https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12017</a>), we could have a database table of language codes with native language names, and then iterate through that and use the hash map of translations to provide the translations. Since we’re not producing HTML, we could flexibly reuse this language data in various different contexts. Whether it’s the Languages dropdown in the OPAC advanced search, the language selector, or whatever. <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>We could probably use this concept in other places as well where we need translations but we don’t want to be bound to HTML. <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>What do people think? I’m not wedded to the idea, but it’s something that crossed my mind this morning, when I looked at the large switch statements at <a href="https://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=12017&attachment=40285">https://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=12017&attachment=40285</a>. <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>(To that end, I would also suggest a theme-independent Template::Toolkit include directory, but that’s another story…)<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>David Cook<o:p></o:p></p><p class=MsoNormal>Software Engineer<o:p></o:p></p><p class=MsoNormal>Prosentient Systems<o:p></o:p></p><p class=MsoNormal>Suite 7.03<o:p></o:p></p><p class=MsoNormal>6a Glen St<o:p></o:p></p><p class=MsoNormal>Milsons Point NSW 2061<o:p></o:p></p><p class=MsoNormal>Australia<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Office: 02 9212 0899<o:p></o:p></p><p class=MsoNormal>Online: 02 8005 0595<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>