Skip to content
Snippets Groups Projects

Issue #2880248 - Update t strings

2 files
+ 67
64
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 50
50
@@ -74,9 +74,9 @@ class SettingsForm extends ConfigFormBase {
$form['smtp_on'] = [
'#type' => 'checkbox',
'#title' => t('Activate PHPMailer to send e-mails'),
'#title' => $this->t('Activate PHPMailer to send e-mails'),
'#default_value' => $config->get('smtp_on'),
'#description' => t('When enabled, PHPMailer will be used to deliver all site e-mails.'),
'#description' => $this->t('When enabled, PHPMailer will be used to deliver all site e-mails.'),
];
/**
* @todo This part needs to be figured out.
@@ -86,118 +86,118 @@ class SettingsForm extends ConfigFormBase {
// if (\Drupal::moduleHandler()->moduleExists('mimemail') && variable_get('mimemail_alter', 0)) {
// $form['smtp_on']['#disabled'] = TRUE;
// $form['smtp_on']['#default_value'] = 0;
// $form['smtp_on']['#description'] = t('MimeMail has been detected. To enable PHPMailer for mail transport, go to the <a href="@url">MimeMail settings page</a> and select PHPMailer from the available e-mail engines.', ['@url' => url('admin/config/system/mimemail')]);
// $form['smtp_on']['#description'] = $this->t('MimeMail has been detected. To enable PHPMailer for mail transport, go to the <a href="@url">MimeMail settings page</a> and select PHPMailer from the available e-mail engines.', ['@url' => url('admin/config/system/mimemail')]);
// }
// elseif (!$config->get('smtp_on') && empty($form_state['input'])) {
if (!$config->get('smtp_on') && empty($form_state->input)) {
drupal_set_message(t('PHPMailer is currently disabled.'), 'warning');
drupal_set_message($this->t('PHPMailer is currently disabled.'), 'warning');
}
$form['server']['smtp_host'] = [
'#type' => 'textfield',
'#title' => t('Primary SMTP server'),
'#title' => $this->t('Primary SMTP server'),
'#default_value' => $config->get('smtp_host'),
'#description' => t('The host name or IP address of your primary SMTP server. Use %gmail-smtp for Google Mail.', ['%gmail-smtp' => 'smtp.gmail.com']),
'#description' => $this->t('The host name or IP address of your primary SMTP server. Use %gmail-smtp for Google Mail.', ['%gmail-smtp' => 'smtp.gmail.com']),
'#required' => TRUE,
];
$form['server']['smtp_hostbackup'] = [
'#type' => 'textfield',
'#title' => t('Backup SMTP server'),
'#title' => $this->t('Backup SMTP server'),
'#default_value' => $config->get('smtp_hostbackup'),
'#description' => t('Optional host name or IP address of a backup server, if the primary server fails. You may override the default port below by appending it to the host name separated by a colon. Example: %hostname', ['%hostname' => 'localhost:465']),
'#description' => $this->t('Optional host name or IP address of a backup server, if the primary server fails. You may override the default port below by appending it to the host name separated by a colon. Example: %hostname', ['%hostname' => 'localhost:465']),
];
$form['server']['smtp_port'] = [
'#type' => 'textfield',
'#title' => t('SMTP port'),
'#title' => $this->t('SMTP port'),
'#size' => 5,
'#maxlength' => 5,
'#default_value' => $config->get('smtp_port'),
'#description' => t('The standard SMTP port is 25. Secure connections (including Google Mail), typically use 465.'),
'#description' => $this->t('The standard SMTP port is 25. Secure connections (including Google Mail), typically use 465.'),
'#required' => TRUE,
];
$form['server']['smtp_protocol'] = [
'#type' => 'select',
'#title' => t('Use secure protocol'),
'#title' => $this->t('Use secure protocol'),
'#default_value' => $config->get('smtp_protocol'),
'#options' => ['' => t('No'), 'ssl' => t('SSL'), 'tls' => t('TLS')],
'#description' => t('Whether to use an encrypted connection to communicate with the SMTP server. Google Mail requires SSL.'),
'#options' => ['' => $this->t('No'), 'ssl' => $this->t('SSL'), 'tls' => $this->t('TLS')],
'#description' => $this->t('Whether to use an encrypted connection to communicate with the SMTP server. Google Mail requires SSL.'),
];
if (!function_exists('openssl_open')) {
$form['server']['smtp_protocol']['#default_value'] = '';
$form['server']['smtp_protocol']['#disabled'] = TRUE;
$form['server']['smtp_protocol']['#description'] .= ' ' . t('Note: This option has been disabled since your PHP installation does not seem to have support for OpenSSL.');
$form['server']['smtp_protocol']['#description'] .= ' ' . $this->t('Note: This option has been disabled since your PHP installation does not seem to have support for OpenSSL.');
$config->set('smtp_protocol', '')->save();
}
$form['auth'] = [
'#type' => 'details',
'#title' => t('SMTP authentication'),
'#description' => t('Leave both fields empty, if your SMTP server does not require authentication.'),
'#title' => $this->t('SMTP authentication'),
'#description' => $this->t('Leave both fields empty, if your SMTP server does not require authentication.'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
];
$form['auth']['smtp_username'] = [
'#type' => 'textfield',
'#title' => t('Username'),
'#title' => $this->t('Username'),
'#default_value' => $config->get('smtp_username'),
'#description' => t('For Google Mail, enter your username, including "@gmail.com".'),
'#description' => $this->t('For Google Mail, enter your username, including "@gmail.com".'),
];
if (!$config->get('smtp_hide_password')) {
$form['auth']['smtp_password'] = [
'#type' => 'textfield',
'#title' => t('Password'),
'#title' => $this->t('Password'),
'#default_value' => $config->get('smtp_password'),
];
$form['auth']['smtp_hide_password'] = [
'#type' => 'checkbox',
'#title' => t('Hide password'),
'#title' => $this->t('Hide password'),
'#default_value' => 0,
'#description' => t("Check this option to permanently hide the plaintext password from peeking eyes. You may still change the password afterwards, but it won't be displayed anymore."),
'#description' => $this->t("Check this option to permanently hide the plaintext password from peeking eyes. You may still change the password afterwards, but it won't be displayed anymore."),
];
}
else {
$have_password = ($config->get('smtp_password') != '');
$form['auth']['smtp_password'] = [
'#type' => 'password',
'#title' => $have_password ? t('Change password') : t('Password'),
'#description' => $have_password ? t('Leave empty, if you do not intend to change the current password.') : '',
'#title' => $have_password ? $this->t('Change password') : $this->t('Password'),
'#description' => $have_password ? $this->t('Leave empty, if you do not intend to change the current password.') : '',
];
}
$form['advanced'] = [
'#type' => 'details',
'#title' => t('Advanced SMTP settings'),
'#title' => $this->t('Advanced SMTP settings'),
];
$form['advanced']['smtp_fromname'] = [
'#type' => 'textfield',
'#title' => t('"From" name'),
'#title' => $this->t('"From" name'),
'#default_value' => $config->get('smtp_fromname'),
'#description' => t('Enter a name that should appear as the sender for all messages. If left blank the site name will be used instead: %sitename.', ['%sitename' => $config->get('site_name')]),
'#description' => $this->t('Enter a name that should appear as the sender for all messages. If left blank the site name will be used instead: %sitename.', ['%sitename' => $config->get('site_name')]),
];
$form['advanced']['smtp_always_replyto'] = [
'#type' => 'checkbox',
'#title' => t('Always set "Reply-To" address'),
'#title' => $this->t('Always set "Reply-To" address'),
'#default_value' => $config->get('smtp_always_replyto'),
'#description' => t('Enables setting the "Reply-To" address to the original sender of the message, if unset. This is required when using Google Mail, which would otherwise overwrite the original sender.'),
'#description' => $this->t('Enables setting the "Reply-To" address to the original sender of the message, if unset. This is required when using Google Mail, which would otherwise overwrite the original sender.'),
];
$form['advanced']['smtp_keepalive'] = [
'#type' => 'checkbox',
'#title' => t('Keep connection alive'),
'#title' => $this->t('Keep connection alive'),
'#default_value' => $config->get('smtp_keepalive'),
'#description' => t('Whether to reuse an existing connection during a request. Improves performance when sending a lot of e-mails at once.'),
'#description' => $this->t('Whether to reuse an existing connection during a request. Improves performance when sending a lot of e-mails at once.'),
];
$form['advanced']['smtp_debug'] = [
'#type' => 'select',
'#title' => t('Debug level'),
'#title' => $this->t('Debug level'),
'#default_value' => $config->get('smtp_debug'),
'#options' => [0 => t('Disabled'), 1 => t('Errors only'), 2 => t('Server responses'), 4 => t('Full communication')],
'#description' => t("Debug the communication with the SMTP server. You normally shouldn't enable this unless you're trying to debug e-mail sending problems."),
'#options' => [0 => $this->t('Disabled'), 1 => $this->t('Errors only'), 2 => $this->t('Server responses'), 4 => $this->t('Full communication')],
'#description' => $this->t("Debug the communication with the SMTP server. You normally shouldn't enable this unless you're trying to debug e-mail sending problems."),
];
$form['advanced']['smtp_debug_log'] = [
'#type' => 'checkbox',
'#title' => t("Record debugging output in Drupal's log"),
'#title' => $this->t("Record debugging output in Drupal's log"),
'#default_value' => $config->get('smtp_debug_log'),
'#description' => t("If this is checked, the debugging out put that is produced will also be recorded in Drupal's database log."),
'#description' => $this->t("If this is checked, the debugging out put that is produced will also be recorded in Drupal's database log."),
'#states' => [
'visible' => [
':input[name=smtp_debug]' => ['!value' => 0],
@@ -207,29 +207,29 @@ class SettingsForm extends ConfigFormBase {
$form['advanced']['ssl_settings'] = [
'#type' => 'fieldset',
'#title' => t('Advanced SSL settings'),
'#description' => t('If you are attempting to connect to a broken or misconfigured secure mail server, you can try toggling one or more of these options. <strong>If changing any of these options allows connection to the server, you should consider either fixing the SSL certificate, or using a different SMTP server, as the connection may be insecure.</strong>'),
'#title' => $this->t('Advanced SSL settings'),
'#description' => $this->t('If you are attempting to connect to a broken or misconfigured secure mail server, you can try toggling one or more of these options. <strong>If changing any of these options allows connection to the server, you should consider either fixing the SSL certificate, or using a different SMTP server, as the connection may be insecure.</strong>'),
];
$ssl_verify_peer = $config->get('smtp_ssl_verify_peer');
$form['advanced']['ssl_settings']['smtp_ssl_verify_peer'] = [
'#type' => 'checkbox',
'#title' => t('Verify peer'),
'#title' => $this->t('Verify peer'),
'#default_value' => isset($ssl_verify_peer) ? $ssl_verify_peer : 1,
'#description' => t('If this is checked, it will require verification of the SSL certificate being used on the mail server.'),
'#description' => $this->t('If this is checked, it will require verification of the SSL certificate being used on the mail server.'),
];
$ssl_verify_peer_name = $config->get('smtp_ssl_verify_peer_name');
$form['advanced']['ssl_settings']['smtp_ssl_verify_peer_name'] = [
'#type' => 'checkbox',
'#title' => t('Verify peer name'),
'#title' => $this->t('Verify peer name'),
'#default_value' => isset($ssl_verify_peer_name) ? $ssl_verify_peer_name : 1,
'#description' => t("If this is checked, it will require verification of the mail server's name in the SSL certificate."),
'#description' => $this->t("If this is checked, it will require verification of the mail server's name in the SSL certificate."),
];
$ssl_allow_self_signed = $config->get('smtp_ssl_allow_self_signed');
$form['advanced']['ssl_settings']['smtp_ssl_allow_self_signed'] = [
'#type' => 'checkbox',
'#title' => t('Allow self signed'),
'#title' => $this->t('Allow self signed'),
'#default_value' => isset($ssl_allow_self_signed) ? $ssl_allow_self_signed : 0,
'#description' => t('If this is checked, it will allow conecting to a mail server with a self-signed SSL certificate. (This requires "Verify peer" to be enabled.)'),
'#description' => $this->t('If this is checked, it will allow conecting to a mail server with a self-signed SSL certificate. (This requires "Verify peer" to be enabled.)'),
'#states' => [
'enabled' => [
':input[name="ssl_verify_peer"]' => ['checked' => TRUE],
@@ -239,13 +239,13 @@ class SettingsForm extends ConfigFormBase {
$form['test'] = [
'#type' => 'details',
'#title' => t('Test configuration'),
'#title' => $this->t('Test configuration'),
];
$form['test']['phpmailer_test'] = [
'#type' => 'textfield',
'#title' => t('Recipient'),
'#title' => $this->t('Recipient'),
'#default_value' => '',
'#description' => t('Type in an address to have a test e-mail sent there.'),
'#description' => $this->t('Type in an address to have a test e-mail sent there.'),
];
return parent::buildForm($form, $form_state);
@@ -282,7 +282,7 @@ class SettingsForm extends ConfigFormBase {
$mail_config->set('interface.default', $mail_system)->save();
}
drupal_set_message(t('PHPMailer will be used to deliver all site e-mails.'));
drupal_set_message($this->t('PHPMailer will be used to deliver all site e-mails.'));
\Drupal::logger('phpmailer')->notice('PHPMailer has been enabled.');
}
}
@@ -299,7 +299,7 @@ class SettingsForm extends ConfigFormBase {
$mail_config->set('interface.default', $mail_system)->save();
}
drupal_set_message(t('PHPMailer has been disabled.'));
drupal_set_message($this->t('PHPMailer has been disabled.'));
\Drupal::logger('phpmailer')->notice('PHPMailer has been disabled.');
}
@@ -349,8 +349,8 @@ class SettingsForm extends ConfigFormBase {
$ret_val = phpmailer_send($message);
}
$watchdog_url = Url::fromRoute('dblog.overview');
$watchdog_url = \Drupal::l(t('Check the logs'), $watchdog_url);
drupal_set_message(t('A test e-mail has been sent to %email. @watchdog-url for any error messages.', [
$watchdog_url = \Drupal::l($this->t('Check the logs'), $watchdog_url);
drupal_set_message($this->t('A test e-mail has been sent to %email. @watchdog-url for any error messages.', [
'%email' => $values['phpmailer_test'],
'@watchdog-url' => $watchdog_url,
]));
Loading