[Koha-bugs] [Bug 12138] New: Use placeholders in translatable javascript strings

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Apr 25 10:07:02 CEST 2014


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12138

            Bug ID: 12138
           Summary: Use placeholders in translatable javascript strings
 Change sponsored?: ---
           Product: Koha
           Version: master
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P5 - low
         Component: I18N/L10N
          Assignee: koha-bugs at lists.koha-community.org
          Reporter: pasi.kallinen at pttk.fi
        QA Contact: testopia at bugs.koha-community.org
                CC: frederic at tamil.fr

Created attachment 27580
  -->
http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=27580&action=edit
Use formatting for translatable javascript strings

Currently translating javascript strings with variables in them is hard,
because the strings are created from separate parts. For example:

 _("Are you sure you want to delete the") + " " + count + " " + _("attached
items?")

This is translated in two different parts, and the translator cannot affect the
place where the count-variable is.

Now, if the javascript strings allowed placeholders, similar to how the
template strings do, the above could be written as:

_("Are you sure you want to delete the %s attached items?").format(count)

This would make translation much easier.

Attached patch adds a javascript string formatter, and changes all the
concatenated translatable js strings used in intranet to use that.


To test:
1) cd misc/translator
2) perl translate update xx-YY
3) grep ^msgid po/xx-YY-i-staff-t-prog-v-3006000.po | sort | uniq > xx-YY-pre
4) apply patch
5) perl translate update xx-YY
6) grep ^msgid po/xx-YY-i-staff-t-prog-v-3006000.po | sort | uniq > xx-YY-post
7) compare the files: diff -Nurd xx-YY-pre xx-yy-post | less
   should show the javascript strings that changed.
8) Test the UIs where the formatted js strings are used.

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


More information about the Koha-bugs mailing list