1
0
Fork 0

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

This commit is contained in:
Philipp Holzer 2020-01-18 20:53:01 +01:00
parent 5dfee31108
commit a9a36fb302
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
20 changed files with 42 additions and 42 deletions

View file

@ -78,9 +78,9 @@ Then run `bin/console po2php view/lang/<language>/messages.po` to update the rel
### Plural
- `Friendica\Core\L10n::tt('Label', 'Labels', 1)` => `Label`
- `Friendica\Core\L10n::tt('Label', 'Labels', 3)` => `Labels`
- `Friendica\Core\L10n::tt('%d Label', '%d Labels', 1)` => `1 Label`
- `Friendica\Core\L10n::tt('%d Label', '%d Labels', 3)` => `3 Labels`
- `Friendica\Core\L10n::tt('%d Label', 'Labels %2%s %3%s', 1, 'test', 'test2')` => `Label test test2`
- `Friendica\Core\L10n::tt('%d Label', 'Labels %2%s %3%s', 3, 'test', 'test2')` => `Labels test test2`
- `Friendica\Core\DI::l10n()->tt('Label', 'Labels', 1)` => `Label`
- `Friendica\Core\DI::l10n()->tt('Label', 'Labels', 3)` => `Labels`
- `Friendica\Core\DI::l10n()->tt('%d Label', '%d Labels', 1)` => `1 Label`
- `Friendica\Core\DI::l10n()->tt('%d Label', '%d Labels', 3)` => `3 Labels`
- `Friendica\Core\DI::l10n()->tt('%d Label', 'Labels %2%s %3%s', 1, 'test', 'test2')` => `Label test test2`
- `Friendica\Core\DI::l10n()->tt('%d Label', 'Labels %2%s %3%s', 3, 'test', 'test2')` => `Labels test test2`

View file

@ -1107,7 +1107,7 @@ function api_statuses_update($type)
if ($posts_day > $throttle_day) {
Logger::log('Daily posting limit reached for user '.api_user(), Logger::DEBUG);
// die(api_error($type, DI::l10n()->t("Daily posting limit of %d posts reached. The post was rejected.", $throttle_day));
throw new TooManyRequestsException(L10n::tt("Daily posting limit of %d post reached. The post was rejected.", "Daily posting limit of %d posts reached. The post was rejected.", $throttle_day));
throw new TooManyRequestsException(DI::l10n()->tt("Daily posting limit of %d post reached. The post was rejected.", "Daily posting limit of %d posts reached. The post was rejected.", $throttle_day));
}
}
@ -1121,7 +1121,7 @@ function api_statuses_update($type)
if ($posts_week > $throttle_week) {
Logger::log('Weekly posting limit reached for user '.api_user(), Logger::DEBUG);
// die(api_error($type, DI::l10n()->t("Weekly posting limit of %d posts reached. The post was rejected.", $throttle_week)));
throw new TooManyRequestsException(L10n::tt("Weekly posting limit of %d post reached. The post was rejected.", "Weekly posting limit of %d posts reached. The post was rejected.", $throttle_week));
throw new TooManyRequestsException(DI::l10n()->tt("Weekly posting limit of %d post reached. The post was rejected.", "Weekly posting limit of %d posts reached. The post was rejected.", $throttle_week));
}
}

View file

@ -1581,19 +1581,19 @@ function get_response_button_text($v, $count)
$return = '';
switch ($v) {
case 'like':
$return = L10n::tt('Like', 'Likes', $count);
$return = DI::l10n()->tt('Like', 'Likes', $count);
break;
case 'dislike':
$return = L10n::tt('Dislike', 'Dislikes', $count);
$return = DI::l10n()->tt('Dislike', 'Dislikes', $count);
break;
case 'attendyes':
$return = L10n::tt('Attending', 'Attending', $count);
$return = DI::l10n()->tt('Attending', 'Attending', $count);
break;
case 'attendno':
$return = L10n::tt('Not Attending', 'Not Attending', $count);
$return = DI::l10n()->tt('Not Attending', 'Not Attending', $count);
break;
case 'attendmaybe':
$return = L10n::tt('Undecided', 'Undecided', $count);
$return = DI::l10n()->tt('Undecided', 'Undecided', $count);
break;
}

View file

@ -128,7 +128,7 @@ function dfrn_request_post(App $a)
}
$invalid = Probe::validDfrn($parms);
if ($invalid) {
notice(L10n::tt("%d required parameter was not found at the given location", "%d required parameters were not found at the given location", $invalid) . EOL);
notice(DI::l10n()->tt("%d required parameter was not found at the given location", "%d required parameters were not found at the given location", $invalid) . EOL);
return;
}
}
@ -366,7 +366,7 @@ function dfrn_request_post(App $a)
}
$invalid = Probe::validDfrn($parms);
if ($invalid) {
notice(L10n::tt("%d required parameter was not found at the given location", "%d required parameters were not found at the given location", $invalid) . EOL);
notice(DI::l10n()->tt("%d required parameter was not found at the given location", "%d required parameters were not found at the given location", $invalid) . EOL);
return;
}

View file

@ -539,7 +539,7 @@ function render_messages(array $msg, $t)
'$date' => DateTimeFormat::local($rr['mailcreated'], DI::l10n()->t('D, d M Y - g:i A')),
'$ago' => Temporal::getRelativeDate($rr['mailcreated']),
'$seen' => $rr['mailseen'],
'$count' => L10n::tt('%d message', '%d messages', $rr['count']),
'$count' => DI::l10n()->tt('%d message', '%d messages', $rr['count']),
]);
}

View file

@ -491,7 +491,7 @@ function networkThreadedView(App $a, $update, $parent)
$o .= $tabs;
if ($gid && ($t = Contact::getOStatusCountByGroupId($gid)) && !DI::pConfig()->get(local_user(), 'system', 'nowarn_insecure')) {
notice(L10n::tt("Warning: This group contains %s member from a network that doesn't allow non public messages.",
notice(DI::l10n()->tt("Warning: This group contains %s member from a network that doesn't allow non public messages.",
"Warning: This group contains %s members from a network that doesn't allow non public messages.",
$t) . EOL);
notice(DI::l10n()->t("Messages in this group won't be send to these receivers.").EOL);

View file

@ -53,7 +53,7 @@ class Widget
$x = intval(DI::pConfig()->get(local_user(), 'system', 'invites_remaining'));
if ($x || is_site_admin()) {
DI::page()['aside'] .= '<div class="side-link widget" id="side-invite-remain">'
. L10n::tt('%d invitation available', '%d invitations available', $x)
. DI::l10n()->tt('%d invitation available', '%d invitations available', $x)
. '</div>';
}
}
@ -398,7 +398,7 @@ class Widget
$tpl = Renderer::getMarkupTemplate('widget/remote_friends_common.tpl');
return Renderer::replaceMacros($tpl, [
'$desc' => L10n::tt("%d contact in common", "%d contacts in common", $t),
'$desc' => DI::l10n()->tt("%d contact in common", "%d contacts in common", $t),
'$base' => DI::baseUrl(),
'$uid' => $profile_uid,
'$cid' => (($cid) ? $cid : '0'),

View file

@ -87,7 +87,7 @@ class ContactBlock
$contacts_stmt = DBA::select('contact', ['id', 'uid', 'addr', 'url', 'name', 'thumb', 'network'], ['id' => $contact_ids]);
if (DBA::isResult($contacts_stmt)) {
$contacts_title = L10n::tt('%d Contact', '%d Contacts', $total);
$contacts_title = DI::l10n()->tt('%d Contact', '%d Contacts', $total);
$micropro = [];
while ($contact = DBA::fetch($contacts_stmt)) {

View file

@ -29,7 +29,7 @@ class TrendingTags
$tpl = Renderer::getMarkupTemplate('widget/trending_tags.tpl');
$o = Renderer::replaceMacros($tpl, [
'$title' => L10n::tt('Trending Tags (last %d hour)', 'Trending Tags (last %d hours)', $period),
'$title' => DI::l10n()->tt('Trending Tags (last %d hour)', 'Trending Tags (last %d hours)', $period),
'$more' => DI::l10n()->t('More Trending Tags'),
'$tags' => $tags,
]);

View file

@ -67,8 +67,8 @@ class L10n
* is performed using the count as parameter.
*
* Usages:
* - L10n::tt('Like', 'Likes', $count)
* - L10n::tt("%s user deleted", "%s users deleted", count($users))
* - DI::l10n()->tt('Like', 'Likes', $count)
* - DI::l10n()->tt("%s user deleted", "%s users deleted", count($users))
*
* @param string $singular
* @param string $plural

View file

@ -254,8 +254,8 @@ class L10n
* is performed using the count as parameter.
*
* Usages:
* - L10n::tt('Like', 'Likes', $count)
* - L10n::tt("%s user deleted", "%s users deleted", count($users))
* - DI::l10n()->tt('Like', 'Likes', $count)
* - DI::l10n()->tt("%s user deleted", "%s users deleted", count($users))
*
* @param string $singular
* @param string $plural

View file

@ -216,7 +216,7 @@ class UserImport
}
}
if ($errorcount > 0) {
notice(L10n::tt("%d contact not imported", "%d contacts not imported", $errorcount));
notice(DI::l10n()->tt("%d contact not imported", "%d contacts not imported", $errorcount));
}
foreach ($account['group'] as &$group) {

View file

@ -667,11 +667,11 @@ class User
}
if (mb_strlen($username) < $username_min_length) {
throw new Exception(L10n::tt('Username should be at least %s character.', 'Username should be at least %s characters.', $username_min_length));
throw new Exception(DI::l10n()->tt('Username should be at least %s character.', 'Username should be at least %s characters.', $username_min_length));
}
if (mb_strlen($username) > $username_max_length) {
throw new Exception(L10n::tt('Username should be at most %s character.', 'Username should be at most %s characters.', $username_max_length));
throw new Exception(DI::l10n()->tt('Username should be at most %s character.', 'Username should be at most %s characters.', $username_max_length));
}
// So now we are just looking for a space in the full name.

View file

@ -36,7 +36,7 @@ class Contact extends BaseAdminModule
foreach ($contacts as $uid) {
Model\Contact::unblock($uid);
}
notice(L10n::tt('%s contact unblocked', '%s contacts unblocked', count($contacts)));
notice(DI::l10n()->tt('%s contact unblocked', '%s contacts unblocked', count($contacts)));
}
DI::baseUrl()->redirect('admin/blocklist/contact');
@ -77,7 +77,7 @@ class Contact extends BaseAdminModule
'$baseurl' => DI::baseUrl()->get(true),
'$contacts' => $contacts,
'$total_contacts' => L10n::tt('%s total blocked contact', '%s total blocked contacts', $total),
'$total_contacts' => DI::l10n()->tt('%s total blocked contact', '%s total blocked contacts', $total),
'$paginate' => $pager->renderFull($total),
'$contacturl' => ['contact_url', DI::l10n()->t('Profile URL'), '', DI::l10n()->t('URL of the remote contact to block.')],
'$contact_block_reason' => ['contact_block_reason', DI::l10n()->t('Block Reason')],

View file

@ -92,13 +92,13 @@ class Users extends BaseAdminModule
if (!empty($_POST['page_users_block'])) {
// @TODO Move this to Model\User:block($users);
DBA::update('user', ['blocked' => 1], ['uid' => $users]);
notice(L10n::tt('%s user blocked', '%s users blocked', count($users)));
notice(DI::l10n()->tt('%s user blocked', '%s users blocked', count($users)));
}
if (!empty($_POST['page_users_unblock'])) {
// @TODO Move this to Model\User:unblock($users);
DBA::update('user', ['blocked' => 0], ['uid' => $users]);
notice(L10n::tt('%s user unblocked', '%s users unblocked', count($users)));
notice(DI::l10n()->tt('%s user unblocked', '%s users unblocked', count($users)));
}
if (!empty($_POST['page_users_delete'])) {
@ -110,7 +110,7 @@ class Users extends BaseAdminModule
}
}
notice(L10n::tt('%s user deleted', '%s users deleted', count($users)));
notice(DI::l10n()->tt('%s user deleted', '%s users deleted', count($users)));
}
if (!empty($_POST['page_users_approve'])) {

View file

@ -67,7 +67,7 @@ class Contact extends BaseModule
}
}
if ($count_actions > 0) {
info(L10n::tt('%d contact edited.', '%d contacts edited.', $count_actions));
info(DI::l10n()->tt('%d contact edited.', '%d contacts edited.', $count_actions));
}
DI::baseUrl()->redirect('contact');

View file

@ -101,7 +101,7 @@ class Invite extends BaseModule
}
}
notice(L10n::tt('%d message sent.', '%d messages sent.', $total) . EOL);
notice(DI::l10n()->tt('%d message sent.', '%d messages sent.', $total) . EOL);
}
public static function content(array $parameters = [])

View file

@ -110,11 +110,11 @@ class Contacts extends BaseModule
DBA::close($contacts_stmt);
switch ($type) {
case 'followers': $title = L10n::tt('Follower (%s)', 'Followers (%s)', $total); break;
case 'following': $title = L10n::tt('Following (%s)', 'Following (%s)', $total); break;
case 'mutuals': $title = L10n::tt('Mutual friend (%s)', 'Mutual friends (%s)', $total); break;
case 'followers': $title = DI::l10n()->tt('Follower (%s)', 'Followers (%s)', $total); break;
case 'following': $title = DI::l10n()->tt('Following (%s)', 'Following (%s)', $total); break;
case 'mutuals': $title = DI::l10n()->tt('Mutual friend (%s)', 'Mutual friends (%s)', $total); break;
case 'all': default: $title = L10n::tt('Contact (%s)', 'Contacts (%s)', $total); break;
case 'all': default: $title = DI::l10n()->tt('Contact (%s)', 'Contacts (%s)', $total); break;
}
$tpl = Renderer::getMarkupTemplate('profile/contacts.tpl');

View file

@ -61,7 +61,7 @@ class Verify extends BaseModule
'$title' => DI::l10n()->t('Two-factor authentication'),
'$message' => DI::l10n()->t('<p>Open the two-factor authentication app on your device to get an authentication code and verify your identity.</p>'),
'$errors_label' => L10n::tt('Error', 'Errors', count(self::$errors)),
'$errors_label' => DI::l10n()->tt('Error', 'Errors', count(self::$errors)),
'$errors' => self::$errors,
'$recovery_message' => DI::l10n()->t('Dont have your phone? <a href="%s">Enter a two-factor recovery code</a>', '2fa/recovery'),
'$verify_code' => ['verify_code', DI::l10n()->t('Please enter a code from your authentication app'), '', '', 'required', 'autofocus placeholder="000000"', 'tel'],

View file

@ -480,7 +480,7 @@ class Post
// Collapse
if (($nb_children > 2) || ($thread_level > 1)) {
$result['children'][0]['comment_firstcollapsed'] = true;
$result['children'][0]['num_comments'] = L10n::tt('%d comment', '%d comments', $total_children);
$result['children'][0]['num_comments'] = DI::l10n()->tt('%d comment', '%d comments', $total_children);
$result['children'][0]['show_text'] = DI::l10n()->t('Show more');
$result['children'][0]['hide_text'] = DI::l10n()->t('Show fewer');
if ($thread_level > 1) {
@ -493,7 +493,7 @@ class Post
if ($this->isToplevel()) {
$result['total_comments_num'] = "$total_children";
$result['total_comments_text'] = L10n::tt('comment', 'comments', $total_children);
$result['total_comments_text'] = DI::l10n()->tt('comment', 'comments', $total_children);
}
$result['private'] = $item['private'];