From 054633019b5bf3df798cc31a82dc2c8608a72316 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Tue, 5 May 2015 10:32:18 +0200 Subject: [PATCH] =?utf8?q?Locale:=20eq-overload=20f=C3=BCr=20t8=20Objekte?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Locale/String.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/SL/Locale/String.pm b/SL/Locale/String.pm index e05ae6abe..63a53231b 100644 --- a/SL/Locale/String.pm +++ b/SL/Locale/String.pm @@ -11,7 +11,9 @@ use Rose::Object::MakeMethods::Generic ( our @EXPORT = qw(t8); -use overload '""' => \&translated; +use overload + '""' => \&translated, + eq => \&my_eq; sub translated { my ($self) = @_; @@ -25,6 +27,10 @@ sub t8 { return SL::Locale::String->new(untranslated => $string, args => [ @_ ]); } +sub my_eq { + $_[1] eq $_[0]->translated; +} + sub TO_JSON { return $_[0]->translated; } -- 2.20.1