Javascript escape char
Hie, It appears translating into fr-FR brakes Javascript in calendar.inc. Because (line 31) : currentText: _('Today'), is translated currentText: _('Aujourd'hui'), Additionnal quote brakes the Javascript. What should we do : translate with escape char ("Aujourd\\'hui" in PO) or should translation script handle it ? If same text is used in both Javascript and HTML, escape char can not be used. Best regards -- Fridolyn SOMERS Biblibre - Pôle Support fridolyn.somers@biblibre.com <mailto:fridolyn.somers@biblibre.com>
Hi Fridolyn, as an easy fix you could change the javascript to currentText: _(“Today”), But I think it would be a lot nicer if we could teach the translation scripts to use escape characters in the right places. In German we normally would use double quotes and not single quotes for quoting things in text, but at the moment I am always worried to break Javascript using them. Katrin From: koha-translate-bounces@lists.koha-community.org [mailto:koha-translate-bounces@lists.koha-community.org] On Behalf Of Fridolyn SOMERS Sent: Wednesday, October 17, 2012 1:08 PM To: koha-translate@lists.koha-community.org Subject: [Koha-translate] Javascript escape char Hie, It appears translating into fr-FR brakes Javascript in calendar.inc. Because (line 31) : currentText: _('Today'), is translated currentText: _('Aujourd'hui'), Additionnal quote brakes the Javascript. What should we do : translate with escape char ("Aujourd\\'hui" in PO) or should translation script handle it ? If same text is used in both Javascript and HTML, escape char can not be used. Best regards -- Fridolyn SOMERS Biblibre - Pôle Support fridolyn.somers@biblibre.com
Thinking of it, the best solution is to use ' instead of a quote : translate "Today" into "Aujourd'hui". It is good for both HTML and Javascript. What about it ? Le 17/10/2012 13:07, Fridolyn SOMERS a écrit :
Hie,
It appears translating into fr-FR brakes Javascript in calendar.inc. Because (line 31) : currentText: _('Today'), is translated currentText: _('Aujourd'hui'), Additionnal quote brakes the Javascript.
What should we do : translate with escape char ("Aujourd\\'hui" in PO) or should translation script handle it ? If same text is used in both Javascript and HTML, escape char can not be used.
Best regards
-- Fridolyn SOMERS Biblibre - Pôle Support fridolyn.somers@biblibre.com <mailto:fridolyn.somers@biblibre.com>
-- Fridolyn SOMERS Biblibre - Pôle Support fridolyn.somers@biblibre.com <mailto:fridolyn.somers@biblibre.com>
Thinking of it, the best solution is to use ' instead of a quote : translate "Today" into "Aujourd'hui". It is good for both HTML and Javascript.
Have you tried? Does it work? It also could be done automatically when installing translation files: translate install fr-FR Translated string could be modified on the fly, when translating JavaScript string. It would avoid asking translators to encode '
Le 17/10/2012 13:28, Frédéric Demians a écrit :
Thinking of it, the best solution is to use ' instead of a quote : translate "Today" into "Aujourd'hui". It is good for both HTML and Javascript. Have you tried? Does it work? It also could be done automatically when installing translation files:
translate install fr-FR
Translated string could be modified on the fly, when translating JavaScript string. It would avoid asking translators to encode ' I just applyed a correction of PO with ' for Rennes 2 University.
I think the best way is to use "'" because some other HTML espace sequences are already used ; like " " that can't be written an other way. It they validate the correction, may apply the changes to official POs ? -- Fridolyn SOMERS Biblibre - Pôle Support fridolyn.somers@biblibre.com <mailto:fridolyn.somers@biblibre.com>
Thank you Fridolyn! I confirm it works. M. Saby Rennes 2 University Fridolyn SOMERS a écrit :
Le 17/10/2012 13:28, Frédéric Demians a écrit :
Thinking of it, the best solution is to use ' instead of a quote : translate "Today" into "Aujourd'hui". It is good for both HTML and Javascript.
Have you tried? Does it work? It also could be done automatically when installing translation files:
translate install fr-FR
Translated string could be modified on the fly, when translating JavaScript string. It would avoid asking translators to encode '
I just applyed a correction of PO with ' for Rennes 2 University.
I think the best way is to use "'" because some other HTML espace sequences are already used ; like " " that can't be written an other way.
It they validate the correction, may apply the changes to official POs ?
-- Fridolyn SOMERS Biblibre - Pôle Support fridolyn.somers@biblibre.com <mailto:fridolyn.somers@biblibre.com> ------------------------------------------------------------------------
_______________________________________________ Koha-translate mailing list Koha-translate@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-translate website: www.koha-community.org git: git.koha-community.org bugs: bugs.koha-community.org
-- Mathieu Saby Service d'Informatique Documentaire Service Commun de Documentation Université Rennes 2 Téléphone : 02 99 14 12 65 Courriel : mathieu.saby@univ-rennes2.fr
Fridolyn or Mathieu, could you open a bug for that issue. It affects specifically JavaScript translated strings containing simple quote. We have several others of them: http://translate.koha-community.org/fr/38/translate.html?unit=3554039 ^ This one breaks the merging functionality in French. Thanks. -- Frédéric DEMIANS http://www.tamil.fr/u/fdemians.html
I think the best way is to use "'" because some other HTML espace sequences are already used ; like " " that can't be written an other way.
being currently used doesn't mean it's the best solution. " :" (space followed by colon) could be automatically with " :", as simple quote could be replaced with '. And what about double quote?
Hi, what is the reason for using ? I think the German po files are not using it and only remember seeing it in the French files so far. While I like an automated solution much better, I think we have to be careful with replacing strings. We might break some functionality where the translation scripts accidentally pick up program code. :( Katrin
-----Original Message----- From: koha-translate-bounces@lists.koha-community.org [mailto:koha- translate-bounces@lists.koha-community.org] On Behalf Of Frédéric Demians Sent: Wednesday, October 17, 2012 3:52 PM To: Fridolyn SOMERS Cc: koha-translate@lists.koha-community.org Subject: Re: [Koha-translate] Javascript escape char
I think the best way is to use "'" because some other HTML espace sequences are already used ; like " " that can't be written an other way.
being currently used doesn't mean it's the best solution.
" :" (space followed by colon) could be automatically with " :", as simple quote could be replaced with '. And what about double quote?
_______________________________________________ Koha-translate mailing list Koha-translate@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-translate website: www.koha-community.org git: git.koha-community.org bugs: bugs.koha-community.org
what is the reason for using ? I think the German po files are not using it and only remember seeing it in the French files so far.
It's here to enforce a French typography rule which states that a thin space must be placed before a colon. It we do so with a normal space (" : "), the browser word wrapping algorithm could reject the colon to the next line. So you can have: Author : rather than: Author : : guaranties that colon will stay glued to the previous word. And for the little story, we shouldn't use but If we can avoid to explain all that to translators, wouldn't be a good point?
While I like an automated solution much better, I think we have to be careful with replacing strings. We might break some functionality where the translation scripts accidentally pick up program code. :(
Yes, I agree. it would require testing. I need to take a look to the translation logic which is, as we know, a little bit obfuscated. Kind regards, -- Frédéric DEMIANS http://www.tamil.fr/u/fdemians.html
Hi Frederic, thanks a lot for explaining! I tried to figure out why it's needed, but I didn't think of the line breaks. Katrin
-----Original Message----- From: koha-translate-bounces@lists.koha-community.org [mailto:koha- translate-bounces@lists.koha-community.org] On Behalf Of Frédéric Demians Sent: Wednesday, October 17, 2012 4:17 PM To: koha-translate@lists.koha-community.org Subject: Re: [Koha-translate] Javascript escape char
what is the reason for using ? I think the German po files are not using it and only remember seeing it in the French files so far.
It's here to enforce a French typography rule which states that a thin space must be placed before a colon. It we do so with a normal space (" : "), the browser word wrapping algorithm could reject the colon to the next line. So you can have:
Author :
rather than:
Author :
: guaranties that colon will stay glued to the previous word.
And for the little story, we shouldn't use but
If we can avoid to explain all that to translators, wouldn't be a good point?
While I like an automated solution much better, I think we have to be careful with replacing strings. We might break some functionality where the translation scripts accidentally pick up program code. :(
Yes, I agree. it would require testing. I need to take a look to the translation logic which is, as we know, a little bit obfuscated.
Kind regards, -- Frédéric DEMIANS http://www.tamil.fr/u/fdemians.html
_______________________________________________ Koha-translate mailing list Koha-translate@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-translate website: www.koha-community.org git: git.koha-community.org bugs: bugs.koha-community.org
participants (5)
-
Fischer, Katrin -
Fridolyn SOMERS -
Frédéric Demians -
Frédéric Demians -
Mathieu Saby