[Home]WikiPatches/EmailLang

UseModWiki | WikiPatches | RecentChanges | Preferences

Patch Description

The e-mail text sent when a page is changed is sent English only, so if you use a non-English site this message is like an encrypted message for the wiki suscribers, and surely you'll receive a lot of complains about this.

Not anymore. This patch solves this problem, allowing the message to be sent in the same language as the wiki itself !!

Patch code

--- wiki.pl	2006-07-30 19:11:14.000000000 -0300
+++ wiki.emailLang.pl	2006-07-31 00:00:41.000000000 -0300
@@ -4112,7 +4112,7 @@
   }
 }
 
-# Translation note: the email messages are still sent in English
+
 # Send an email message.
 sub SendEmail {
   my ($to, $from, $reply, $subject, $message) = @_;
@@ -4138,9 +4138,7 @@
 
   if ($EmailNotify) {
     my ($id, $user) = @_;
-    if ($user) {
-      $user = " by $user";
-    }
+    my $content;
     my $address;
     return  if (!-f $EmailFile);  # No notifications yet
     open(EMAIL, $EmailFile)
@@ -4155,22 +4153,24 @@
       $editors_summary = "";
     }
     else {
-      $editors_summary = "\n Summary: $editors_summary";
-    }
-    my $content = <<"END_MAIL_CONTENT";
+      $editors_summary = "\n ". Ts('Summary: %s',$editors_summary );
+    };
+    
+    if ($user) {
+        $content = Tss('The %1 page %2 at %3 has been changed by %4 to revision %5',
+                       $SiteName, $id, $page_url, $user,  $Page{revision} );
+    } else {
+        $content = Tss('The %1 page %2 at %3 has been changed to revision %4',
+                       $SiteName, $id, $page_url, $Page{revision} );
+    };
+
+    $content .= "$editors_summary\n"
+              . T('Replying to this notification will send email to the entire mailing list')
+              . "\n\n"
+              . Ts("To remove yourself from this list, visit %s",
+                    "${home_url}?action=editprefs" );
 
- The $SiteName page $id at
-   $page_url
- has been changed$user to revision $Page{revision}. $editors_summary
-
- (Replying to this notification will
-  send email to the entire mailing list,
-  so only do that if you mean to.
-
-  To remove yourself from this list, visit
-  ${home_url}?action=editprefs .)
-END_MAIL_CONTENT
-    my $subject = "The $id page at $SiteName has been changed.";
+    my $subject = Tss('The %1 page at %2 has been changed.', $id, $SiteName);
     # I'm setting the "reply-to" field to be the same as the "to:" field
     # which seems appropriate for a mailing list, especially since the
     # $EmailFrom string needn't be a real email address.

Additionally you'll need to add these strings to your language file (espanol.pl is my own) :


The %1 page %2 at %3 has been changed by %4 to revision %5
La pagina %2 del site %1 ubicada en %3 fue cambiada por %4 a la version nro. %5
The %1 page %2 at %3 has been changed to revision %4
La pagina %2 del site %1 ubicada en %3 fue cambiada a la version nro. %4
Replying to this notification will send email to the entire mailing list
Respondiendo a esta notificacion enviara un email a la lista
To remove yourself from this list, visit %s
Para desuscribirse de la lista visite %s
The %1 page at %2 has been changed.
La pagina %1 de %2 fue cambiada.
Summary: %s
Resumen: %s

They alternate the text in English and the text in the translated language (Spanish in this case).

Enjoy !!!

-- Bit-Man


UseModWiki | WikiPatches | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited July 31, 2006 3:37 am by Bit-Man (diff)
Search: