From be889f53d0d876d80c4a35a0bdcdada61ebc500c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Thu, 10 Jan 2013 16:32:35 +0100 Subject: [PATCH] SL::Locale::String kann jetzt auch Parameter t8('The is no cake, at least with id #1', 42) --- SL/Locale/String.pm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/SL/Locale/String.pm b/SL/Locale/String.pm index 42ceb22a6..7afcaa451 100644 --- a/SL/Locale/String.pm +++ b/SL/Locale/String.pm @@ -6,6 +6,7 @@ use parent qw(Rose::Object Exporter); use Rose::Object::MakeMethods::Generic ( scalar => [ qw(untranslated) ], + array => [ qw(args) ], ); our @EXPORT = qw(t8); @@ -14,12 +15,14 @@ use overload '""' => \&translated; sub translated { my ($self) = @_; - return $::locale ? $::locale->text($self->untranslated) : $self->untranslated; + return $::locale ? $::locale->text($self->untranslated, $self->args) : $self->untranslated; } sub t8 { - my $string = $_[ ref($_[0]) || ($_[0] eq 'SL::Locale::String') ? 1 : 0 ]; - return SL::Locale::String->new(untranslated => $string); + shift if $_[0] eq __PACKAGE__; + + my $string = shift; + return SL::Locale::String->new(untranslated => $string, args => \@_); } 1; -- 2.20.1