[Koha-bugs] [Bug 8942] Translation process breaks javascript in calendar.inc
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Thu Nov 29 10:10:52 CET 2012
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8942
--- Comment #16 from Fridolyn SOMERS <fridolyn.somers at biblibre.com> ---
After reflexion, I think it is no good idea to have an automatic quote escape.
For example, if you have a single quote in a double quote string (or opposite)
:
_("Aujourd'hui") will become _("Aujourd\'hui"), the backslash will be
displayed.
Also, like Marcel example, there might be problems with HTML added in JS.
For example :
$("#id").html("<span title=\"" + _("Dangerous") + "\" />")
will generate
<span title="Dangerous" />
In this case, the translation must not contain a double quotes, even escaped:
$("#id").html("<span title=\"" + _("\"Danger\"") + "\" />")
will generate
<span title=""Danger"" />, bad HTML.
I've looked at http://wiki.koha-community.org/wiki/Coding_Guidelines.
In JavaScript section, double quotes are always used : _("xxx").
Looking at code, double quotes are used 2629 time and single quotes only 143
times.
So if we always use double quotes, single quotes are not a problem anymore and
it was the main problem (it is often used in French).
I've looked at French PO, double quotes are actually never used in JavaScript
translation ; it can be managed one by one.
I've looked at old version of calendar, it used double quotes, that's why there
was no problem with Today => Aujourd'hui.
I will propose a patch for that.
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list