"Octavian Rasnita" <[EMAIL PROTECTED]> writes:

> Unfortunately it doesn't work that way neither.
> 
> It gives the error:
> 
> Usage: Wx::GetTranslation(string)

Strange.

However, if 't' (I use '_T') works, __x is a no-brainer:

  # Variable expansion. See GNU gettext for details.
  sub __expand($%) {
      my ($t, %args) = @_;
      my $re = join('|', map { quotemeta($_) } keys(%args));
      $t =~ s/\{($re)\}/defined($args{$1}) ? $args{$1} : "{$1}"/ge;
      $t;
  }

  # Translation w/ variables.
  sub __x($@) {
      my ($t, %vars) = @_;
      __expand(_T($t), %vars);
  }

-- Johan

Reply via email to