Replace $this->l10n->t() with $this->t() for Modules

This commit is contained in:
Philipp 2021-11-18 21:33:05 +01:00
parent 207662251d
commit dab9e13c69
No known key found for this signature in database
GPG key ID: 24A7501396EB5432
23 changed files with 246 additions and 226 deletions

View file

@ -61,7 +61,7 @@ class AppSpecific extends BaseSettings
}
if (!self::checkFormSecurityToken('settings_2fa_password', 't')) {
notice($this->l10n->t('Please enter your password to access this page.'));
notice($this->t('Please enter your password to access this page.'));
$this->baseUrl->redirect('settings/2fa');
}
}
@ -79,20 +79,20 @@ class AppSpecific extends BaseSettings
case 'generate':
$description = $_POST['description'] ?? '';
if (empty($description)) {
notice($this->l10n->t('App-specific password generation failed: The description is empty.'));
notice($this->t('App-specific password generation failed: The description is empty.'));
$this->baseUrl->redirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
} elseif (AppSpecificPassword::checkDuplicateForUser(local_user(), $description)) {
notice($this->l10n->t('App-specific password generation failed: This description already exists.'));
notice($this->t('App-specific password generation failed: This description already exists.'));
$this->baseUrl->redirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
} else {
$this->appSpecificPassword = AppSpecificPassword::generateForUser(local_user(), $_POST['description'] ?? '');
info($this->l10n->t('New app-specific password generated.'));
info($this->t('New app-specific password generated.'));
}
break;
case 'revoke_all' :
AppSpecificPassword::deleteAllForUser(local_user());
info($this->l10n->t('App-specific passwords successfully revoked.'));
info($this->t('App-specific passwords successfully revoked.'));
$this->baseUrl->redirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
break;
}
@ -102,7 +102,7 @@ class AppSpecific extends BaseSettings
self::checkFormSecurityTokenRedirectOnError('settings/2fa/app_specific', 'settings_2fa_app_specific');
if (AppSpecificPassword::deleteForUser(local_user(), $_POST['revoke_id'])) {
info($this->l10n->t('App-specific password successfully revoked.'));
info($this->t('App-specific password successfully revoked.'));
}
$this->baseUrl->redirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
@ -123,22 +123,22 @@ class AppSpecific extends BaseSettings
'$form_security_token' => self::getFormSecurityToken('settings_2fa_app_specific'),
'$password_security_token' => self::getFormSecurityToken('settings_2fa_password'),
'$title' => $this->l10n->t('Two-factor app-specific passwords'),
'$help_label' => $this->l10n->t('Help'),
'$message' => $this->l10n->t('<p>App-specific passwords are randomly generated passwords used instead your regular password to authenticate your account on third-party applications that don\'t support two-factor authentication.</p>'),
'$generated_message' => $this->l10n->t('Make sure to copy your new app-specific password now. You wont be able to see it again!'),
'$title' => $this->t('Two-factor app-specific passwords'),
'$help_label' => $this->t('Help'),
'$message' => $this->t('<p>App-specific passwords are randomly generated passwords used instead your regular password to authenticate your account on third-party applications that don\'t support two-factor authentication.</p>'),
'$generated_message' => $this->t('Make sure to copy your new app-specific password now. You wont be able to see it again!'),
'$generated_app_specific_password' => $this->appSpecificPassword,
'$description_label' => $this->l10n->t('Description'),
'$last_used_label' => $this->l10n->t('Last Used'),
'$revoke_label' => $this->l10n->t('Revoke'),
'$revoke_all_label' => $this->l10n->t('Revoke All'),
'$description_label' => $this->t('Description'),
'$last_used_label' => $this->t('Last Used'),
'$revoke_label' => $this->t('Revoke'),
'$revoke_all_label' => $this->t('Revoke All'),
'$app_specific_passwords' => $appSpecificPasswords,
'$generate_message' => $this->l10n->t('When you generate a new app-specific password, you must use it right away, it will be shown to you once after you generate it.'),
'$generate_title' => $this->l10n->t('Generate new app-specific password'),
'$description_placeholder_label' => $this->l10n->t('Friendiqa on my Fairphone 2...'),
'$generate_label' => $this->l10n->t('Generate'),
'$generate_message' => $this->t('When you generate a new app-specific password, you must use it right away, it will be shown to you once after you generate it.'),
'$generate_title' => $this->t('Generate new app-specific password'),
'$description_placeholder_label' => $this->t('Friendiqa on my Fairphone 2...'),
'$generate_label' => $this->t('Generate'),
]);
}
}

View file

@ -59,7 +59,7 @@ class Recovery extends BaseSettings
}
if (!self::checkFormSecurityToken('settings_2fa_password', 't')) {
notice($this->l10n->t('Please enter your password to access this page.'));
notice($this->t('Please enter your password to access this page.'));
$this->baseUrl->redirect('settings/2fa');
}
}
@ -75,7 +75,7 @@ class Recovery extends BaseSettings
if ($_POST['action'] == 'regenerate') {
RecoveryCode::regenerateForUser(local_user());
info($this->l10n->t('New recovery codes successfully generated.'));
info($this->t('New recovery codes successfully generated.'));
$this->baseUrl->redirect('settings/2fa/recovery?t=' . self::getFormSecurityToken('settings_2fa_password'));
}
}
@ -101,14 +101,14 @@ class Recovery extends BaseSettings
'$form_security_token' => self::getFormSecurityToken('settings_2fa_recovery'),
'$password_security_token' => self::getFormSecurityToken('settings_2fa_password'),
'$title' => $this->l10n->t('Two-factor recovery codes'),
'$help_label' => $this->l10n->t('Help'),
'$message' => $this->l10n->t('<p>Recovery codes can be used to access your account in the event you lose access to your device and cannot receive two-factor authentication codes.</p><p><strong>Put these in a safe spot!</strong> If you lose your device and dont have the recovery codes you will lose access to your account.</p>'),
'$title' => $this->t('Two-factor recovery codes'),
'$help_label' => $this->t('Help'),
'$message' => $this->t('<p>Recovery codes can be used to access your account in the event you lose access to your device and cannot receive two-factor authentication codes.</p><p><strong>Put these in a safe spot!</strong> If you lose your device and dont have the recovery codes you will lose access to your account.</p>'),
'$recovery_codes' => $recoveryCodes,
'$regenerate_message' => $this->l10n->t('When you generate new recovery codes, you must copy the new codes. Your old codes wont work anymore.'),
'$regenerate_label' => $this->l10n->t('Generate new recovery codes'),
'$regenerate_message' => $this->t('When you generate new recovery codes, you must copy the new codes. Your old codes wont work anymore.'),
'$regenerate_label' => $this->t('Generate new recovery codes'),
'$verified' => $verified,
'$verify_label' => $this->l10n->t('Next: Verification'),
'$verify_label' => $this->t('Next: Verification'),
]);
}
}

View file

@ -42,7 +42,7 @@ class Trusted extends BaseSettings
}
if (!self::checkFormSecurityToken('settings_2fa_password', 't')) {
notice($this->l10n->t('Please enter your password to access this page.'));
notice($this->t('Please enter your password to access this page.'));
$this->baseUrl->redirect('settings/2fa');
}
}
@ -59,7 +59,7 @@ class Trusted extends BaseSettings
switch ($_POST['action']) {
case 'remove_all' :
$this->trustedBrowserRepo->removeAllForUser(local_user());
info($this->l10n->t('Trusted browsers successfully removed.'));
info($this->t('Trusted browsers successfully removed.'));
$this->baseUrl->redirect('settings/2fa/trusted?t=' . self::getFormSecurityToken('settings_2fa_password'));
break;
}
@ -69,7 +69,7 @@ class Trusted extends BaseSettings
self::checkFormSecurityTokenRedirectOnError('settings/2fa/trusted', 'settings_2fa_trusted');
if ($this->trustedBrowserRepo->removeForUser(local_user(), $_POST['remove_id'])) {
info($this->l10n->t('Trusted browser successfully removed.'));
info($this->t('Trusted browser successfully removed.'));
}
$this->baseUrl->redirect('settings/2fa/trusted?t=' . self::getFormSecurityToken('settings_2fa_password'));
@ -106,15 +106,15 @@ class Trusted extends BaseSettings
'$form_security_token' => self::getFormSecurityToken('settings_2fa_trusted'),
'$password_security_token' => self::getFormSecurityToken('settings_2fa_password'),
'$title' => $this->l10n->t('Two-factor Trusted Browsers'),
'$message' => $this->l10n->t('Trusted browsers are individual browsers you chose to skip two-factor authentication to access Friendica. Please use this feature sparingly, as it can negate the benefit of two-factor authentication.'),
'$device_label' => $this->l10n->t('Device'),
'$os_label' => $this->l10n->t('OS'),
'$browser_label' => $this->l10n->t('Browser'),
'$created_label' => $this->l10n->t('Trusted'),
'$last_used_label' => $this->l10n->t('Last Use'),
'$remove_label' => $this->l10n->t('Remove'),
'$remove_all_label' => $this->l10n->t('Remove All'),
'$title' => $this->t('Two-factor Trusted Browsers'),
'$message' => $this->t('Trusted browsers are individual browsers you chose to skip two-factor authentication to access Friendica. Please use this feature sparingly, as it can negate the benefit of two-factor authentication.'),
'$device_label' => $this->t('Device'),
'$os_label' => $this->t('OS'),
'$browser_label' => $this->t('Browser'),
'$created_label' => $this->t('Trusted'),
'$last_used_label' => $this->t('Last Use'),
'$remove_label' => $this->t('Remove'),
'$remove_all_label' => $this->t('Remove All'),
'$trusted_browsers' => $trustedBrowserDisplay,
]);

View file

@ -65,7 +65,7 @@ class Verify extends BaseSettings
}
if (!self::checkFormSecurityToken('settings_2fa_password', 't')) {
notice($this->l10n->t('Please enter your password to access this page.'));
notice($this->t('Please enter your password to access this page.'));
$this->baseUrl->redirect('settings/2fa');
}
}
@ -87,11 +87,11 @@ class Verify extends BaseSettings
$this->pConfig->set(local_user(), '2fa', 'verified', true);
Session::set('2fa', true);
info($this->l10n->t('Two-factor authentication successfully activated.'));
info($this->t('Two-factor authentication successfully activated.'));
$this->baseUrl->redirect('settings/2fa');
} else {
notice($this->l10n->t('Invalid code, please retry.'));
notice($this->t('Invalid code, please retry.'));
}
}
}
@ -120,7 +120,7 @@ class Verify extends BaseSettings
$shortOtpauthUrl = explode('?', $otpauthUrl)[0];
$manual_message = $this->l10n->t('<p>Or you can submit the authentication settings manually:</p>
$manual_message = $this->t('<p>Or you can submit the authentication settings manually:</p>
<dl>
<dt>Issuer</dt>
<dd>%s</dd>
@ -140,18 +140,18 @@ class Verify extends BaseSettings
'$form_security_token' => self::getFormSecurityToken('settings_2fa_verify'),
'$password_security_token' => self::getFormSecurityToken('settings_2fa_password'),
'$title' => $this->l10n->t('Two-factor code verification'),
'$help_label' => $this->l10n->t('Help'),
'$message' => $this->l10n->t('<p>Please scan this QR Code with your authenticator app and submit the provided code.</p>'),
'$title' => $this->t('Two-factor code verification'),
'$help_label' => $this->t('Help'),
'$message' => $this->t('<p>Please scan this QR Code with your authenticator app and submit the provided code.</p>'),
'$qrcode_image' => $qrcode_image,
'$qrcode_url_message' => $this->l10n->t('<p>Or you can open the following URL in your mobile device:</p><p><a href="%s">%s</a></p>', $otpauthUrl, $shortOtpauthUrl),
'$qrcode_url_message' => $this->t('<p>Or you can open the following URL in your mobile device:</p><p><a href="%s">%s</a></p>', $otpauthUrl, $shortOtpauthUrl),
'$manual_message' => $manual_message,
'$company' => $company,
'$holder' => $holder,
'$secret' => $secret,
'$verify_code' => ['verify_code', $this->l10n->t('Please enter a code from your authentication app'), '', '', $this->l10n->t('Required'), 'autofocus autocomplete="off" placeholder="000000"'],
'$verify_label' => $this->l10n->t('Verify code and enable two-factor authentication'),
'$verify_code' => ['verify_code', $this->t('Please enter a code from your authentication app'), '', '', $this->t('Required'), 'autofocus autocomplete="off" placeholder="000000"'],
'$verify_label' => $this->t('Verify code and enable two-factor authentication'),
]);
}
}