Skip to content

Commit

Permalink
Item12285: Revert More robust fix for MAKETEXT"
Browse files Browse the repository at this point in the history
This partially  reverts commit ab2a49ccd943904e6e8960f15e5a9edee3d23375.

git-svn-id: http://svn.foswiki.org/branches/Release01x01@16241 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
GeorgeClark authored and GeorgeClark committed Dec 19, 2012
1 parent 17d997f commit 8d74266
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions core/lib/Foswiki/Macros/MAKETEXT.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ package Foswiki;
use strict;
use warnings;

my $TT1 = chr(1);
use Locale::Maketext;
my $escape =
( $Foswiki::cfg{UserInterfaceInternationalisation}
&& $Locale::Maketext::VERSION
&& $Locale::Maketext::VERSION < 1.23 );

sub MAKETEXT {
my ( $this, $params ) = @_;
Expand Down Expand Up @@ -33,8 +37,8 @@ s/~\[(\*,\_(\d+),[^,]+(,([^,]+))?)~\]/ _validate($1, $2, $max, $min, $param_erro
# get the args to be interpolated.
my $argsStr = $params->{args} || "";

# Remove any escapes.
$str =~ s#\\#<$TT1>#g;
# Escape any escapes.
$str =~ s#\\#\\\\#g if ($escape); # escape any escapes

my @args = split( /\s*,\s*/, $argsStr );

Expand All @@ -46,9 +50,6 @@ s/~\[(\*,\_(\d+),[^,]+(,([^,]+))?)~\]/ _validate($1, $2, $max, $min, $param_erro
# do the magic:
my $result = $this->i18n->maketext( $str, @args );

# Restore the escapes.
$result =~ s#<$TT1>#\\#g;

# replace accesskeys:
$result =~
s#(^|[^&])&([a-zA-Z])#$1<span class='foswikiAccessKey'>$2</span>#g;
Expand Down

0 comments on commit 8d74266

Please sign in to comment.