Move L10n::t() calls to DI::l10n()->t() calls

This commit is contained in:
nupplaPhil 2020-01-18 20:52:34 +01:00
parent af88c2daa3
commit 5dfee31108
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
175 changed files with 2841 additions and 2841 deletions

View file

@ -23,7 +23,7 @@ class Delegation extends BaseSettingsModule
public static function post(array $parameters = [])
{
if (!local_user() || !empty(DI::app()->user['uid']) && DI::app()->user['uid'] != local_user()) {
throw new HTTPException\ForbiddenException(L10n::t('Permission denied.'));
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
}
BaseModule::checkFormSecurityTokenRedirectOnError('settings/delegation', 'delegate');
@ -34,13 +34,13 @@ class Delegation extends BaseSettingsModule
if ($parent_uid != 0) {
try {
User::getIdFromPasswordAuthentication($parent_uid, $parent_password);
info(L10n::t('Delegation successfully granted.'));
info(DI::l10n()->t('Delegation successfully granted.'));
} catch (\Exception $ex) {
notice(L10n::t('Parent user not found, unavailable or password doesn\'t match.'));
notice(DI::l10n()->t('Parent user not found, unavailable or password doesn\'t match.'));
return;
}
} else {
info(L10n::t('Delegation successfully revoked.'));
info(DI::l10n()->t('Delegation successfully revoked.'));
}
DBA::update('user', ['parent-uid' => $parent_uid], ['uid' => local_user()]);
@ -51,7 +51,7 @@ class Delegation extends BaseSettingsModule
parent::content($parameters);
if (!local_user()) {
throw new HTTPException\ForbiddenException(L10n::t('Permission denied.'));
throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
}
$args = DI::args();
@ -62,7 +62,7 @@ class Delegation extends BaseSettingsModule
if ($action === 'add' && $user_id) {
if (Session::get('submanage')) {
notice(L10n::t('Delegated administrators can view but not change delegation permissions.'));
notice(DI::l10n()->t('Delegated administrators can view but not change delegation permissions.'));
DI::baseUrl()->redirect('settings/delegation');
}
@ -76,7 +76,7 @@ class Delegation extends BaseSettingsModule
DBA::insert('manage', ['uid' => $user_id, 'mid' => local_user()]);
}
} else {
notice(L10n::t('Delegate user not found.'));
notice(DI::l10n()->t('Delegate user not found.'));
}
DI::baseUrl()->redirect('settings/delegation');
@ -84,7 +84,7 @@ class Delegation extends BaseSettingsModule
if ($action === 'remove' && $user_id) {
if (Session::get('submanage')) {
notice(L10n::t('Delegated administrators can view but not change delegation permissions.'));
notice(DI::l10n()->t('Delegated administrators can view but not change delegation permissions.'));
DI::baseUrl()->redirect('settings/delegation');
}
@ -123,7 +123,7 @@ class Delegation extends BaseSettingsModule
$user = User::getById(local_user(), ['parent-uid', 'email']);
if (DBA::isResult($user) && !DBA::exists('user', ['parent-uid' => local_user()])) {
$parent_uid = $user['parent-uid'];
$parents = [0 => L10n::t('No parent user')];
$parents = [0 => DI::l10n()->t('No parent user')];
$fields = ['uid', 'username', 'nickname'];
$condition = ['email' => $user['email'], 'verified' => true, 'blocked' => false, 'parent-uid' => 0];
@ -135,33 +135,33 @@ class Delegation extends BaseSettingsModule
}
$parent_user = ['parent_user', '', $parent_uid, '', $parents];
$parent_password = ['parent_password', L10n::t('Parent Password:'), '', L10n::t('Please enter the password of the parent account to legitimize your request.')];
$parent_password = ['parent_password', DI::l10n()->t('Parent Password:'), '', DI::l10n()->t('Please enter the password of the parent account to legitimize your request.')];
}
$is_child_user = !empty($user['parent-uid']);
$o = Renderer::replaceMacros(Renderer::getMarkupTemplate('settings/delegation.tpl'), [
'$form_security_token' => BaseModule::getFormSecurityToken('delegate'),
'$account_header' => L10n::t('Additional Accounts'),
'$account_desc' => L10n::t('Register additional accounts that are automatically connected to your existing account so you can manage it from this account.'),
'$add_account' => L10n::t('Register an additional account'),
'$parent_header' => L10n::t('Parent User'),
'$account_header' => DI::l10n()->t('Additional Accounts'),
'$account_desc' => DI::l10n()->t('Register additional accounts that are automatically connected to your existing account so you can manage it from this account.'),
'$add_account' => DI::l10n()->t('Register an additional account'),
'$parent_header' => DI::l10n()->t('Parent User'),
'$parent_user' => $parent_user,
'$parent_password' => $parent_password,
'$parent_desc' => L10n::t('Parent users have total control about this account, including the account settings. Please double check whom you give this access.'),
'$parent_desc' => DI::l10n()->t('Parent users have total control about this account, including the account settings. Please double check whom you give this access.'),
'$is_child_user' => $is_child_user,
'$submit' => L10n::t('Save Settings'),
'$header' => L10n::t('Manage Accounts'),
'$delegates_header' => L10n::t('Delegates'),
'$submit' => DI::l10n()->t('Save Settings'),
'$header' => DI::l10n()->t('Manage Accounts'),
'$delegates_header' => DI::l10n()->t('Delegates'),
'$base' => DI::baseUrl(),
'$desc' => L10n::t('Delegates are able to manage all aspects of this account/page except for basic account settings. Please do not delegate your personal account to anybody that you do not trust completely.'),
'$head_delegates' => L10n::t('Existing Page Delegates'),
'$desc' => DI::l10n()->t('Delegates are able to manage all aspects of this account/page except for basic account settings. Please do not delegate your personal account to anybody that you do not trust completely.'),
'$head_delegates' => DI::l10n()->t('Existing Page Delegates'),
'$delegates' => $delegates,
'$head_potentials' => L10n::t('Potential Delegates'),
'$head_potentials' => DI::l10n()->t('Potential Delegates'),
'$potentials' => $potentials,
'$remove' => L10n::t('Remove'),
'$add' => L10n::t('Add'),
'$none' => L10n::t('No entries.')
'$remove' => DI::l10n()->t('Remove'),
'$add' => DI::l10n()->t('Add'),
'$none' => DI::l10n()->t('No entries.')
]);
return $o;

View file

@ -31,7 +31,7 @@ class AppSpecific extends BaseSettingsModule
}
if (!self::checkFormSecurityToken('settings_2fa_password', 't')) {
notice(L10n::t('Please enter your password to access this page.'));
notice(DI::l10n()->t('Please enter your password to access this page.'));
DI::baseUrl()->redirect('settings/2fa');
}
}
@ -49,20 +49,20 @@ class AppSpecific extends BaseSettingsModule
case 'generate':
$description = $_POST['description'] ?? '';
if (empty($description)) {
notice(L10n::t('App-specific password generation failed: The description is empty.'));
notice(DI::l10n()->t('App-specific password generation failed: The description is empty.'));
DI::baseUrl()->redirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
} elseif (AppSpecificPassword::checkDuplicateForUser(local_user(), $description)) {
notice(L10n::t('App-specific password generation failed: This description already exists.'));
notice(DI::l10n()->t('App-specific password generation failed: This description already exists.'));
DI::baseUrl()->redirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
} else {
self::$appSpecificPassword = AppSpecificPassword::generateForUser(local_user(), $_POST['description'] ?? '');
notice(L10n::t('New app-specific password generated.'));
notice(DI::l10n()->t('New app-specific password generated.'));
}
break;
case 'revoke_all' :
AppSpecificPassword::deleteAllForUser(local_user());
notice(L10n::t('App-specific passwords successfully revoked.'));
notice(DI::l10n()->t('App-specific passwords successfully revoked.'));
DI::baseUrl()->redirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
break;
}
@ -72,7 +72,7 @@ class AppSpecific extends BaseSettingsModule
self::checkFormSecurityTokenRedirectOnError('settings/2fa/app_specific', 'settings_2fa_app_specific');
if (AppSpecificPassword::deleteForUser(local_user(), $_POST['revoke_id'])) {
notice(L10n::t('App-specific password successfully revoked.'));
notice(DI::l10n()->t('App-specific password successfully revoked.'));
}
DI::baseUrl()->redirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
@ -93,22 +93,22 @@ class AppSpecific extends BaseSettingsModule
'$form_security_token' => self::getFormSecurityToken('settings_2fa_app_specific'),
'$password_security_token' => self::getFormSecurityToken('settings_2fa_password'),
'$title' => L10n::t('Two-factor app-specific passwords'),
'$help_label' => L10n::t('Help'),
'$message' => 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' => L10n::t('Make sure to copy your new app-specific password now. You wont be able to see it again!'),
'$title' => DI::l10n()->t('Two-factor app-specific passwords'),
'$help_label' => DI::l10n()->t('Help'),
'$message' => DI::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' => DI::l10n()->t('Make sure to copy your new app-specific password now. You wont be able to see it again!'),
'$generated_app_specific_password' => self::$appSpecificPassword,
'$description_label' => L10n::t('Description'),
'$last_used_label' => L10n::t('Last Used'),
'$revoke_label' => L10n::t('Revoke'),
'$revoke_all_label' => L10n::t('Revoke All'),
'$description_label' => DI::l10n()->t('Description'),
'$last_used_label' => DI::l10n()->t('Last Used'),
'$revoke_label' => DI::l10n()->t('Revoke'),
'$revoke_all_label' => DI::l10n()->t('Revoke All'),
'$app_specific_passwords' => $appSpecificPasswords,
'$generate_message' => 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' => L10n::t('Generate new app-specific password'),
'$description_placeholder_label' => L10n::t('Friendiqa on my Fairphone 2...'),
'$generate_label' => L10n::t('Generate'),
'$generate_message' => DI::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' => DI::l10n()->t('Generate new app-specific password'),
'$description_placeholder_label' => DI::l10n()->t('Friendiqa on my Fairphone 2...'),
'$generate_label' => DI::l10n()->t('Generate'),
]);
}
}

View file

@ -46,7 +46,7 @@ class Index extends BaseSettingsModule
DI::pConfig()->delete(local_user(), '2fa', 'verified');
Session::remove('2fa');
notice(L10n::t('Two-factor authentication successfully disabled.'));
notice(DI::l10n()->t('Two-factor authentication successfully disabled.'));
DI::baseUrl()->redirect('settings/2fa');
}
break;
@ -67,7 +67,7 @@ class Index extends BaseSettingsModule
break;
}
} catch (\Exception $e) {
notice(L10n::t('Wrong Password'));
notice(DI::l10n()->t('Wrong Password'));
}
}
@ -84,35 +84,35 @@ class Index extends BaseSettingsModule
return Renderer::replaceMacros(Renderer::getMarkupTemplate('settings/twofactor/index.tpl'), [
'$form_security_token' => self::getFormSecurityToken('settings_2fa'),
'$title' => L10n::t('Two-factor authentication'),
'$help_label' => L10n::t('Help'),
'$status_title' => L10n::t('Status'),
'$message' => L10n::t('<p>Use an application on a mobile device to get two-factor authentication codes when prompted on login.</p>'),
'$title' => DI::l10n()->t('Two-factor authentication'),
'$help_label' => DI::l10n()->t('Help'),
'$status_title' => DI::l10n()->t('Status'),
'$message' => DI::l10n()->t('<p>Use an application on a mobile device to get two-factor authentication codes when prompted on login.</p>'),
'$has_secret' => $has_secret,
'$verified' => $verified,
'$auth_app_label' => L10n::t('Authenticator app'),
'$app_status' => $has_secret ? $verified ? L10n::t('Configured') : L10n::t('Not Configured') : L10n::t('Disabled'),
'$not_configured_message' => L10n::t('<p>You haven\'t finished configuring your authenticator app.</p>'),
'$configured_message' => L10n::t('<p>Your authenticator app is correctly configured.</p>'),
'$auth_app_label' => DI::l10n()->t('Authenticator app'),
'$app_status' => $has_secret ? $verified ? DI::l10n()->t('Configured') : DI::l10n()->t('Not Configured') : DI::l10n()->t('Disabled'),
'$not_configured_message' => DI::l10n()->t('<p>You haven\'t finished configuring your authenticator app.</p>'),
'$configured_message' => DI::l10n()->t('<p>Your authenticator app is correctly configured.</p>'),
'$recovery_codes_title' => L10n::t('Recovery codes'),
'$recovery_codes_remaining' => L10n::t('Remaining valid codes'),
'$recovery_codes_title' => DI::l10n()->t('Recovery codes'),
'$recovery_codes_remaining' => DI::l10n()->t('Remaining valid codes'),
'$recovery_codes_count' => RecoveryCode::countValidForUser(local_user()),
'$recovery_codes_message' => L10n::t('<p>These one-use codes can replace an authenticator app code in case you have lost access to it.</p>'),
'$recovery_codes_message' => DI::l10n()->t('<p>These one-use codes can replace an authenticator app code in case you have lost access to it.</p>'),
'$app_specific_passwords_title' => L10n::t('App-specific passwords'),
'$app_specific_passwords_remaining' => L10n::t('Generated app-specific passwords'),
'$app_specific_passwords_title' => DI::l10n()->t('App-specific passwords'),
'$app_specific_passwords_remaining' => DI::l10n()->t('Generated app-specific passwords'),
'$app_specific_passwords_count' => AppSpecificPassword::countForUser(local_user()),
'$app_specific_passwords_message' => L10n::t('<p>These randomly generated passwords allow you to authenticate on apps not supporting two-factor authentication.</p>'),
'$app_specific_passwords_message' => DI::l10n()->t('<p>These randomly generated passwords allow you to authenticate on apps not supporting two-factor authentication.</p>'),
'$action_title' => L10n::t('Actions'),
'$password' => ['password', L10n::t('Current password:'), '', L10n::t('You need to provide your current password to change two-factor authentication settings.'), 'required', 'autofocus'],
'$enable_label' => L10n::t('Enable two-factor authentication'),
'$disable_label' => L10n::t('Disable two-factor authentication'),
'$recovery_codes_label' => L10n::t('Show recovery codes'),
'$app_specific_passwords_label' => L10n::t('Manage app-specific passwords'),
'$configure_label' => L10n::t('Finish app configuration'),
'$action_title' => DI::l10n()->t('Actions'),
'$password' => ['password', DI::l10n()->t('Current password:'), '', DI::l10n()->t('You need to provide your current password to change two-factor authentication settings.'), 'required', 'autofocus'],
'$enable_label' => DI::l10n()->t('Enable two-factor authentication'),
'$disable_label' => DI::l10n()->t('Disable two-factor authentication'),
'$recovery_codes_label' => DI::l10n()->t('Show recovery codes'),
'$app_specific_passwords_label' => DI::l10n()->t('Manage app-specific passwords'),
'$configure_label' => DI::l10n()->t('Finish app configuration'),
]);
}
}

View file

@ -29,7 +29,7 @@ class Recovery extends BaseSettingsModule
}
if (!self::checkFormSecurityToken('settings_2fa_password', 't')) {
notice(L10n::t('Please enter your password to access this page.'));
notice(DI::l10n()->t('Please enter your password to access this page.'));
DI::baseUrl()->redirect('settings/2fa');
}
}
@ -45,7 +45,7 @@ class Recovery extends BaseSettingsModule
if ($_POST['action'] == 'regenerate') {
RecoveryCode::regenerateForUser(local_user());
notice(L10n::t('New recovery codes successfully generated.'));
notice(DI::l10n()->t('New recovery codes successfully generated.'));
DI::baseUrl()->redirect('settings/2fa/recovery?t=' . self::getFormSecurityToken('settings_2fa_password'));
}
}
@ -71,14 +71,14 @@ class Recovery extends BaseSettingsModule
'$form_security_token' => self::getFormSecurityToken('settings_2fa_recovery'),
'$password_security_token' => self::getFormSecurityToken('settings_2fa_password'),
'$title' => L10n::t('Two-factor recovery codes'),
'$help_label' => L10n::t('Help'),
'$message' => 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' => DI::l10n()->t('Two-factor recovery codes'),
'$help_label' => DI::l10n()->t('Help'),
'$message' => DI::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>'),
'$recovery_codes' => $recoveryCodes,
'$regenerate_message' => L10n::t('When you generate new recovery codes, you must copy the new codes. Your old codes wont work anymore.'),
'$regenerate_label' => L10n::t('Generate new recovery codes'),
'$regenerate_message' => DI::l10n()->t('When you generate new recovery codes, you must copy the new codes. Your old codes wont work anymore.'),
'$regenerate_label' => DI::l10n()->t('Generate new recovery codes'),
'$verified' => $verified,
'$verify_label' => L10n::t('Next: Verification'),
'$verify_label' => DI::l10n()->t('Next: Verification'),
]);
}
}

View file

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

View file

@ -39,15 +39,15 @@ class UserExport extends BaseSettingsModule
* list of array( 'link url', 'link text', 'help text' )
*/
$options = [
['settings/userexport/account', L10n::t('Export account'), L10n::t('Export your account info and contacts. Use this to make a backup of your account and/or to move it to another server.')],
['settings/userexport/backup', L10n::t('Export all'), L10n::t("Export your accout info, contacts and all your items as json. Could be a very big file, and could take a lot of time. Use this to make a full backup of your account \x28photos are not exported\x29")],
['settings/userexport/contact', L10n::t('Export Contacts to CSV'), L10n::t("Export the list of the accounts you are following as CSV file. Compatible to e.g. Mastodon.")],
['settings/userexport/account', DI::l10n()->t('Export account'), DI::l10n()->t('Export your account info and contacts. Use this to make a backup of your account and/or to move it to another server.')],
['settings/userexport/backup', DI::l10n()->t('Export all'), DI::l10n()->t("Export your accout info, contacts and all your items as json. Could be a very big file, and could take a lot of time. Use this to make a full backup of your account \x28photos are not exported\x29")],
['settings/userexport/contact', DI::l10n()->t('Export Contacts to CSV'), DI::l10n()->t("Export the list of the accounts you are following as CSV file. Compatible to e.g. Mastodon.")],
];
Hook::callAll('uexport_options', $options);
$tpl = Renderer::getMarkupTemplate("settings/userexport.tpl");
return Renderer::replaceMacros($tpl, [
'$title' => L10n::t('Export personal data'),
'$title' => DI::l10n()->t('Export personal data'),
'$options' => $options
]);
}