From: Sven Schöling Date: Thu, 10 Jan 2013 15:32:35 +0000 (+0100) Subject: SL::Locale::String kann jetzt auch Parameter X-Git-Tag: release-3.1.0beta1~754 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=be889f53d0d876d80c4a35a0bdcdada61ebc500c;p=kivitendo-erp.git SL::Locale::String kann jetzt auch Parameter t8('The is no cake, at least with id #1', 42) --- 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;