Index: README.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/simplenews/README.txt,v
retrieving revision 1.11.2.5
diff -u -p -r1.11.2.5 README.txt
--- README.txt	23 Jan 2010 17:09:08 -0000	1.11.2.5
+++ README.txt	24 Mar 2010 15:21:26 -0000
@@ -88,7 +88,15 @@ INSTALLATION
     Use 'per language terms' for mailing lists each with a different language.
     Newsletters of different language each have their own tag and own list of
     subscribers.
-    
+
+    To use multilingual confirmation you must use the String translation module.
+    Enter confirmation email title and body in ENGLISH at:
+      Administer > Site configuration > Simplenews > Subscription.
+    If required refresh the Simplenews text group at:
+      Administer > Site building > Translate interface > Refresh.
+    Enter translations of title and body text at:
+      Administer > Site building > Translate interface > Search.
+
     Path prefixes are added to footer message according to the subscribers
     preferred language.
 
Index: simplenews.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/simplenews/simplenews.module,v
retrieving revision 1.220.2.21
diff -u -p -r1.220.2.21 simplenews.module
--- simplenews.module	22 Feb 2010 21:33:47 -0000	1.220.2.21
+++ simplenews.module	24 Mar 2010 15:21:29 -0000
@@ -2425,6 +2425,17 @@ function simplenews_help($path, $arg) {
       }
       $help .= "</ul>";
       return $help;
+    case 'admin/settings/simplenews/subscription':
+      if (variable_get('language_count', 1) > 1) {
+	if (module_exists('i18nstrings')) {
+	  $help = '<p>'. t('This is a Multilingual website. Enter English text for confirmation subject and body.') ."</p>\n";
+	}
+	else {
+	  $help = '<p>'. t('This is a Multilingual website. <a href="@url">Enable the String translation module</a> to enable translation of the confirmation subject and body.', array('@url' => url('admin/build/modules'))) ."</p>\n";
+	}
+	return $help;
+      }
+      break;
     case 'admin/content/simplenews/types/add':
       $help = '<p>'. t('You can create different newsletters (or subjects) to categorize your news (e.g. Cats news, Dogs news, ...).') ."</p>\n";
       return $help;
@@ -2435,6 +2446,83 @@ function simplenews_help($path, $arg) {
 }
 
 /**
+ * Implementation of hook_locale().
+ */
+function simplenews_locale($op = 'groups', $group = NULL) {
+  switch ($op) {
+    case 'groups':
+      return array('simplenews' => t('Simplenews'));
+      break;
+    case 'info':
+      $info['simplenews']['refresh callback'] = 'simplenews_locale_refresh';
+      return $info;
+      break;
+  }
+}
+
+/**
+ * Refresh translatable strings.
+ *
+ * @see _simplenews_subscription_confirmation_text()
+ */
+function simplenews_locale_refresh() {
+$keys = array(
+    'subscribe_unsubscribed',
+    'subscribe_subscribed',
+    'unsubscribe_subscribed',
+    'unsubscribe_unsubscribed',
+    'subscribe_subject',
+    );
+  foreach ($keys as $key) {
+    i18nstrings_update('simplenews:'. $key, _simplenews_subscription_confirmation_text($key, NULL, TRUE));
+  }
+  return TRUE;
+}
+
+/**
+ * Generate default and custom subscription confirmation email text.
+ *
+ * @param string $key
+ *   Text identification key
+ * @param object $langcode
+ *   Language code
+ * @return
+ *   Invitation text. Optionally translated.
+ *
+ * @see simplenews_locale()
+ */
+function _simplenews_subscription_confirmation_text($key, $language = NULL, $refresh = FALSE) {
+  $langcode = isset($language) ? $language->language : NULL;
+  $langcode = 'nl';
+
+  $text = variable_get('simplenews_confirm_'. $key, FALSE);
+  // If administrator did not change the text, variable is empty.
+  // We get the default here.
+  if (!$text) {
+    switch ($key) {
+      case 'subscribe_unsubscribed':
+        $text = t("We have received a request from the email [simplenews-receiver-mail] for subscription to the [simplenews-newsletters-name] newsletter on [site-name] website at [site-url]. To confirm this subscription please use the link below.\n\n[simplenews-subscribe-url]", $langcode);
+      case 'subscribe_subscribed':
+        $text = t("We have received a request from the email [simplenews-receiver-mail] for subscription to the [simplenews-newsletters-name] newsletter on [site-name] website at [site-url]. However, this email is already subscribed to this newsletter. If you intended to unsubscribe please visit our site: [site-url]", $langcode);
+      case 'unsubscribe_subscribed':
+        $text = t("We have received a request from the email [simplenews-receiver-mail] to unsubscribe you from the [simplenews-newsletters-name] on [site-name] website at [site-url]. To confirm this unsubscription please use the  below.\n\n[simplenews-unsubscribe-url]", $langcode);
+      case 'unsubscribe_unsubscribed':
+        $text = t("We have received a from the email [simplenews-receiver-mail] request to unsubscribe you from the [simplenews-newsletters-name] on [site-name] website at [site-url]. However, this email is not subscribed to this newsletter. If you intended to subscribe please visit our site: [site-url]", $langcode);
+      case 'subscribe_subject':
+        $text = t("Confirmation for [simplenews-newsletters-name] from [site-name]", $langcode);
+    }
+  }
+
+  // If this is a multilingual website we translate the content using tt().
+  if (variable_get('language_count', 1) > 1 && function_exists('i18nstrings_translate_string') && !$refresh) {
+    // We don't use i18n_strings() here because it does not translate
+    // the source string when $langauge is equal to the current page language.
+    $text = i18nstrings_translate_string('simplenews:' . $key, $text, $langcode);
+  }
+  return $text;
+}
+
+/**
  * Helper function to translate a newsletter name if required.
  *
  * @param <object> $newsletter
@@ -2494,36 +2582,6 @@ function _simplenews_format_options() {
 }
 
 /**
- * Generate default and custom subscription confirmation email text.
- *
- * @param string $key text identification key
- * @param object $language language object
- */
-function _simplenews_subscription_confirmation_text($key, $language = NULL) {
-  $langcode = isset($language) ? $language->language : NULL;
-
-  if ($admin_setting = variable_get('simplenews_confirm_'. $key, FALSE)) {
-    // An admin setting overrides the default string.
-    return $admin_setting;
-  }
-  else {
-    // No override, return default string.
-    switch ($key) {
-      case 'subscribe_unsubscribed':
-        return t("We have received a request from the email [simplenews-receiver-mail] for subscription to the [simplenews-newsletters-name] newsletter on [site-name] website at [site-url]. To confirm this subscription please use the link below.\n\n[simplenews-subscribe-url]", $langcode);
-      case 'subscribe_subscribed':
-        return t("We have received a request from the email [simplenews-receiver-mail] for subscription to the [simplenews-newsletters-name] newsletter on [site-name] website at [site-url]. However, this email is already subscribed to this newsletter. If you intended to unsubscribe please visit our site: [site-url]", $langcode);
-      case 'unsubscribe_subscribed':
-        return t("We have received a request from the email [simplenews-receiver-mail] to unsubscribe you from the [simplenews-newsletters-name] on [site-name] website at [site-url]. To confirm this unsubscription please use the  below.\n\n[simplenews-unsubscribe-url]", $langcode);
-      case 'unsubscribe_unsubscribed':
-        return t("We have received a from the email [simplenews-receiver-mail] request to unsubscribe you from the [simplenews-newsletters-name] on [site-name] website at [site-url]. However, this email is not subscribed to this newsletter. If you intended to subscribe please visit our site: [site-url]", $langcode);
-      case 'subscribe_subject':
-        return t("Confirmation for [simplenews-newsletters-name] from [site-name]", $langcode);
-    }
-  }
-}
-
-/**
  * Helper function to measure PHP execution time in microseconds.
  *
  * @param bool $start TRUE reset the time and start counting.
