From bugzilla-daemon@bugs.koha-community.org Thu Feb 23 11:11:17 2017 From: bugzilla-daemon@bugs.koha-community.org To: koha-bugs@lists.koha-community.org Subject: [Koha-bugs] [Bug 18162] New: Don't translate JSON keys Date: Thu, 23 Feb 2017 10:11:08 +0000 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8288436377003884034==" --===============8288436377003884034== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=3D18162 Bug ID: 18162 Summary: Don't translate JSON keys Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Templates Assignee: oleonard@myacpl.org Reporter: magnus@libriotech.no QA Contact: testopia@bugs.koha-community.org Symptoms:=20 When Swedish or Norwegian was selected as the interface language in the staff client, patron searches that were only returning a single result would redire= ct to /cgi-bin/koha/members/moremember.pl?borrowernumber=3Dundefined, which of course gives the message "This patron does not exist. Find another patron?" Cause:=20 In koha-tmpl/intranet-tmpl/prog/en/modules/members/tables/members_results.tt = we have this:=20 34 "dt_action": 35 " Edit", 36 "borrowernumber": 37 "[% data.borrowernumber %]" 38 }[% UNLESS loop.last %],[% END %] borrowernumber here is meant to be a key in some JSON data, but it had been translated, which means the JS in koha-tmpl/intranet-tmpl/prog/nb-NO/modules/members/member.tt that redirects when there is only one result could not find the borrowernumnber:=20 196 // redirect if there is only 1 result. 197 if ( json.aaData.length =3D=3D 1 ) { 198 var borrowernumber =3D json.aaData[0].borrowernumber; 199 =20 document.location.href=3D"/cgi-bin/koha/members/moremember.pl?borrowernumber= =3D"+borrowernumber; 200 return false; 201 } In Pootle, the string that had been translated looks like this:=20 ", "borrowernumber": "%s" }%s,%s %s ] } %s %s %s%s%s %s%s%s %s%s%s %s %s=20 Quick fix:=20 Find the relevant string in *-staff-prog.po and untranslate it.=20 Permanent fix:=20 Is there some way to mark a string so it does not get picked up for translation?=20 If not, perhaps it would make sense to rename borrowernumber here to something that is more obviously not meant to be translated? Why are the other keys in the JSON prefixed with dt_? Is there some special magic to it, or could we do the same for borrowernumber?=20 Thanks to oha on #koha for nudging me in the right direction to figure this out. --=20 You are receiving this mail because: You are watching all bug changes. --===============8288436377003884034==-- From bugzilla-daemon@bugs.koha-community.org Thu Feb 23 11:48:38 2017 From: bugzilla-daemon@bugs.koha-community.org To: koha-bugs@lists.koha-community.org Subject: [Koha-bugs] [Bug 18162] Don't translate JSON keys Date: Thu, 23 Feb 2017 10:48:34 +0000 Message-ID: In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6965056407764288577==" --===============6965056407764288577== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=3D18162 Julian Maurice changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |julian.maurice@biblibre.com --- Comment #1 from Julian Maurice --- > Is there some way to mark a string so it does not get picked up for transla= tion?=20 In my opinion, it would be better to do the opposite: mark the strings that have to be translated, that would avoid the "%s" hell we have in some strings like this one and more generally that would prevent the translation to break things. But to be practical, I think the right way to do it is to not return any html in this JSON. The rendering code can be put in DataTables configuration (mRender property). For an example usage of mRender, see bug 15219 --=20 You are receiving this mail because: You are watching all bug changes. --===============6965056407764288577==-- From bugzilla-daemon@bugs.koha-community.org Thu Feb 23 11:50:52 2017 From: bugzilla-daemon@bugs.koha-community.org To: koha-bugs@lists.koha-community.org Subject: [Koha-bugs] [Bug 18162] Don't translate JSON keys Date: Thu, 23 Feb 2017 10:50:49 +0000 Message-ID: In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8547631136700146874==" --===============8547631136700146874== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18162 --- Comment #2 from Magnus Enger --- (In reply to Julian Maurice from comment #1) > But to be practical, I think the right way to do it is to not return any > html in this JSON. Not sure I see how this would stop the string "borrowernumber" from being translated? -- You are receiving this mail because: You are watching all bug changes. --===============8547631136700146874==-- From bugzilla-daemon@bugs.koha-community.org Thu Feb 23 11:56:20 2017 From: bugzilla-daemon@bugs.koha-community.org To: koha-bugs@lists.koha-community.org Subject: [Koha-bugs] [Bug 18162] Don't translate JSON keys Date: Thu, 23 Feb 2017 10:56:08 +0000 Message-ID: In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============9196746485329852529==" --===============9196746485329852529== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18162 --- Comment #3 from Julian Maurice --- (In reply to Magnus Enger from comment #2) > (In reply to Julian Maurice from comment #1) > > But to be practical, I think the right way to do it is to not return any > > html in this JSON. > > Not sure I see how this would stop the string "borrowernumber" from being > translated? Sorry for not being clear I was just about to write another comment to explain it better :) By "not returning any html in this JSON" I also meant that we should not use Template::Toolkit to generate JSON. This way, its content won't go into PO files. -- You are receiving this mail because: You are watching all bug changes. --===============9196746485329852529==-- From bugzilla-daemon@bugs.koha-community.org Thu Feb 23 13:20:42 2017 From: bugzilla-daemon@bugs.koha-community.org To: koha-bugs@lists.koha-community.org Subject: [Koha-bugs] [Bug 18162] Don't translate JSON keys Date: Thu, 23 Feb 2017 12:20:32 +0000 Message-ID: In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6465840047662075624==" --===============6465840047662075624== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18162 --- Comment #4 from Magnus Enger --- (In reply to Julian Maurice from comment #3) > By "not returning any html in this JSON" I also meant that we should not use > Template::Toolkit to generate JSON. This way, its content won't go into PO > files. Yeah, that makes sense! -- You are receiving this mail because: You are watching all bug changes. --===============6465840047662075624==-- From bugzilla-daemon@bugs.koha-community.org Thu Feb 23 16:51:50 2017 From: bugzilla-daemon@bugs.koha-community.org To: koha-bugs@lists.koha-community.org Subject: [Koha-bugs] [Bug 18162] Don't translate JSON keys Date: Thu, 23 Feb 2017 15:51:46 +0000 Message-ID: In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5195240563920895459==" --===============5195240563920895459== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=3D18162 Jonathan Druart changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@bugs.koha-c | |ommunity.org --- Comment #5 from Jonathan Druart = --- (In reply to Julian Maurice from comment #3) > By "not returning any html in this JSON" I also meant that we should not use > Template::Toolkit to generate JSON. This way, its content won't go into PO > files. The problem we have is that we want some strings to be translated, things like "Edit", "Delete", "Email", etc. --=20 You are receiving this mail because: You are watching all bug changes. --===============5195240563920895459==-- From bugzilla-daemon@bugs.koha-community.org Thu Feb 23 17:20:39 2017 From: bugzilla-daemon@bugs.koha-community.org To: koha-bugs@lists.koha-community.org Subject: [Koha-bugs] [Bug 18162] Don't translate JSON keys Date: Thu, 23 Feb 2017 16:20:34 +0000 Message-ID: In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7999057202401511893==" --===============7999057202401511893== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=3D18162 --- Comment #6 from Julian Maurice --- (In reply to Jonathan Druart from comment #5) > (In reply to Julian Maurice from comment #3) > > By "not returning any html in this JSON" I also meant that we should not = use > > Template::Toolkit to generate JSON. This way, its content won't go into PO > > files. >=20 > The problem we have is that we want some strings to be translated, things > like "Edit", "Delete", "Email", etc. You can do that in the template that make the DataTables call (using the mRender property) --=20 You are receiving this mail because: You are watching all bug changes. --===============7999057202401511893==-- From bugzilla-daemon@bugs.koha-community.org Thu May 4 16:07:30 2017 From: bugzilla-daemon@bugs.koha-community.org To: koha-bugs@lists.koha-community.org Subject: [Koha-bugs] [Bug 18162] Don't translate JSON keys Date: Thu, 04 May 2017 14:07:26 +0000 Message-ID: In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6513664769391137528==" --===============6513664769391137528== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18162 Owen Leonard changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|oleonard@myacpl.org |koha-bugs@lists.koha-commun | |ity.org CC| |frederic@tamil.fr Component|Templates |I18N/L10N -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes. --===============6513664769391137528==--