From dab9e13c69ee0fe6cb4cdaed06510ca938c747ae Mon Sep 17 00:00:00 2001 From: Philipp Date: Thu, 18 Nov 2021 21:33:05 +0100 Subject: [PATCH] Replace $this->l10n->t() with $this->t() for Modules --- src/BaseModule.php | 20 +++ src/Module/Admin/Themes/Embed.php | 2 +- src/Module/Admin/Tos.php | 14 +-- src/Module/Apps.php | 4 +- src/Module/BaseNotifications.php | 6 +- src/Module/Contact/Advanced.php | 36 +++--- src/Module/Contact/Revoke.php | 20 +-- src/Module/Debug/Feed.php | 4 +- src/Module/Diaspora/Receive.php | 2 +- src/Module/Filer/SaveTag.php | 6 +- src/Module/FriendSuggest.php | 16 +-- src/Module/Install.php | 116 +++++++++--------- src/Module/Notifications/Introductions.php | 54 ++++---- src/Module/Notifications/Notifications.php | 12 +- src/Module/RemoteFollow.php | 24 ++-- src/Module/Search/Saved.php | 6 +- src/Module/Security/Logout.php | 2 +- src/Module/Security/TwoFactor/Recovery.php | 14 +-- src/Module/Settings/TwoFactor/AppSpecific.php | 36 +++--- src/Module/Settings/TwoFactor/Recovery.php | 16 +-- src/Module/Settings/TwoFactor/Trusted.php | 24 ++-- src/Module/Settings/TwoFactor/Verify.php | 20 +-- src/Module/Tos.php | 18 +-- 23 files changed, 246 insertions(+), 226 deletions(-) diff --git a/src/BaseModule.php b/src/BaseModule.php index 5d752bb4f..be4788045 100644 --- a/src/BaseModule.php +++ b/src/BaseModule.php @@ -49,6 +49,26 @@ abstract class BaseModule implements ICanHandleRequests $this->l10n = $l10n; } + /** + * Wraps the L10n::t() function for Modules + * + * @see L10n::t() + */ + protected function t(string $s, ...$args): string + { + return $this->l10n->t($s, $args); + } + + /** + * Wraps the L10n::tt() function for Modules + * + * @see L10n::tt() + */ + protected function tt(string $singular, string $plurarl, int $count): string + { + return $this->l10n->tt($singular, $plurarl, $count); + } + /** * {@inheritDoc} */ diff --git a/src/Module/Admin/Themes/Embed.php b/src/Module/Admin/Themes/Embed.php index 2f991a741..0d2a2dc04 100644 --- a/src/Module/Admin/Themes/Embed.php +++ b/src/Module/Admin/Themes/Embed.php @@ -76,7 +76,7 @@ class Embed extends BaseAdmin $theme = Strings::sanitizeFilePathItem($this->parameters['theme']); if (!is_dir("view/theme/$theme")) { - notice($this->l10n->t('Unknown theme.')); + notice($this->t('Unknown theme.')); return ''; } diff --git a/src/Module/Admin/Tos.php b/src/Module/Admin/Tos.php index a42427e90..0e019cc32 100644 --- a/src/Module/Admin/Tos.php +++ b/src/Module/Admin/Tos.php @@ -72,15 +72,15 @@ class Tos extends BaseAdmin $t = Renderer::getMarkupTemplate('admin/tos.tpl'); return Renderer::replaceMacros($t, [ - '$title' => $this->l10n->t('Administration'), - '$page' => $this->l10n->t('Terms of Service'), - '$displaytos' => ['displaytos', $this->l10n->t('Display Terms of Service'), $this->config->get('system', 'tosdisplay'), $this->l10n->t('Enable the Terms of Service page. If this is enabled a link to the terms will be added to the registration form and the general information page.')], - '$displayprivstatement' => ['displayprivstatement', $this->l10n->t('Display Privacy Statement'), $this->config->get('system', 'tosprivstatement'), $this->l10n->t('Show some informations regarding the needed information to operate the node according e.g. to EU-GDPR.', 'https://en.wikipedia.org/wiki/General_Data_Protection_Regulation')], - '$preview' => $this->l10n->t('Privacy Statement Preview'), + '$title' => $this->t('Administration'), + '$page' => $this->t('Terms of Service'), + '$displaytos' => ['displaytos', $this->t('Display Terms of Service'), $this->config->get('system', 'tosdisplay'), $this->t('Enable the Terms of Service page. If this is enabled a link to the terms will be added to the registration form and the general information page.')], + '$displayprivstatement' => ['displayprivstatement', $this->t('Display Privacy Statement'), $this->config->get('system', 'tosprivstatement'), $this->t('Show some informations regarding the needed information to operate the node according e.g. to EU-GDPR.', 'https://en.wikipedia.org/wiki/General_Data_Protection_Regulation')], + '$preview' => $this->t('Privacy Statement Preview'), '$privtext' => $this->tos->privacy_complete, - '$tostext' => ['tostext', $this->l10n->t('The Terms of Service'), $this->config->get('system', 'tostext'), $this->l10n->t('Enter the Terms of Service for your node here. You can use BBCode. Headers of sections should be [h2] and below.')], + '$tostext' => ['tostext', $this->t('The Terms of Service'), $this->config->get('system', 'tostext'), $this->t('Enter the Terms of Service for your node here. You can use BBCode. Headers of sections should be [h2] and below.')], '$form_security_token' => self::getFormSecurityToken('admin_tos'), - '$submit' => $this->l10n->t('Save Settings'), + '$submit' => $this->t('Save Settings'), ]); } } diff --git a/src/Module/Apps.php b/src/Module/Apps.php index ea31140df..f414f7f8c 100644 --- a/src/Module/Apps.php +++ b/src/Module/Apps.php @@ -48,12 +48,12 @@ class Apps extends BaseModule $apps = Nav::getAppMenu(); if (count($apps) == 0) { - notice($this->l10n->t('No installed applications.')); + notice($this->t('No installed applications.')); } $tpl = Renderer::getMarkupTemplate('apps.tpl'); return Renderer::replaceMacros($tpl, [ - '$title' => $this->l10n->t('Applications'), + '$title' => $this->t('Applications'), '$apps' => $apps, ]); } diff --git a/src/Module/BaseNotifications.php b/src/Module/BaseNotifications.php index 8a569e24f..0e39eb651 100644 --- a/src/Module/BaseNotifications.php +++ b/src/Module/BaseNotifications.php @@ -91,7 +91,7 @@ abstract class BaseNotifications extends BaseModule parent::__construct($l10n, $parameters); if (!local_user()) { - throw new ForbiddenException($this->l10n->t('Permission denied.')); + throw new ForbiddenException($this->t('Permission denied.')); } $page = ($_REQUEST['page'] ?? 0) ?: 1; @@ -144,7 +144,7 @@ abstract class BaseNotifications extends BaseModule $notif_tpl = Renderer::getMarkupTemplate('notifications/notifications.tpl'); return Renderer::replaceMacros($notif_tpl, [ - '$header' => $header ?? $this->l10n->t('Notifications'), + '$header' => $header ?? $this->t('Notifications'), '$tabs' => $tabs, '$notifications' => $notifications, '$noContent' => $noContent, @@ -167,7 +167,7 @@ abstract class BaseNotifications extends BaseModule foreach (self::URL_TYPES as $type => $url) { $tabs[] = [ - 'label' => $this->l10n->t(self::PRINT_TYPES[$type]), + 'label' => $this->t(self::PRINT_TYPES[$type]), 'url' => 'notifications/' . $url, 'sel' => (($selected == $url) ? 'active' : ''), 'id' => $type . '-tab', diff --git a/src/Module/Contact/Advanced.php b/src/Module/Contact/Advanced.php index 4653ac071..8d0a4e0f3 100644 --- a/src/Module/Contact/Advanced.php +++ b/src/Module/Contact/Advanced.php @@ -57,7 +57,7 @@ class Advanced extends BaseModule $this->page = $page; if (!Session::isAuthenticated()) { - throw new ForbiddenException($this->l10n->t('Permission denied.')); + throw new ForbiddenException($this->t('Permission denied.')); } } @@ -67,7 +67,7 @@ class Advanced extends BaseModule $contact = Model\Contact::selectFirst([], ['id' => $cid, 'uid' => local_user()]); if (empty($contact)) { - throw new BadRequestException($this->l10n->t('Contact not found.')); + throw new BadRequestException($this->t('Contact not found.')); } $name = ($_POST['name'] ?? '') ?: $contact['name']; @@ -106,7 +106,7 @@ class Advanced extends BaseModule } if (!$r) { - notice($this->l10n->t('Contact update failed.')); + notice($this->t('Contact update failed.')); } } @@ -116,13 +116,13 @@ class Advanced extends BaseModule $contact = Model\Contact::selectFirst([], ['id' => $cid, 'uid' => local_user()]); if (empty($contact)) { - throw new BadRequestException($this->l10n->t('Contact not found.')); + throw new BadRequestException($this->t('Contact not found.')); } $this->page['aside'] = Widget\VCard::getHTML($contact); - $warning = $this->l10n->t('WARNING: This is highly advanced and if you enter incorrect information your communications with this contact may stop working.'); - $info = $this->l10n->t('Please use your browser \'Back\' button now if you are uncertain what to do on this page.'); + $warning = $this->t('WARNING: This is highly advanced and if you enter incorrect information your communications with this contact may stop working.'); + $info = $this->t('Please use your browser \'Back\' button now if you are uncertain what to do on this page.'); $returnaddr = "contact/$cid"; @@ -142,20 +142,20 @@ class Advanced extends BaseModule '$warning' => $warning, '$info' => $info, '$returnaddr' => $returnaddr, - '$return' => $this->l10n->t('Return to contact editor'), + '$return' => $this->t('Return to contact editor'), '$contact_id' => $contact['id'], - '$lbl_submit' => $this->l10n->t('Submit'), + '$lbl_submit' => $this->t('Submit'), - '$name' => ['name', $this->l10n->t('Name'), $contact['name'], '', '', $readonly], - '$nick' => ['nick', $this->l10n->t('Account Nickname'), $contact['nick'], '', '', $readonly], - '$attag' => ['attag', $this->l10n->t('@Tagname - overrides Name/Nickname'), $contact['attag']], - '$url' => ['url', $this->l10n->t('Account URL'), $contact['url'], '', '', $readonly], - '$alias' => ['alias', $this->l10n->t('Account URL Alias'), $contact['alias'], '', '', $readonly], - '$request' => ['request', $this->l10n->t('Friend Request URL'), $contact['request'], '', '', $readonly], - 'confirm' => ['confirm', $this->l10n->t('Friend Confirm URL'), $contact['confirm'], '', '', $readonly], - 'notify' => ['notify', $this->l10n->t('Notification Endpoint URL'), $contact['notify'], '', '', $readonly], - 'poll' => ['poll', $this->l10n->t('Poll/Feed URL'), $contact['poll'], '', '', $readonly], - 'photo' => ['photo', $this->l10n->t('New photo from this URL'), '', '', '', $readonly], + '$name' => ['name', $this->t('Name'), $contact['name'], '', '', $readonly], + '$nick' => ['nick', $this->t('Account Nickname'), $contact['nick'], '', '', $readonly], + '$attag' => ['attag', $this->t('@Tagname - overrides Name/Nickname'), $contact['attag']], + '$url' => ['url', $this->t('Account URL'), $contact['url'], '', '', $readonly], + '$alias' => ['alias', $this->t('Account URL Alias'), $contact['alias'], '', '', $readonly], + '$request' => ['request', $this->t('Friend Request URL'), $contact['request'], '', '', $readonly], + 'confirm' => ['confirm', $this->t('Friend Confirm URL'), $contact['confirm'], '', '', $readonly], + 'notify' => ['notify', $this->t('Notification Endpoint URL'), $contact['notify'], '', '', $readonly], + 'poll' => ['poll', $this->t('Poll/Feed URL'), $contact['poll'], '', '', $readonly], + 'photo' => ['photo', $this->t('New photo from this URL'), '', '', '', $readonly], ]); } } diff --git a/src/Module/Contact/Revoke.php b/src/Module/Contact/Revoke.php index e5bf71ed0..88177cc3b 100644 --- a/src/Module/Contact/Revoke.php +++ b/src/Module/Contact/Revoke.php @@ -60,7 +60,7 @@ class Revoke extends BaseModule $data = Model\Contact::getPublicAndUserContactID($this->parameters['id'], local_user()); if (!$this->dba->isResult($data)) { - throw new HTTPException\NotFoundException($this->l10n->t('Unknown contact.')); + throw new HTTPException\NotFoundException($this->t('Unknown contact.')); } if (empty($data['user'])) { @@ -70,11 +70,11 @@ class Revoke extends BaseModule $this->contact = Model\Contact::getById($data['user']); if ($this->contact['deleted']) { - throw new HTTPException\NotFoundException($this->l10n->t('Contact is deleted.')); + throw new HTTPException\NotFoundException($this->t('Contact is deleted.')); } if (!empty($this->contact['network']) && $this->contact['network'] == Protocol::PHANTOM) { - throw new HTTPException\NotFoundException($this->l10n->t('Contact is being deleted.')); + throw new HTTPException\NotFoundException($this->t('Contact is being deleted.')); } } @@ -88,11 +88,11 @@ class Revoke extends BaseModule $result = Model\Contact::revokeFollow($this->contact); if ($result === true) { - notice($this->l10n->t('Follow was successfully revoked.')); + notice($this->t('Follow was successfully revoked.')); } elseif ($result === null) { - notice($this->l10n->t('Follow was successfully revoked, however the remote contact won\'t be aware of this revokation.')); + notice($this->t('Follow was successfully revoked, however the remote contact won\'t be aware of this revokation.')); } else { - notice($this->l10n->t('Unable to revoke follow, please try again later or contact the administrator.')); + notice($this->t('Unable to revoke follow, please try again later or contact the administrator.')); } $this->baseUrl->redirect('contact/' . $this->parameters['id']); @@ -108,10 +108,10 @@ class Revoke extends BaseModule return Renderer::replaceMacros(Renderer::getMarkupTemplate('contact_drop_confirm.tpl'), [ '$l10n' => [ - 'header' => $this->l10n->t('Revoke Follow'), - 'message' => $this->l10n->t('Do you really want to revoke this contact\'s follow? This cannot be undone and they will have to manually follow you back again.'), - 'confirm' => $this->l10n->t('Yes'), - 'cancel' => $this->l10n->t('Cancel'), + 'header' => $this->t('Revoke Follow'), + 'message' => $this->t('Do you really want to revoke this contact\'s follow? This cannot be undone and they will have to manually follow you back again.'), + 'confirm' => $this->t('Yes'), + 'cancel' => $this->t('Cancel'), ], '$contact' => Contact::getContactTemplateVars($this->contact), '$method' => 'post', diff --git a/src/Module/Debug/Feed.php b/src/Module/Debug/Feed.php index 983cf4194..9368dd026 100644 --- a/src/Module/Debug/Feed.php +++ b/src/Module/Debug/Feed.php @@ -44,7 +44,7 @@ class Feed extends BaseModule $this->httpClient = $httpClient; if (!local_user()) { - notice($this->l10n->t('You must be logged in to use this module')); + notice($this->t('You must be logged in to use this module')); $baseUrl->redirect(); } } @@ -69,7 +69,7 @@ class Feed extends BaseModule $tpl = Renderer::getMarkupTemplate('feedtest.tpl'); return Renderer::replaceMacros($tpl, [ - '$url' => ['url', $this->l10n->t('Source URL'), $_REQUEST['url'] ?? '', ''], + '$url' => ['url', $this->t('Source URL'), $_REQUEST['url'] ?? '', ''], '$result' => $result ]); } diff --git a/src/Module/Diaspora/Receive.php b/src/Module/Diaspora/Receive.php index 088d6a3b6..ed4f8a5d2 100644 --- a/src/Module/Diaspora/Receive.php +++ b/src/Module/Diaspora/Receive.php @@ -54,7 +54,7 @@ class Receive extends BaseModule $enabled = $this->config->get('system', 'diaspora_enabled', false); if (!$enabled) { $this->logger->info('Diaspora disabled.'); - throw new HTTPException\ForbiddenException($this->l10n->t('Access denied.')); + throw new HTTPException\ForbiddenException($this->t('Access denied.')); } if ($this->parameters['type'] === 'public') { diff --git a/src/Module/Filer/SaveTag.php b/src/Module/Filer/SaveTag.php index ad242e60e..fd572a7be 100644 --- a/src/Module/Filer/SaveTag.php +++ b/src/Module/Filer/SaveTag.php @@ -46,7 +46,7 @@ class SaveTag extends BaseModule $this->logger = $logger; if (!local_user()) { - notice($this->l10n->t('You must be logged in to use this module')); + notice($this->t('You must be logged in to use this module')); $baseUrl->redirect(); } } @@ -72,8 +72,8 @@ class SaveTag extends BaseModule $tpl = Renderer::getMarkupTemplate("filer_dialog.tpl"); echo Renderer::replaceMacros($tpl, [ - '$field' => ['term', $this->l10n->t("Save to Folder:"), '', '', $filetags, $this->l10n->t('- select -')], - '$submit' => $this->l10n->t('Save'), + '$field' => ['term', $this->t("Save to Folder:"), '', '', $filetags, $this->t('- select -')], + '$submit' => $this->t('Save'), ]); exit; diff --git a/src/Module/FriendSuggest.php b/src/Module/FriendSuggest.php index a53f78cc6..940e6ff9c 100644 --- a/src/Module/FriendSuggest.php +++ b/src/Module/FriendSuggest.php @@ -53,7 +53,7 @@ class FriendSuggest extends BaseModule parent::__construct($l10n, $parameters); if (!local_user()) { - throw new ForbiddenException($this->l10n->t('Permission denied.')); + throw new ForbiddenException($this->t('Permission denied.')); } $this->baseUrl = $baseUrl; @@ -68,7 +68,7 @@ class FriendSuggest extends BaseModule // We do query the "uid" as well to ensure that it is our contact if (!$this->dba->exists('contact', ['id' => $cid, 'uid' => local_user()])) { - throw new NotFoundException($this->l10n->t('Contact not found.')); + throw new NotFoundException($this->t('Contact not found.')); } $suggest_contact_id = intval($_POST['suggest']); @@ -79,7 +79,7 @@ class FriendSuggest extends BaseModule // We do query the "uid" as well to ensure that it is our contact $contact = $this->dba->selectFirst('contact', ['name', 'url', 'request', 'avatar'], ['id' => $suggest_contact_id, 'uid' => local_user()]); if (empty($contact)) { - notice($this->l10n->t('Suggested contact not found.')); + notice($this->t('Suggested contact not found.')); return; } @@ -97,7 +97,7 @@ class FriendSuggest extends BaseModule Worker::add(PRIORITY_HIGH, 'Notifier', Delivery::SUGGESTION, $suggest->id); - info($this->l10n->t('Friend suggestion sent.')); + info($this->t('Friend suggestion sent.')); } public function content(): string @@ -106,7 +106,7 @@ class FriendSuggest extends BaseModule $contact = $this->dba->selectFirst('contact', [], ['id' => $cid, 'uid' => local_user()]); if (empty($contact)) { - notice($this->l10n->t('Contact not found.')); + notice($this->t('Contact not found.')); $this->baseUrl->redirect(); } @@ -134,15 +134,15 @@ class FriendSuggest extends BaseModule $tpl = Renderer::getMarkupTemplate('fsuggest.tpl'); return Renderer::replaceMacros($tpl, [ '$contact_id' => $cid, - '$fsuggest_title' => $this->l10n->t('Suggest Friends'), + '$fsuggest_title' => $this->t('Suggest Friends'), '$fsuggest_select' => [ 'suggest', - $this->l10n->t('Suggest a friend for %s', $contact['name']), + $this->t('Suggest a friend for %s', $contact['name']), '', '', $formattedContacts, ], - '$submit' => $this->l10n->t('Submit'), + '$submit' => $this->t('Submit'), ]); } } diff --git a/src/Module/Install.php b/src/Module/Install.php index fe4a19d4b..c766dd551 100644 --- a/src/Module/Install.php +++ b/src/Module/Install.php @@ -193,7 +193,7 @@ class Install extends BaseModule $output = ''; - $install_title = $this->l10n->t('Friendica Communications Server - Setup'); + $install_title = $this->t('Friendica Communications Server - Setup'); switch ($this->currentWizardStep) { case self::SYSTEM_CHECK: @@ -204,53 +204,53 @@ class Install extends BaseModule $tpl = Renderer::getMarkupTemplate('install_checks.tpl'); $output .= Renderer::replaceMacros($tpl, [ '$title' => $install_title, - '$pass' => $this->l10n->t('System check'), - '$required' => $this->l10n->t('Required'), - '$requirement_not_satisfied' => $this->l10n->t('Requirement not satisfied'), - '$optional_requirement_not_satisfied' => $this->l10n->t('Optional requirement not satisfied'), - '$ok' => $this->l10n->t('OK'), + '$pass' => $this->t('System check'), + '$required' => $this->t('Required'), + '$requirement_not_satisfied' => $this->t('Requirement not satisfied'), + '$optional_requirement_not_satisfied' => $this->t('Optional requirement not satisfied'), + '$ok' => $this->t('OK'), '$checks' => $this->installer->getChecks(), '$passed' => $status, - '$see_install' => $this->l10n->t('Please see the file "doc/INSTALL.md".'), - '$next' => $this->l10n->t('Next'), - '$reload' => $this->l10n->t('Check again'), + '$see_install' => $this->t('Please see the file "doc/INSTALL.md".'), + '$next' => $this->t('Next'), + '$reload' => $this->t('Check again'), '$php_path' => $php_path, ]); break; case self::BASE_CONFIG: $ssl_choices = [ - App\BaseURL::SSL_POLICY_NONE => $this->l10n->t("No SSL policy, links will track page SSL state"), - App\BaseURL::SSL_POLICY_FULL => $this->l10n->t("Force all links to use SSL"), - App\BaseURL::SSL_POLICY_SELFSIGN => $this->l10n->t("Self-signed certificate, use SSL for local links only \x28discouraged\x29") + App\BaseURL::SSL_POLICY_NONE => $this->t("No SSL policy, links will track page SSL state"), + App\BaseURL::SSL_POLICY_FULL => $this->t("Force all links to use SSL"), + App\BaseURL::SSL_POLICY_SELFSIGN => $this->t("Self-signed certificate, use SSL for local links only \x28discouraged\x29") ]; $tpl = Renderer::getMarkupTemplate('install_base.tpl'); $output .= Renderer::replaceMacros($tpl, [ '$title' => $install_title, - '$pass' => $this->l10n->t('Base settings'), + '$pass' => $this->t('Base settings'), '$ssl_policy' => ['system-ssl_policy', - $this->l10n->t("SSL link policy"), + $this->t("SSL link policy"), $configCache->get('system', 'ssl_policy'), - $this->l10n->t("Determines whether generated links should be forced to use SSL"), + $this->t("Determines whether generated links should be forced to use SSL"), $ssl_choices], '$hostname' => ['config-hostname', - $this->l10n->t('Host name'), + $this->t('Host name'), $configCache->get('config', 'hostname'), - $this->l10n->t('Overwrite this field in case the determinated hostname isn\'t right, otherweise leave it as is.'), - $this->l10n->t('Required')], + $this->t('Overwrite this field in case the determinated hostname isn\'t right, otherweise leave it as is.'), + $this->t('Required')], '$basepath' => ['system-basepath', - $this->l10n->t("Base path to installation"), + $this->t("Base path to installation"), $configCache->get('system', 'basepath'), - $this->l10n->t("If the system cannot detect the correct path to your installation, enter the correct path here. This setting should only be set if you are using a restricted system and symbolic links to your webroot."), - $this->l10n->t('Required')], + $this->t("If the system cannot detect the correct path to your installation, enter the correct path here. This setting should only be set if you are using a restricted system and symbolic links to your webroot."), + $this->t('Required')], '$urlpath' => ['system-urlpath', - $this->l10n->t('Sub path of the URL'), + $this->t('Sub path of the URL'), $configCache->get('system', 'urlpath'), - $this->l10n->t('Overwrite this field in case the sub path determination isn\'t right, otherwise leave it as is. Leaving this field blank means the installation is at the base URL without sub path.'), + $this->t('Overwrite this field in case the sub path determination isn\'t right, otherwise leave it as is. Leaving this field blank means the installation is at the base URL without sub path.'), ''], '$php_path' => $configCache->get('config', 'php_path'), - '$submit' => $this->l10n->t('Submit'), + '$submit' => $this->t('Submit'), ]); break; @@ -258,41 +258,41 @@ class Install extends BaseModule $tpl = Renderer::getMarkupTemplate('install_db.tpl'); $output .= Renderer::replaceMacros($tpl, [ '$title' => $install_title, - '$pass' => $this->l10n->t('Database connection'), - '$info_01' => $this->l10n->t('In order to install Friendica we need to know how to connect to your database.'), - '$info_02' => $this->l10n->t('Please contact your hosting provider or site administrator if you have questions about these settings.'), - '$info_03' => $this->l10n->t('The database you specify below should already exist. If it does not, please create it before continuing.'), - '$required' => $this->l10n->t('Required'), - '$requirement_not_satisfied' => $this->l10n->t('Requirement not satisfied'), + '$pass' => $this->t('Database connection'), + '$info_01' => $this->t('In order to install Friendica we need to know how to connect to your database.'), + '$info_02' => $this->t('Please contact your hosting provider or site administrator if you have questions about these settings.'), + '$info_03' => $this->t('The database you specify below should already exist. If it does not, please create it before continuing.'), + '$required' => $this->t('Required'), + '$requirement_not_satisfied' => $this->t('Requirement not satisfied'), '$checks' => $this->installer->getChecks(), '$hostname' => $configCache->get('config', 'hostname'), '$ssl_policy' => $configCache->get('system', 'ssl_policy'), '$basepath' => $configCache->get('system', 'basepath'), '$urlpath' => $configCache->get('system', 'urlpath'), '$dbhost' => ['database-hostname', - $this->l10n->t('Database Server Name'), + $this->t('Database Server Name'), $configCache->get('database', 'hostname'), '', - $this->l10n->t('Required')], + $this->t('Required')], '$dbuser' => ['database-username', - $this->l10n->t('Database Login Name'), + $this->t('Database Login Name'), $configCache->get('database', 'username'), '', - $this->l10n->t('Required'), + $this->t('Required'), 'autofocus'], '$dbpass' => ['database-password', - $this->l10n->t('Database Login Password'), + $this->t('Database Login Password'), $configCache->get('database', 'password'), - $this->l10n->t("For security reasons the password must not be empty"), - $this->l10n->t('Required')], + $this->t("For security reasons the password must not be empty"), + $this->t('Required')], '$dbdata' => ['database-database', - $this->l10n->t('Database Name'), + $this->t('Database Name'), $configCache->get('database', 'database'), '', - $this->l10n->t('Required')], - '$lbl_10' => $this->l10n->t('Please select a default timezone for your website'), + $this->t('Required')], + '$lbl_10' => $this->t('Please select a default timezone for your website'), '$php_path' => $configCache->get('config', 'php_path'), - '$submit' => $this->l10n->t('Submit') + '$submit' => $this->t('Submit') ]); break; @@ -303,9 +303,9 @@ class Install extends BaseModule $tpl = Renderer::getMarkupTemplate('install_settings.tpl'); $output .= Renderer::replaceMacros($tpl, [ '$title' => $install_title, - '$required' => $this->l10n->t('Required'), + '$required' => $this->t('Required'), '$checks' => $this->installer->getChecks(), - '$pass' => $this->l10n->t('Site settings'), + '$pass' => $this->t('Site settings'), '$hostname' => $configCache->get('config', 'hostname'), '$ssl_policy' => $configCache->get('system', 'ssl_policy'), '$basepath' => $configCache->get('system', 'basepath'), @@ -315,21 +315,21 @@ class Install extends BaseModule '$dbpass' => $configCache->get('database', 'password'), '$dbdata' => $configCache->get('database', 'database'), '$adminmail' => ['config-admin_email', - $this->l10n->t('Site administrator email address'), + $this->t('Site administrator email address'), $configCache->get('config', 'admin_email'), - $this->l10n->t('Your account email address must match this in order to use the web admin panel.'), - $this->l10n->t('Required'), 'autofocus', 'email'], + $this->t('Your account email address must match this in order to use the web admin panel.'), + $this->t('Required'), 'autofocus', 'email'], '$timezone' => Temporal::getTimezoneField('system-default_timezone', - $this->l10n->t('Please select a default timezone for your website'), + $this->t('Please select a default timezone for your website'), $configCache->get('system', 'default_timezone'), ''), '$language' => ['system-language', - $this->l10n->t('System Language:'), + $this->t('System Language:'), $configCache->get('system', 'language'), - $this->l10n->t('Set the default language for your Friendica installation interface and to send emails.'), + $this->t('Set the default language for your Friendica installation interface and to send emails.'), $lang_choices], '$php_path' => $configCache->get('config', 'php_path'), - '$submit' => $this->l10n->t('Submit') + '$submit' => $this->t('Submit') ]); break; @@ -338,17 +338,17 @@ class Install extends BaseModule if (count($this->installer->getChecks()) == 0) { $txt = '

'; - $txt .= $this->l10n->t('Your Friendica site database has been installed.') . EOL; + $txt .= $this->t('Your Friendica site database has been installed.') . EOL; $db_return_text .= $txt; } $tpl = Renderer::getMarkupTemplate('install_finished.tpl'); $output .= Renderer::replaceMacros($tpl, [ '$title' => $install_title, - '$required' => $this->l10n->t('Required'), - '$requirement_not_satisfied' => $this->l10n->t('Requirement not satisfied'), + '$required' => $this->t('Required'), + '$requirement_not_satisfied' => $this->t('Requirement not satisfied'), '$checks' => $this->installer->getChecks(), - '$pass' => $this->l10n->t('Installation finished'), + '$pass' => $this->t('Installation finished'), '$text' => $db_return_text . $this->whatNext(), ]); @@ -368,11 +368,11 @@ class Install extends BaseModule { $baseurl = $this->baseUrl->get(); return - $this->l10n->t('

What next

') - . "

" . $this->l10n->t('IMPORTANT: You will need to [manually] setup a scheduled task for the worker.') - . $this->l10n->t('Please see the file "doc/INSTALL.md".') + $this->t('

What next

') + . "

" . $this->t('IMPORTANT: You will need to [manually] setup a scheduled task for the worker.') + . $this->t('Please see the file "doc/INSTALL.md".') . "

" - . $this->l10n->t('Go to your new Friendica node registration page and register as new user. Remember to use the same email you have entered as administrator email. This will allow you to enter the site admin panel.', $baseurl) + . $this->t('Go to your new Friendica node registration page and register as new user. Remember to use the same email you have entered as administrator email. This will allow you to enter the site admin panel.', $baseurl) . "

"; } diff --git a/src/Module/Notifications/Introductions.php b/src/Module/Notifications/Introductions.php index 0a254f63f..b9bbd0be9 100644 --- a/src/Module/Notifications/Introductions.php +++ b/src/Module/Notifications/Introductions.php @@ -66,7 +66,7 @@ class Introductions extends BaseNotifications ]; return [ - 'header' => $this->l10n->t('Notifications'), + 'header' => $this->t('Notifications'), 'notifications' => $notifications, ]; } @@ -90,7 +90,7 @@ class Introductions extends BaseNotifications // The link to switch between ignored and normal connection requests $notificationShowLink = [ 'href' => (!$all ? 'notifications/intros/all' : 'notifications/intros'), - 'text' => (!$all ? $this->l10n->t('Show Ignored Requests') : $this->l10n->t('Hide Ignored Requests')), + 'text' => (!$all ? $this->t('Show Ignored Requests') : $this->t('Hide Ignored Requests')), ]; $owner = User::getOwnerDataById(local_user()); @@ -106,10 +106,10 @@ class Introductions extends BaseNotifications case 'friend_suggestion': $notificationContent[] = Renderer::replaceMacros($notificationSuggestions, [ '$type' => $Introduction->getLabel(), - '$str_notification_type' => $this->l10n->t('Notification type:'), + '$str_notification_type' => $this->t('Notification type:'), '$str_type' => $Introduction->getType(), '$intro_id' => $Introduction->getIntroId(), - '$lbl_madeby' => $this->l10n->t('Suggested by:'), + '$lbl_madeby' => $this->t('Suggested by:'), '$madeby' => $Introduction->getMadeBy(), '$madeby_url' => $Introduction->getMadeByUrl(), '$madeby_zrl' => $Introduction->getMadeByZrl(), @@ -120,13 +120,13 @@ class Introductions extends BaseNotifications '$dfrn_url' => $owner['url'], '$url' => $Introduction->getUrl(), '$zrl' => $Introduction->getZrl(), - '$lbl_url' => $this->l10n->t('Profile URL'), + '$lbl_url' => $this->t('Profile URL'), '$addr' => $Introduction->getAddr(), '$action' => 'follow', - '$approve' => $this->l10n->t('Approve'), + '$approve' => $this->t('Approve'), '$note' => $Introduction->getNote(), - '$ignore' => $this->l10n->t('Ignore'), - '$discard' => $this->l10n->t('Discard'), + '$ignore' => $this->t('Ignore'), + '$discard' => $this->t('Discard'), '$is_mobile' => $this->mode->isMobile(), ]); break; @@ -134,8 +134,8 @@ class Introductions extends BaseNotifications // Normal connection requests default: if ($Introduction->getNetwork() === Protocol::DFRN) { - $lbl_knowyou = $this->l10n->t('Claims to be known to you: '); - $knowyou = ($Introduction->getKnowYou() ? $this->l10n->t('Yes') : $this->l10n->t('No')); + $lbl_knowyou = $this->t('Claims to be known to you: '); + $knowyou = ($Introduction->getKnowYou() ? $this->t('Yes') : $this->t('No')); } else { $lbl_knowyou = ''; $knowyou = ''; @@ -143,12 +143,12 @@ class Introductions extends BaseNotifications $convertedName = BBCode::convert($Introduction->getName()); - $helptext = $this->l10n->t('Shall your connection be bidirectional or not?'); - $helptext2 = $this->l10n->t('Accepting %s as a friend allows %s to subscribe to your posts, and you will also receive updates from them in your news feed.', $convertedName, $convertedName); - $helptext3 = $this->l10n->t('Accepting %s as a subscriber allows them to subscribe to your posts, but you will not receive updates from them in your news feed.', $convertedName); + $helptext = $this->t('Shall your connection be bidirectional or not?'); + $helptext2 = $this->t('Accepting %s as a friend allows %s to subscribe to your posts, and you will also receive updates from them in your news feed.', $convertedName, $convertedName); + $helptext3 = $this->t('Accepting %s as a subscriber allows them to subscribe to your posts, but you will not receive updates from them in your news feed.', $convertedName); - $friend = ['duplex', $this->l10n->t('Friend'), '1', $helptext2, true]; - $follower = ['duplex', $this->l10n->t('Subscriber'), '0', $helptext3, false]; + $friend = ['duplex', $this->t('Friend'), '1', $helptext2, true]; + $follower = ['duplex', $this->t('Subscriber'), '0', $helptext3, false]; $action = 'follow_confirm'; @@ -161,7 +161,7 @@ class Introductions extends BaseNotifications $header .= ' (' . ContactSelector::networkToName($Introduction->getNetwork(), $Introduction->getUrl()) . ')'; if ($Introduction->getNetwork() != Protocol::DIASPORA) { - $discard = $this->l10n->t('Discard'); + $discard = $this->t('Discard'); } else { $discard = ''; } @@ -169,7 +169,7 @@ class Introductions extends BaseNotifications $notificationContent[] = Renderer::replaceMacros($notificationTemplate, [ '$type' => $Introduction->getLabel(), '$header' => $header, - '$str_notification_type' => $this->l10n->t('Notification type:'), + '$str_notification_type' => $this->t('Notification type:'), '$str_type' => $Introduction->getType(), '$dfrn_id' => $Introduction->getDfrnId(), '$uid' => $Introduction->getUid(), @@ -178,26 +178,26 @@ class Introductions extends BaseNotifications '$photo' => $Introduction->getPhoto(), '$fullname' => $Introduction->getName(), '$location' => $Introduction->getLocation(), - '$lbl_location' => $this->l10n->t('Location:'), + '$lbl_location' => $this->t('Location:'), '$about' => $Introduction->getAbout(), - '$lbl_about' => $this->l10n->t('About:'), + '$lbl_about' => $this->t('About:'), '$keywords' => $Introduction->getKeywords(), - '$lbl_keywords' => $this->l10n->t('Tags:'), - '$hidden' => ['hidden', $this->l10n->t('Hide this contact from others'), $Introduction->isHidden(), ''], + '$lbl_keywords' => $this->t('Tags:'), + '$hidden' => ['hidden', $this->t('Hide this contact from others'), $Introduction->isHidden(), ''], '$lbl_connection_type' => $helptext, '$friend' => $friend, '$follower' => $follower, '$url' => $Introduction->getUrl(), '$zrl' => $Introduction->getZrl(), - '$lbl_url' => $this->l10n->t('Profile URL'), + '$lbl_url' => $this->t('Profile URL'), '$addr' => $Introduction->getAddr(), '$lbl_knowyou' => $lbl_knowyou, - '$lbl_network' => $this->l10n->t('Network:'), + '$lbl_network' => $this->t('Network:'), '$network' => ContactSelector::networkToName($Introduction->getNetwork(), $Introduction->getUrl()), '$knowyou' => $knowyou, - '$approve' => $this->l10n->t('Approve'), + '$approve' => $this->t('Approve'), '$note' => $Introduction->getNote(), - '$ignore' => $this->l10n->t('Ignore'), + '$ignore' => $this->t('Ignore'), '$discard' => $discard, '$action' => $action, '$is_mobile' => $this->mode->isMobile(), @@ -207,8 +207,8 @@ class Introductions extends BaseNotifications } if (count($notifications['notifications']) == 0) { - notice($this->l10n->t('No introductions.')); - $notificationNoContent = $this->l10n->t('No more %s notifications.', $notifications['ident']); + notice($this->t('No introductions.')); + $notificationNoContent = $this->t('No more %s notifications.', $notifications['ident']); } return $this->printContent($notificationHeader, $notificationContent, $notificationNoContent, $notificationShowLink); diff --git a/src/Module/Notifications/Notifications.php b/src/Module/Notifications/Notifications.php index 949cd683f..269acb79d 100644 --- a/src/Module/Notifications/Notifications.php +++ b/src/Module/Notifications/Notifications.php @@ -63,25 +63,25 @@ class Notifications extends BaseNotifications $factory = $this->formattedNotificationFactory; if (($this->args->get(1) == 'network')) { - $notificationHeader = $this->l10n->t('Network Notifications'); + $notificationHeader = $this->t('Network Notifications'); $notifications = [ 'ident' => FormattedNotification::NETWORK, 'notifications' => $factory->getNetworkList($this->showAll, $this->firstItemNum, self::ITEMS_PER_PAGE), ]; } elseif (($this->args->get(1) == 'system')) { - $notificationHeader = $this->l10n->t('System Notifications'); + $notificationHeader = $this->t('System Notifications'); $notifications = [ 'ident' => FormattedNotification::SYSTEM, 'notifications' => $factory->getSystemList($this->showAll, $this->firstItemNum, self::ITEMS_PER_PAGE), ]; } elseif (($this->args->get(1) == 'personal')) { - $notificationHeader = $this->l10n->t('Personal Notifications'); + $notificationHeader = $this->t('Personal Notifications'); $notifications = [ 'ident' => FormattedNotification::PERSONAL, 'notifications' => $factory->getPersonalList($this->showAll, $this->firstItemNum, self::ITEMS_PER_PAGE), ]; } elseif (($this->args->get(1) == 'home')) { - $notificationHeader = $this->l10n->t('Home Notifications'); + $notificationHeader = $this->t('Home Notifications'); $notifications = [ 'ident' => FormattedNotification::HOME, 'notifications' => $factory->getHomeList($this->showAll, $this->firstItemNum, self::ITEMS_PER_PAGE), @@ -132,12 +132,12 @@ class Notifications extends BaseNotifications ]); } } else { - $notificationNoContent = $this->l10n->t('No more %s notifications.', $notificationResult['ident']); + $notificationNoContent = $this->t('No more %s notifications.', $notificationResult['ident']); } $notificationShowLink = [ 'href' => ($this->showAll ? 'notifications/' . $notifications['ident'] : 'notifications/' . $notifications['ident'] . '?show=all'), - 'text' => ($this->showAll ? $this->l10n->t('Show unread') : $this->l10n->t('Show all')), + 'text' => ($this->showAll ? $this->t('Show unread') : $this->t('Show all')), ]; return $this->printContent($notificationHeader, $notificationContent, $notificationNoContent, $notificationShowLink); diff --git a/src/Module/RemoteFollow.php b/src/Module/RemoteFollow.php index 171ea5530..bc42998e3 100644 --- a/src/Module/RemoteFollow.php +++ b/src/Module/RemoteFollow.php @@ -55,7 +55,7 @@ class RemoteFollow extends BaseModule $this->owner = User::getOwnerDataByNick($this->parameters['profile']); if (!$this->owner) { - throw new HTTPException\NotFoundException($this->l10n->t('User not found.')); + throw new HTTPException\NotFoundException($this->t('User not found.')); } $this->baseUrl = $baseUrl; @@ -69,25 +69,25 @@ class RemoteFollow extends BaseModule } if (empty($this->owner)) { - notice($this->l10n->t('Profile unavailable.')); + notice($this->t('Profile unavailable.')); return; } $url = Probe::cleanURI($_POST['dfrn_url']); if (!strlen($url)) { - notice($this->l10n->t("Invalid locator")); + notice($this->t("Invalid locator")); return; } // Detect the network, make sure the provided URL is valid $data = Contact::getByURL($url); if (!$data) { - notice($this->l10n->t("The provided profile link doesn't seem to be valid")); + notice($this->t("The provided profile link doesn't seem to be valid")); return; } if (empty($data['subscribe'])) { - notice($this->l10n->t("Remote subscription can't be done for your network. Please subscribe directly on your system.")); + notice($this->t("Remote subscription can't be done for your network. Please subscribe directly on your system.")); return; } @@ -119,13 +119,13 @@ class RemoteFollow extends BaseModule $tpl = Renderer::getMarkupTemplate('auto_request.tpl'); $o = Renderer::replaceMacros($tpl, [ - '$header' => $this->l10n->t('Friend/Connection Request'), - '$page_desc' => $this->l10n->t('Enter your Webfinger address (user@domain.tld) or profile URL here. If this isn\'t supported by your system, you have to subscribe to %s or %s directly on your system.', $target_addr, $target_url), - '$invite_desc' => $this->l10n->t('If you are not yet a member of the free social web, follow this link to find a public Friendica node and join us today.', Search::getGlobalDirectory() . '/servers'), - '$your_address' => $this->l10n->t('Your Webfinger address or profile URL:'), - '$pls_answer' => $this->l10n->t('Please answer the following:'), - '$submit' => $this->l10n->t('Submit Request'), - '$cancel' => $this->l10n->t('Cancel'), + '$header' => $this->t('Friend/Connection Request'), + '$page_desc' => $this->t('Enter your Webfinger address (user@domain.tld) or profile URL here. If this isn\'t supported by your system, you have to subscribe to %s or %s directly on your system.', $target_addr, $target_url), + '$invite_desc' => $this->t('If you are not yet a member of the free social web, follow this link to find a public Friendica node and join us today.', Search::getGlobalDirectory() . '/servers'), + '$your_address' => $this->t('Your Webfinger address or profile URL:'), + '$pls_answer' => $this->t('Please answer the following:'), + '$submit' => $this->t('Submit Request'), + '$cancel' => $this->t('Cancel'), '$request' => 'remote_follow/' . $this->parameters['profile'], '$name' => $this->owner['name'], diff --git a/src/Module/Search/Saved.php b/src/Module/Search/Saved.php index 6fdb16171..c94183367 100644 --- a/src/Module/Search/Saved.php +++ b/src/Module/Search/Saved.php @@ -59,16 +59,16 @@ class Saved extends BaseModule $fields = ['uid' => local_user(), 'term' => $search]; if (!$this->dba->exists('search', $fields)) { if (!$this->dba->insert('search', $fields)) { - notice($this->l10n->t('Search term was not saved.')); + notice($this->t('Search term was not saved.')); } } else { - notice($this->l10n->t('Search term already saved.')); + notice($this->t('Search term already saved.')); } break; case 'remove': if (!$this->dba->delete('search', ['uid' => local_user(), 'term' => $search])) { - notice($this->l10n->t('Search term was not removed.')); + notice($this->t('Search term was not removed.')); } break; } diff --git a/src/Module/Security/Logout.php b/src/Module/Security/Logout.php index 4d6f7f429..61b32c28b 100644 --- a/src/Module/Security/Logout.php +++ b/src/Module/Security/Logout.php @@ -84,7 +84,7 @@ class Logout extends BaseModule if ($visitor_home) { System::externalRedirect($visitor_home); } else { - info($this->l10n->t('Logged out.')); + info($this->t('Logged out.')); $this->baseUrl->redirect(); } } diff --git a/src/Module/Security/TwoFactor/Recovery.php b/src/Module/Security/TwoFactor/Recovery.php index 69a76cf40..60de6e404 100644 --- a/src/Module/Security/TwoFactor/Recovery.php +++ b/src/Module/Security/TwoFactor/Recovery.php @@ -70,11 +70,11 @@ class Recovery extends BaseModule if (RecoveryCode::existsForUser(local_user(), $recovery_code)) { RecoveryCode::markUsedForUser(local_user(), $recovery_code); $this->session->set('2fa', true); - info($this->l10n->t('Remaining recovery codes: %d', RecoveryCode::countValidForUser(local_user()))); + info($this->t('Remaining recovery codes: %d', RecoveryCode::countValidForUser(local_user()))); $this->auth->setForUser($this->app, User::getById($this->app->getLoggedInUserId()), true, true); } else { - notice($this->l10n->t('Invalid code, please retry.')); + notice($this->t('Invalid code, please retry.')); } } } @@ -93,11 +93,11 @@ class Recovery extends BaseModule return Renderer::replaceMacros(Renderer::getMarkupTemplate('twofactor/recovery.tpl'), [ '$form_security_token' => self::getFormSecurityToken('twofactor_recovery'), - '$title' => $this->l10n->t('Two-factor recovery'), - '$message' => $this->l10n->t('

You can enter one of your one-time recovery codes in case you lost access to your mobile device.

'), - '$recovery_message' => $this->l10n->t('Don’t have your phone? Enter a two-factor recovery code', '2fa/recovery'), - '$recovery_code' => ['recovery_code', $this->l10n->t('Please enter a recovery code'), '', '', '', 'placeholder="000000-000000"'], - '$recovery_label' => $this->l10n->t('Submit recovery code and complete login'), + '$title' => $this->t('Two-factor recovery'), + '$message' => $this->t('

You can enter one of your one-time recovery codes in case you lost access to your mobile device.

'), + '$recovery_message' => $this->t('Don’t have your phone? Enter a two-factor recovery code', '2fa/recovery'), + '$recovery_code' => ['recovery_code', $this->t('Please enter a recovery code'), '', '', '', 'placeholder="000000-000000"'], + '$recovery_label' => $this->t('Submit recovery code and complete login'), ]); } } diff --git a/src/Module/Settings/TwoFactor/AppSpecific.php b/src/Module/Settings/TwoFactor/AppSpecific.php index 0c4766300..21db4f8ab 100644 --- a/src/Module/Settings/TwoFactor/AppSpecific.php +++ b/src/Module/Settings/TwoFactor/AppSpecific.php @@ -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('

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.

'), - '$generated_message' => $this->l10n->t('Make sure to copy your new app-specific password now. You won’t be able to see it again!'), + '$title' => $this->t('Two-factor app-specific passwords'), + '$help_label' => $this->t('Help'), + '$message' => $this->t('

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.

'), + '$generated_message' => $this->t('Make sure to copy your new app-specific password now. You won’t 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'), ]); } } diff --git a/src/Module/Settings/TwoFactor/Recovery.php b/src/Module/Settings/TwoFactor/Recovery.php index 6ef6a8d8c..961c2cd90 100644 --- a/src/Module/Settings/TwoFactor/Recovery.php +++ b/src/Module/Settings/TwoFactor/Recovery.php @@ -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('

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.

Put these in a safe spot! If you lose your device and don’t have the recovery codes you will lose access to your account.

'), + '$title' => $this->t('Two-factor recovery codes'), + '$help_label' => $this->t('Help'), + '$message' => $this->t('

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.

Put these in a safe spot! If you lose your device and don’t have the recovery codes you will lose access to your account.

'), '$recovery_codes' => $recoveryCodes, - '$regenerate_message' => $this->l10n->t('When you generate new recovery codes, you must copy the new codes. Your old codes won’t 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 won’t 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'), ]); } } diff --git a/src/Module/Settings/TwoFactor/Trusted.php b/src/Module/Settings/TwoFactor/Trusted.php index 7ea001c94..e38d64ac0 100644 --- a/src/Module/Settings/TwoFactor/Trusted.php +++ b/src/Module/Settings/TwoFactor/Trusted.php @@ -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, ]); diff --git a/src/Module/Settings/TwoFactor/Verify.php b/src/Module/Settings/TwoFactor/Verify.php index 35dc61698..93fdde920 100644 --- a/src/Module/Settings/TwoFactor/Verify.php +++ b/src/Module/Settings/TwoFactor/Verify.php @@ -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('

Or you can submit the authentication settings manually:

+ $manual_message = $this->t('

Or you can submit the authentication settings manually:

Issuer
%s
@@ -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('

Please scan this QR Code with your authenticator app and submit the provided code.

'), + '$title' => $this->t('Two-factor code verification'), + '$help_label' => $this->t('Help'), + '$message' => $this->t('

Please scan this QR Code with your authenticator app and submit the provided code.

'), '$qrcode_image' => $qrcode_image, - '$qrcode_url_message' => $this->l10n->t('

Or you can open the following URL in your mobile device:

%s

', $otpauthUrl, $shortOtpauthUrl), + '$qrcode_url_message' => $this->t('

Or you can open the following URL in your mobile device:

%s

', $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'), ]); } } diff --git a/src/Module/Tos.php b/src/Module/Tos.php index df2fbfb18..1b7162753 100644 --- a/src/Module/Tos.php +++ b/src/Module/Tos.php @@ -55,12 +55,12 @@ class Tos extends BaseModule $this->config = $config; $this->baseUrl = $baseUrl; - $this->privacy_operate = $this->l10n->t('At the time of registration, and for providing communications between the user account and their contacts, the user has to provide a display name (pen name), an username (nickname) and a working email address. The names will be accessible on the profile page of the account by any visitor of the page, even if other profile details are not displayed. The email address will only be used to send the user notifications about interactions, but wont be visibly displayed. The listing of an account in the node\'s user directory or the global user directory is optional and can be controlled in the user settings, it is not necessary for communication.'); - $this->privacy_distribute = $this->l10n->t('This data is required for communication and is passed on to the nodes of the communication partners and is stored there. Users can enter additional private data that may be transmitted to the communication partners accounts.'); - $this->privacy_delete = $this->l10n->t('At any point in time a logged in user can export their account data from the account settings. If the user wants to delete their account they can do so at %1$s/removeme. The deletion of the account will be permanent. Deletion of the data will also be requested from the nodes of the communication partners.', $this->baseUrl); + $this->privacy_operate = $this->t('At the time of registration, and for providing communications between the user account and their contacts, the user has to provide a display name (pen name), an username (nickname) and a working email address. The names will be accessible on the profile page of the account by any visitor of the page, even if other profile details are not displayed. The email address will only be used to send the user notifications about interactions, but wont be visibly displayed. The listing of an account in the node\'s user directory or the global user directory is optional and can be controlled in the user settings, it is not necessary for communication.'); + $this->privacy_distribute = $this->t('This data is required for communication and is passed on to the nodes of the communication partners and is stored there. Users can enter additional private data that may be transmitted to the communication partners accounts.'); + $this->privacy_delete = $this->t('At any point in time a logged in user can export their account data from the account settings. If the user wants to delete their account they can do so at %1$s/removeme. The deletion of the account will be permanent. Deletion of the data will also be requested from the nodes of the communication partners.', $this->baseUrl); // In some cases we don't need every single one of the above separate, but all in one block. // So here is an array to look over - $this->privacy_complete = [$this->l10n->t('Privacy Statement'), $this->privacy_operate, + $this->privacy_complete = [$this->t('Privacy Statement'), $this->privacy_operate, $this->privacy_distribute, $this->privacy_delete]; } @@ -85,13 +85,13 @@ class Tos extends BaseModule $tpl = Renderer::getMarkupTemplate('tos.tpl'); if ($this->config->get('system', 'tosdisplay')) { return Renderer::replaceMacros($tpl, [ - '$title' => $this->l10n->t('Terms of Service'), + '$title' => $this->t('Terms of Service'), '$tostext' => BBCode::convert($this->config->get('system', 'tostext')), '$displayprivstatement' => $this->config->get('system', 'tosprivstatement'), - '$privstatementtitle' => $this->l10n->t('Privacy Statement'), - '$privacy_operate' => $this->l10n->t('At the time of registration, and for providing communications between the user account and their contacts, the user has to provide a display name (pen name), an username (nickname) and a working email address. The names will be accessible on the profile page of the account by any visitor of the page, even if other profile details are not displayed. The email address will only be used to send the user notifications about interactions, but wont be visibly displayed. The listing of an account in the node\'s user directory or the global user directory is optional and can be controlled in the user settings, it is not necessary for communication.'), - '$privacy_distribute' => $this->l10n->t('This data is required for communication and is passed on to the nodes of the communication partners and is stored there. Users can enter additional private data that may be transmitted to the communication partners accounts.'), - '$privacy_delete' => $this->l10n->t('At any point in time a logged in user can export their account data from the account settings. If the user wants to delete their account they can do so at %1$s/removeme. The deletion of the account will be permanent. Deletion of the data will also be requested from the nodes of the communication partners.', $this->baseUrl) + '$privstatementtitle' => $this->t('Privacy Statement'), + '$privacy_operate' => $this->t('At the time of registration, and for providing communications between the user account and their contacts, the user has to provide a display name (pen name), an username (nickname) and a working email address. The names will be accessible on the profile page of the account by any visitor of the page, even if other profile details are not displayed. The email address will only be used to send the user notifications about interactions, but wont be visibly displayed. The listing of an account in the node\'s user directory or the global user directory is optional and can be controlled in the user settings, it is not necessary for communication.'), + '$privacy_distribute' => $this->t('This data is required for communication and is passed on to the nodes of the communication partners and is stored there. Users can enter additional private data that may be transmitted to the communication partners accounts.'), + '$privacy_delete' => $this->t('At any point in time a logged in user can export their account data from the account settings. If the user wants to delete their account they can do so at %1$s/removeme. The deletion of the account will be permanent. Deletion of the data will also be requested from the nodes of the communication partners.', $this->baseUrl) ]); } else { return '';