Item1751: Escaping the ' sign in all the .po language files wherever escaping is needed
Priority: Normal
Current State: Confirmed
Released In: n/a
Target Release: n/a
Applies To: Engine
Component: I18N,
MAKETEXT
Branches: master
Further to
Tasks.Item1725, and
KennethLavrsen suggestion, I am correcting all the ' signs in the .po language files to be escaped.
The files where escaping is needed are:
- da.po
- fi.po
- it.po
- nl.po
- no.po
- pl.po
- pt-br.po
- pt.po
- sv.po
- uk.po
in addition to fr.po (already corrected in Revision: 4189)
The following strategy is applied for escaping:
- ' is escaped wherever the translated string includes a ' whereas the original string does not
- when the original string in English language includes a ', the translation is left unaltered, and I assume that, as the original English version does not escape it, escaping is not needed in the translation either.
--
RaulFRodriguez - 17 Jun 2009
Done in Revision 4193.
--
RaulFRodriguez - 17 Jun 2009
The changes need to be reverted, since now most of the strings appear with visible "\'".
I am checking-out Revision 4192, and restoring the files in their original state. The file fr.po has also been reverted in Revision 4194.
The changes need to be done on a case by case basis.
Escaping shall only be done whenever the presence of a ' effectively results in a truncated string. That can't be determined based on the translation files only. One needs to look at all the code where
MAKETEXT is used to find the instances where a ' in the translated string would truncate the string. I am afraid I do not know, at the moment, of a way to automate finding the problematic code in the whole project likely to use
MAKETEXT in this manner.
Some of strings I escaped in Revision 4193 based on the strategy described above may effectively need to be escaped. But one can only be sure by looking at the code for these strings, or actually seeing that the unescaped string results in a truncated text.
--
RaulFRodriguez - 17 Jun 2009
Kenneth, I guess I did not understand properly what you were saying.
Whether or not escaping the ' is needed cannot be decided unless the code is inspected very carefully or you can actually see a problem in a displayed string (see my attempts
Item1750 and
Item1751, which I had to revert).
You wrote:
If the MAKETEXT is inside a 'something' the French words with ' screw up the strings.
I do not see single quotes around the
MAKETEXT in the portion that was causing problem in
Item1725. The thing I see is that the
MAKETEXT string causing a problem with ' is preceded by
%%
instead of
%
. Would that be a valid way to identify the possible strings where a ' should not appear unescaped?
%TMPL:DEF{"UNRECOGNISED_USER"}%%MAKETEXT{"Oops: we could not recognize you. Try again or [[[_1]][reset your password]]."
args="%SYSTEMWEB%.ResetPassword"}%%TMPL:END%
I ran a search through all the plugins and core, and there are 235 lines containing
%%MAKETEXT
.
--
RaulFRodriguez - 18 Jun 2009
It would be nice if we could make the .po files capable of working with ' unescaped.
It is not reasonable to expect translators to be able to get this right when they bulk translate. You cannot manually check all strings. It takes too long.
--
KennethLavrsen - 14 Sep 2009
We tried a fix to encode single-quote as ' in the
MAKETEXT macro return, however the
viewtopicactionbuttons.tmpl
gets broken because it enters HTML directly into the translated string, so escaping of single quotes then breaks the translated HTML. This is probably done so that the accesskey can be handled within the context of the label.
--
Main.GeorgeClark - 07 Apr 2015 - 15:55