[Koha-bugs] [Bug 18162] New: Don't translate JSON keys

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Feb 23 11:11:08 CET 2017


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18162

            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 at myacpl.org
          Reporter: magnus at libriotech.no
        QA Contact: testopia at bugs.koha-community.org

Symptoms: 

When Swedish or Norwegian was selected as the interface language in the staff
client, patron searches that were only returning a single result would redirect
to /cgi-bin/koha/members/moremember.pl?borrowernumber=undefined, which of
course gives the message "This patron does not exist. Find another patron?"

Cause: 

In koha-tmpl/intranet-tmpl/prog/en/modules/members/tables/members_results.tt we
have this: 

34                "dt_action":
35                    "<a
href='/cgi-bin/koha/members/memberentry.pl?op=modify&destination=circ&borrowernumber=[%
data.borrowernumber %]' class='btn btn-default btn-xs'><i class='fa
fa-pencil'></i> Edit</a>",
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: 

196        // redirect if there is only 1 result.
197        if ( json.aaData.length == 1 ) {
198            var borrowernumber = json.aaData[0].borrowernumber;
199           
document.location.href="/cgi-bin/koha/members/moremember.pl?borrowernumber="+borrowernumber;
200            return false;
201        }

In Pootle, the string that had been translated looks like this: 

", "borrowernumber": "%s" }%s,%s %s ] } %s %s %s%s%s %s%s%s %s%s%s %s %s 

Quick fix: 

Find the relevant string in *-staff-prog.po and untranslate it. 

Permanent fix: 

Is there some way to mark a string so it does not get picked up for
translation? 

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? 

Thanks to oha on #koha for nudging me in the right direction to figure this
out.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list