Translate status name in body message notice

Locked
ULiX
Znuny newbie
Posts: 16
Joined: 07 Jul 2010, 23:04
Znuny Version: 2.4.7

Translate status name in body message notice

Post by ULiX »

At present name of status in notice are displayed on english only.
This patch translate status name ( open, closed successful, closed unsuccessful, pending auto close+ etc.) on customers language or default language.

This patch translates not only statusname (<OTRS_TICKET_State>) but also all parameters of the tickets (<OTRS_TICKET_*>).


Diff

Code: Select all

--- /opt/Paths/ORIGIN/NotificationEvent.pm      2010-02-06 09:42:17.000000000 +1000
+++ /opt/otrs/Kernel/System/Ticket/Event/NotificationEvent.pm   2010-06-29 14:21:19.000000000 +1100
@@ -356,6 +356,16 @@
     my %Article = $Self->{TicketObject}->ArticleLastCustomerArticle(
         TicketID => $Param{TicketID},
     );
+    use Kernel::Language;
+    if ( !$Self->{LanguageObject} ) {
+        $Self->{LanguageObject} = Kernel::Language->new(
+           MainObject => $Self->{MainObject},
+           ConfigObject => $Self->{ConfigObject},
+           LogObject => $Self->{LogObject},
+           EncodeObject => $Self->{MainObject}->{EncodeObject},
+           UserLanguage => $Recipient{Language},
+       );
+    }
 
     # get notify texts
     for (qw(Subject Body)) {
@@ -384,8 +394,9 @@
     my %Ticket = $Self->{TicketObject}->TicketGet( TicketID => $Param{TicketID} );
     for ( keys %Ticket ) {
         next if !defined $Ticket{$_};
-        $Notification{Body}    =~ s/<OTRS_TICKET_$_>/$Ticket{$_}/gi;
-        $Notification{Subject} =~ s/<OTRS_TICKET_$_>/$Ticket{$_}/gi;
+        my $xyzzy= $Self->{LanguageObject}->Get($Ticket{$_});
+        $Notification{Body}    =~ s/<OTRS_TICKET_$_>/$xyzzy/gi;
+        $Notification{Subject} =~ s/<OTRS_TICKET_$_>/$xyzzy/gi;
     }
 
     # cleanup
You do not have the required permissions to view the files attached to this post.
Locked