>From 282afb461d6ef0e0e2279154539d2fcb78d50898 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Gon=C3=A9ri=20Le=20Bouder?= <goneri.lebouder@atosorigin.com>
Date: Wed, 19 Nov 2008 13:05:13 +0100
Subject: [PATCH] Translate OTRS_TICKET_* in mail notification

---
 Kernel/System/Ticket/Article.pm |   31 +++++++++++++++++++++++++++----
 1 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/Kernel/System/Ticket/Article.pm b/Kernel/System/Ticket/Article.pm
index d862a1a..d0569e5 100644
--- a/Kernel/System/Ticket/Article.pm
+++ b/Kernel/System/Ticket/Article.pm
@@ -18,6 +18,7 @@ use MIME::Words qw(:all);
 use MIME::Entity;
 use Mail::Internet;
 use Kernel::System::StdAttachment;
+use Kernel::Language;
 
 use vars qw($VERSION);
 $VERSION = qw($Revision: 1.188 $) [1];
@@ -2079,6 +2080,16 @@ sub SendAgentNotification {
 
     # get current user data
     my %CurrentUser = $Self->{UserObject}->GetUserData( UserID => $Param{UserID} );
+
+    my $LanguageObject = Kernel::Language->new(
+        UserTimeZone => $Self->{UserTimeZone},
+        UserLanguage => $CurrentUser{UserLanguage},
+        LogObject    => $Self->{LogObject},
+        ConfigObject => $Self->{ConfigObject},
+        MainObject   => $Self->{MainObject},
+        Action       => $Self->{Action},
+    );
+
     for ( keys %CurrentUser ) {
         if ( $CurrentUser{$_} ) {
             $Notification{Body}    =~ s/<OTRS_CURRENT_$_>/$CurrentUser{$_}/gi;
@@ -2102,8 +2113,9 @@ sub SendAgentNotification {
     my %Ticket = $Self->TicketGet( TicketID => $Param{TicketID} );
     for ( keys %Ticket ) {
         if ( defined $Ticket{$_} ) {
-            $Notification{Body}    =~ s/<OTRS_TICKET_$_>/$Ticket{$_}/gi;
-            $Notification{Subject} =~ s/<OTRS_TICKET_$_>/$Ticket{$_}/gi;
+            my $TranslatedStrg = $LanguageObject->Get($Ticket{$_});
+            $Notification{Body}    =~ s/<OTRS_TICKET_$_>/$TranslatedStrg/gi;
+            $Notification{Subject} =~ s/<OTRS_TICKET_$_>/$TranslatedStrg/gi;
         }
     }
 
@@ -2316,6 +2328,16 @@ sub SendCustomerNotification {
         }
     }
 
+    my $LanguageObject = Kernel::Language->new(
+        UserTimeZone => $Self->{UserTimeZone},
+        UserLanguage => $Language,
+        LogObject    => $Self->{LogObject},
+        ConfigObject => $Self->{ConfigObject},
+        MainObject   => $Self->{MainObject},
+        Action       => $Self->{Action},
+    );
+
+
     # check recipients
     if ( !$Article{From} || $Article{From} !~ /@/ ) {
         return;
@@ -2368,8 +2390,9 @@ sub SendCustomerNotification {
     my %Ticket = $Self->TicketGet( TicketID => $Param{TicketID} );
     for ( keys %Ticket ) {
         if ( defined $Ticket{$_} ) {
-            $Notification{Body}    =~ s/<OTRS_TICKET_$_>/$Ticket{$_}/gi;
-            $Notification{Subject} =~ s/<OTRS_TICKET_$_>/$Ticket{$_}/gi;
+            my $TranslatedStrg = $LanguageObject->Get($Ticket{$_});
+            $Notification{Body}    =~ s/<OTRS_TICKET_$_>/$TranslatedStrg/gi;
+            $Notification{Subject} =~ s/<OTRS_TICKET_$_>/$TranslatedStrg/gi;
         }
     }
 
-- 
1.5.6.5

