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

            Bug ID: 38217
           Summary: TT tags breaking translation script when used to build
                    a JS string
 Change sponsored?: ---
           Product: Koha
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P5 - low
         Component: Templates
          Assignee: [email protected]
          Reporter: [email protected]
        QA Contact: [email protected]

Found on bug 38147.

We all know the "don't use TT tag in HTML tags" because they break the
translator script

There is another side-effect.

If you do:

  str = '<a foo="' + foo + '" bar="[% bar | uri %]"'>' + _("Click me") + '</a>'
; 

Then "Click me" won't be picked by the translator script

So I have tried this:
  str = '<a foo="%s" bar="%s">%s</a>'.format(foo, "[% bar | uri %]", _("Click
me"))

But it does not seems to work either.

So the solution I found is to use an intermediate JS variable:
  let bar = "[% bar | uri %]";
  str = '<a foo="%s" bar="%s">%s</a>'.format(foo, bar, _("Click me"))

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to