Revision be889f53
Von Sven Schöling vor fast 12 Jahren hinzugefügt
SL/Locale/String.pm | ||
---|---|---|
6 | 6 |
|
7 | 7 |
use Rose::Object::MakeMethods::Generic ( |
8 | 8 |
scalar => [ qw(untranslated) ], |
9 |
array => [ qw(args) ], |
|
9 | 10 |
); |
10 | 11 |
|
11 | 12 |
our @EXPORT = qw(t8); |
... | ... | |
14 | 15 |
|
15 | 16 |
sub translated { |
16 | 17 |
my ($self) = @_; |
17 |
return $::locale ? $::locale->text($self->untranslated) : $self->untranslated; |
|
18 |
return $::locale ? $::locale->text($self->untranslated, $self->args) : $self->untranslated;
|
|
18 | 19 |
} |
19 | 20 |
|
20 | 21 |
sub t8 { |
21 |
my $string = $_[ ref($_[0]) || ($_[0] eq 'SL::Locale::String') ? 1 : 0 ]; |
|
22 |
return SL::Locale::String->new(untranslated => $string); |
|
22 |
shift if $_[0] eq __PACKAGE__; |
|
23 |
|
|
24 |
my $string = shift; |
|
25 |
return SL::Locale::String->new(untranslated => $string, args => \@_); |
|
23 | 26 |
} |
24 | 27 |
|
25 | 28 |
1; |
Auch abrufbar als: Unified diff
SL::Locale::String kann jetzt auch Parameter
t8('The is no cake, at least with id #1', 42)