Revision 05463301
Von Sven Schöling vor mehr als 9 Jahren hinzugefügt
SL/Locale/String.pm | ||
---|---|---|
11 | 11 |
|
12 | 12 |
our @EXPORT = qw(t8); |
13 | 13 |
|
14 |
use overload '""' => \&translated; |
|
14 |
use overload |
|
15 |
'""' => \&translated, |
|
16 |
eq => \&my_eq; |
|
15 | 17 |
|
16 | 18 |
sub translated { |
17 | 19 |
my ($self) = @_; |
... | ... | |
25 | 27 |
return SL::Locale::String->new(untranslated => $string, args => [ @_ ]); |
26 | 28 |
} |
27 | 29 |
|
30 |
sub my_eq { |
|
31 |
$_[1] eq $_[0]->translated; |
|
32 |
} |
|
33 |
|
|
28 | 34 |
sub TO_JSON { |
29 | 35 |
return $_[0]->translated; |
30 | 36 |
} |
Auch abrufbar als: Unified diff
Locale: eq-overload für t8 Objekte