<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body>A new request with request id 18555 has been created by koha-devel-request@lists.koha-community.org. Short info on the request is : <br><br>Title : Koha-devel Digest, Vol 185, Issue 32<br>Category : <br>Description : <div>Send Koha-devel mailing list submissions to<br>    koha-devel@lists.koha-community.org<br><br>To subscribe or unsubscribe via the World Wide Web, visit<br>    https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel<br>or, via email, send a message with subject or body 'help' to<br>    koha-devel-request@lists.koha-community.org<br><br>You can reach the person managing the list at<br>    koha-devel-owner@lists.koha-community.org<br><br>When replying, please edit your Subject line so it is more specific<br>than "Re: Contents of Koha-devel digest..."<br><br><br>Today's Topics:<br><br>   1. Re: Template::Toolkit and Translations (dcook@prosentient.com.au)<br><br><br>----------------------------------------------------------------------<br><br>Message: 1<br>Date: Wed, 28 Apr 2021 15:51:44 +1000<br>From: <dcook@prosentient.com.au><br>To: "'Julian Maurice'" <julian.maurice@biblibre.com>,<br>    <koha-devel@lists.koha-community.org><br>Subject: Re: [Koha-devel] Template::Toolkit and Translations<br>Message-ID: <045f01d73bf2$92075f00$b6161d00$@prosentient.com.au><br>Content-Type: text/plain;    charset="utf-8"<br><br>I think I'll leave the internationalization to folk who can remember it better than me.<br><br>As for lists... the key thing is supplying the full ISO 639-2 (or MARC Code List for Languages) to Koha, since that's what is being used to populate the bibliographic records.<br><br>David Cook<br>Software Engineer<br>Prosentient Systems<br>Suite 7.03<br>6a Glen St<br>Milsons Point NSW 2061<br>Australia<br><br>Office: 02 9212 0899<br>Online: 02 8005 0595<br><br>-----Original Message-----<br>From: Julian Maurice <julian.maurice@biblibre.com> <br>Sent: Tuesday, 27 April 2021 5:44 PM<br>To: dcook@prosentient.com.au; koha-devel@lists.koha-community.org<br>Subject: Re: [Koha-devel] Template::Toolkit and Translations<br><br>About the different translation functions, here's a tip: just remember "__npx" where each letter is an optional flag n for Numbers (plural forms) p for Particular context x for eXtra variables<br><br>And in templates, where functions starting with '_' are considered private, the '__' prefix was replaced by 't' (but maybe we should use the 't' form everywhere to remove confusion ?)<br><br>Also you can refer to<br>https://git.koha-community.org/Koha-community/Koha/src/branch/master/docs/development/internationalization.md<br><br>About database VS hardcoded list, what about a hardcoded but extensible list ?<br>For instance you'd have the full ISO-639-* lists hardcoded in Perl, but it would be extensible, either by adding entries to the database, or by plugins.<br><br>Le 27/04/2021 à 01:44, dcook@prosentient.com.au a écrit :<br>> Hi Julian,<br>> <br>> I like part of what you've suggested here. I still think that putting languages (with codes and name in native text) in the database is a good idea, as it allows the ability to add languages to Koha without a code change. Unless Koha is going to be perfectly comprehensive with languages, I think that libraries need to be able to add their own languages to the database.<br>> <br>> But I'd be fine with putting the translations of languages into Perl rather than Template::Toolkit.<br>> <br>> I've found the barrier to entry for Koha translations to be too high, so I can't keep track of all the different _(), __(), _t(), etc functions across the different file types, but if your suggestion for Koha::Languages works using that __() syntax, then I'm fine with it.<br>> <br>> David Cook<br>> Software Engineer<br>> Prosentient Systems<br>> Suite 7.03<br>> 6a Glen St<br>> Milsons Point NSW 2061<br>> Australia<br>> <br>> Office: 02 9212 0899<br>> Online: 02 8005 0595<br>> <br>> -----Original Message-----<br>> From: Koha-devel <koha-devel-bounces@lists.koha-community.org> On <br>> Behalf Of Julian Maurice<br>> Sent: Monday, 26 April 2021 8:17 PM<br>> To: koha-devel@lists.koha-community.org<br>> Subject: Re: [Koha-devel] Template::Toolkit and Translations<br>> <br>> Hi David,<br>> <br>> I think that language descriptions would be best in a Perl module, so that they can be used everywhere (perl and templates).<br>> <br>> For instance:<br>> <br>> package Koha::Languages;<br>> use Koha::I18N;<br>> sub getLanguages {<br>>       return {<br>>           en => __('English'),<br>>           fr => __('French'),<br>>       }<br>> }<br>> <br>> And if the original description is needed, we can do the same but without the __() translation.<br>> <br>> sub getLanguagesDescriptionsInTheirOwnLanguage {<br>>       return {<br>>           en => 'English',<br>>           fr => 'Français',<br>>       }<br>> }<br>> <br>> Le 26/04/2021 à 02:44, dcook@prosentient.com.au a écrit :<br>>> Hi all,<br>>><br>>> While I mostly work in English, I occasionally do support libraries <br>>> in other languages like French, Arabic, and Chinese. And more <br>>> recently I’ve been looking at the Languages dropdown in the OPAC advanced search.<br>>><br>>> In the templates, I notice that we often translate HTML, but what if <br>>> we translated strings for a Template::Toolkit data structure instead?<br>>><br>>> Consider the following:<br>>><br>>> [% BLOCK en %]Anglais[% END %]<br>>><br>>> [% BLOCK fr %]Français[% END %]<br>>><br>>> [% langs.en = INCLUDE en %]<br>>><br>>> [% langs.fr = INCLUDE fr %]<br>>><br>>> I suppose it’s not very beautiful, but the translation process should <br>>> be simple and in the end we have a re-usable hash map rather than static HTML.<br>>><br>>> As I commented on Bug 12017<br>>> (https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12017<br>>> <https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12017>), <br>>> we could have a database table of language codes with native language <br>>> names, and then iterate through that and use the hash map of <br>>> translations to provide the translations. Since we’re not producing <br>>> HTML, we could flexibly reuse this language data in various different <br>>> contexts. Whether it’s the Languages dropdown in the OPAC advanced <br>>> search, the language selector, or whatever.<br>>><br>>> We could probably use this concept in other places as well where we <br>>> need translations but we don’t want to be bound to HTML.<br>>><br>>> What do people think? I’m not wedded to the idea, but it’s something <br>>> that crossed my mind this morning, when I looked at the large switch <br>>> statements at <br>>> https://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&b<br>>> u<br>>> g=12017&attachment=40285<br>>> <https://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=12017&attachment=40285>.<br>>><br>>><br>>> (To that end, I would also suggest a theme-independent <br>>> Template::Toolkit include directory, but that’s another story…)<br>>><br>>> David Cook<br>>><br>>> Software Engineer<br>>><br>>> Prosentient Systems<br>>><br>>> Suite 7.03<br>>><br>>> 6a Glen St<br>>><br>>> Milsons Point NSW 2061<br>>><br>>> Australia<br>>><br>>> Office: 02 9212 0899<br>>><br>>> Online: 02 8005 0595<br>>><br>>><br>>> _______________________________________________<br>>> Koha-devel mailing list<br>>> Koha-devel@lists.koha-community.org<br>>> https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel<br>>> website : https://www.koha-community.org/ git :<br>>> https://git.koha-community.org/ bugs :<br>>> https://bugs.koha-community.org/<br>>><br>> <br>> --<br>> Julian Maurice<br>> BibLibre<br>> _______________________________________________<br>> Koha-devel mailing list<br>> Koha-devel@lists.koha-community.org<br>> https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel<br>> website : https://www.koha-community.org/ git : <br>> https://git.koha-community.org/ bugs : <br>> https://bugs.koha-community.org/<br>> <br>> <br><br>--<br>Julian Maurice<br>BibLibre<br><br><br><br><br>------------------------------<br><br>Subject: Digest Footer<br><br>_______________________________________________<br>Koha-devel mailing list<br>Koha-devel@lists.koha-community.org<br>https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel<br>website : https://www.koha-community.org/<br>git : https://git.koha-community.org/<br>bugs : https://bugs.koha-community.org/<br><br><br>------------------------------<br><br>End of Koha-devel Digest, Vol 185, Issue 32<br>*******************************************<br></div><br><br>NOTE: You are receiving this mail because, the Requester/Technician wanted you to get notified on this request creation.<br></body></html>