You are here: Foswiki>Tasks Web>Item1751 (07 Apr 2015, GeorgeClark)Edit Attach

Item1751: Escaping the ' sign in all the .po language files wherever escaping is needed

pencil
Priority: Normal
Current State: Confirmed
Released In: n/a
Target Release: n/a
Applies To: Engine
Component: I18N, MAKETEXT
Branches: master
Reported By: RaulFRodriguez
Waiting For:
Last Change By: GeorgeClark
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

 

ItemTemplate edit

Summary Escaping the ' sign in all the .po language files wherever escaping is needed
ReportedBy RaulFRodriguez
Codebase
SVN Range Foswiki-1.0.0, Thu, 08 Jan 2009, build 1878
AppliesTo Engine
Component I18N, MAKETEXT
Priority Normal
CurrentState Confirmed
WaitingFor
Checkins distro:9b3895487742 distro:2e39196d8c58 distro:e33fc12296cd distro:00da48c96976
TargetRelease n/a
ReleasedIn n/a
CheckinsOnBranches master
trunkCheckins
masterCheckins distro:e33fc12296cd distro:00da48c96976
ItemBranchCheckins
Release01x01Checkins
Topic revision: r10 - 07 Apr 2015, GeorgeClark - This page was cached on 24 Jan 2021 - 14:57.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy