Updat tt() calls
update function calls for tt()
This commit is contained in:
parent
d49f986d1e
commit
3b0f69599e
|
@ -7,6 +7,7 @@ use Friendica\Content\ContactSelector;
|
||||||
use Friendica\Content\Feature;
|
use Friendica\Content\Feature;
|
||||||
use Friendica\Core\Addon;
|
use Friendica\Core\Addon;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\PConfig;
|
use Friendica\Core\PConfig;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
|
@ -1668,19 +1669,19 @@ function get_response_button_text($v, $count)
|
||||||
{
|
{
|
||||||
switch ($v) {
|
switch ($v) {
|
||||||
case 'like':
|
case 'like':
|
||||||
$return = tt('Like', 'Likes', $count);
|
$return = L10n::tt('Like', 'Likes', $count);
|
||||||
break;
|
break;
|
||||||
case 'dislike':
|
case 'dislike':
|
||||||
$return = tt('Dislike', 'Dislikes', $count);
|
$return = L10n::tt('Dislike', 'Dislikes', $count);
|
||||||
break;
|
break;
|
||||||
case 'attendyes':
|
case 'attendyes':
|
||||||
$return = tt('Attending', 'Attending', $count);
|
$return = L10n::tt('Attending', 'Attending', $count);
|
||||||
break;
|
break;
|
||||||
case 'attendno':
|
case 'attendno':
|
||||||
$return = tt('Not Attending', 'Not Attending', $count);
|
$return = L10n::tt('Not Attending', 'Not Attending', $count);
|
||||||
break;
|
break;
|
||||||
case 'attendmaybe':
|
case 'attendmaybe':
|
||||||
$return = tt('Undecided', 'Undecided', $count);
|
$return = L10n::tt('Undecided', 'Undecided', $count);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -952,10 +952,10 @@ function contact_block() {
|
||||||
dbesc(implode(",", $contacts)));
|
dbesc(implode(",", $contacts)));
|
||||||
|
|
||||||
if (DBM::is_result($r)) {
|
if (DBM::is_result($r)) {
|
||||||
$contacts = sprintf(tt('%d Contact','%d Contacts', $total),$total);
|
$contacts = sprintf(L10n::tt('%d Contact', '%d Contacts', $total), $total);
|
||||||
$micropro = [];
|
$micropro = [];
|
||||||
foreach ($r as $rr) {
|
foreach ($r as $rr) {
|
||||||
$micropro[] = micropro($rr,true,'mpfriend');
|
$micropro[] = micropro($rr, true, 'mpfriend');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -387,7 +387,7 @@ function admin_page_contactblock_post(App $a)
|
||||||
foreach ($contacts as $uid) {
|
foreach ($contacts as $uid) {
|
||||||
Contact::unblock($uid);
|
Contact::unblock($uid);
|
||||||
}
|
}
|
||||||
notice(tt("%s contact unblocked", "%s contacts unblocked", count($contacts)));
|
notice(L10n::tt("%s contact unblocked", "%s contacts unblocked", count($contacts)));
|
||||||
}
|
}
|
||||||
goaway('admin/contactblock');
|
goaway('admin/contactblock');
|
||||||
return; // NOTREACHED
|
return; // NOTREACHED
|
||||||
|
@ -435,7 +435,7 @@ function admin_page_contactblock(App $a)
|
||||||
'$baseurl' => System::baseUrl(true),
|
'$baseurl' => System::baseUrl(true),
|
||||||
|
|
||||||
'$contacts' => $contacts,
|
'$contacts' => $contacts,
|
||||||
'$total_contacts' => tt('%s total blocked contact', '%s total blocked contacts', $total),
|
'$total_contacts' => L10n::tt('%s total blocked contact', '%s total blocked contacts', $total),
|
||||||
'$paginate' => paginate($a),
|
'$paginate' => paginate($a),
|
||||||
'$contacturl' => ['contact_url', L10n::t("Profile URL"), '', L10n::t("URL of the remote contact to block.")],
|
'$contacturl' => ['contact_url', L10n::t("Profile URL"), '', L10n::t("URL of the remote contact to block.")],
|
||||||
]);
|
]);
|
||||||
|
@ -1516,13 +1516,13 @@ function admin_page_users_post(App $a)
|
||||||
q("UPDATE `user` SET `blocked` = 1-`blocked` WHERE `uid` = %s", intval($uid)
|
q("UPDATE `user` SET `blocked` = 1-`blocked` WHERE `uid` = %s", intval($uid)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
notice(tt("%s user blocked/unblocked", "%s users blocked/unblocked", count($users)));
|
notice(L10n::tt("%s user blocked/unblocked", "%s users blocked/unblocked", count($users)));
|
||||||
}
|
}
|
||||||
if (x($_POST, 'page_users_delete')) {
|
if (x($_POST, 'page_users_delete')) {
|
||||||
foreach ($users as $uid) {
|
foreach ($users as $uid) {
|
||||||
User::remove($uid);
|
User::remove($uid);
|
||||||
}
|
}
|
||||||
notice(tt("%s user deleted", "%s users deleted", count($users)));
|
notice(L10n::tt("%s user deleted", "%s users deleted", count($users)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x($_POST, 'page_users_approve')) {
|
if (x($_POST, 'page_users_approve')) {
|
||||||
|
|
|
@ -143,7 +143,7 @@ function contacts_batch_actions(App $a)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($count_actions > 0) {
|
if ($count_actions > 0) {
|
||||||
info(tt("%d contact edited.", "%d contacts edited.", $count_actions));
|
info(L10n::tt("%d contact edited.", "%d contacts edited.", $count_actions));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x($_SESSION, 'return_url')) {
|
if (x($_SESSION, 'return_url')) {
|
||||||
|
|
|
@ -117,7 +117,7 @@ function dfrn_request_post(App $a)
|
||||||
}
|
}
|
||||||
$invalid = Probe::validDfrn($parms);
|
$invalid = Probe::validDfrn($parms);
|
||||||
if ($invalid) {
|
if ($invalid) {
|
||||||
notice(sprintf(tt("%d required parameter was not found at the given location", "%d required parameters were not found at the given location", $invalid), $invalid) . EOL);
|
notice(sprintf(L10n::tt("%d required parameter was not found at the given location", "%d required parameters were not found at the given location", $invalid), $invalid) . EOL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -364,7 +364,7 @@ function dfrn_request_post(App $a)
|
||||||
}
|
}
|
||||||
$invalid = Probe::validDfrn($parms);
|
$invalid = Probe::validDfrn($parms);
|
||||||
if ($invalid) {
|
if ($invalid) {
|
||||||
notice(sprintf(tt("%d required parameter was not found at the given location", "%d required parameters were not found at the given location", $invalid), $invalid) . EOL);
|
notice(sprintf(L10n::tt("%d required parameter was not found at the given location", "%d required parameters were not found at the given location", $invalid), $invalid) . EOL);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,11 +91,11 @@ function invite_post(App $a) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
notice( sprintf( t('%s : Message delivery failed.'), $recip) . EOL);
|
notice(sprintf(L10n::t('%s : Message delivery failed.'), $recip) . EOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
notice( sprintf( tt("%d message sent.", "%d messages sent.", $total) , $total) . EOL);
|
notice(sprintf(L10n::tt("%d message sent.", "%d messages sent.", $total), $total) . EOL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -499,7 +499,7 @@ function render_messages(array $msg, $t)
|
||||||
'$date' => datetime_convert('UTC', date_default_timezone_get(), $rr['mailcreated'], t('D, d M Y - g:i A')),
|
'$date' => datetime_convert('UTC', date_default_timezone_get(), $rr['mailcreated'], t('D, d M Y - g:i A')),
|
||||||
'$ago' => relative_date($rr['mailcreated']),
|
'$ago' => relative_date($rr['mailcreated']),
|
||||||
'$seen' => $rr['mailseen'],
|
'$seen' => $rr['mailseen'],
|
||||||
'$count' => tt('%d message', '%d messages', $rr['count']),
|
'$count' => L10n::tt('%d message', '%d messages', $rr['count']),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -541,7 +541,7 @@ function networkThreadedView(App $a, $update = 0)
|
||||||
|
|
||||||
if ($gid) {
|
if ($gid) {
|
||||||
if (($t = Contact::getOStatusCountByGroupId($gid)) && !PConfig::get(local_user(), 'system', 'nowarn_insecure')) {
|
if (($t = Contact::getOStatusCountByGroupId($gid)) && !PConfig::get(local_user(), 'system', 'nowarn_insecure')) {
|
||||||
notice(tt("Warning: This group contains %s member from a network that doesn't allow non public messages.",
|
notice(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.",
|
"Warning: This group contains %s members from a network that doesn't allow non public messages.",
|
||||||
$t) . EOL);
|
$t) . EOL);
|
||||||
notice(L10n::t("Messages in this group won't be send to these receivers.").EOL);
|
notice(L10n::t("Messages in this group won't be send to these receivers.").EOL);
|
||||||
|
|
|
@ -8,6 +8,7 @@ use Friendica\Content\ContactSelector;
|
||||||
use Friendica\Content\Feature;
|
use Friendica\Content\Feature;
|
||||||
use Friendica\Core\Addon;
|
use Friendica\Core\Addon;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\PConfig;
|
use Friendica\Core\PConfig;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
|
@ -48,7 +49,7 @@ class Widget
|
||||||
$x = PConfig::get(local_user(), 'system', 'invites_remaining');
|
$x = PConfig::get(local_user(), 'system', 'invites_remaining');
|
||||||
if ($x || is_site_admin()) {
|
if ($x || is_site_admin()) {
|
||||||
$a->page['aside'] .= '<div class="side-link" id="side-invite-remain">'
|
$a->page['aside'] .= '<div class="side-link" id="side-invite-remain">'
|
||||||
. tt('%d invitation available', '%d invitations available', $x)
|
. L10n::tt('%d invitation available', '%d invitations available', $x)
|
||||||
. '</div>' . $inv;
|
. '</div>' . $inv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -302,7 +303,7 @@ class Widget
|
||||||
}
|
}
|
||||||
|
|
||||||
return replace_macros(get_markup_template('remote_friends_common.tpl'), array(
|
return replace_macros(get_markup_template('remote_friends_common.tpl'), array(
|
||||||
'$desc' => tt("%d contact in common", "%d contacts in common", $t),
|
'$desc' => L10n::tt("%d contact in common", "%d contacts in common", $t),
|
||||||
'$base' => System::baseUrl(),
|
'$base' => System::baseUrl(),
|
||||||
'$uid' => $profile_uid,
|
'$uid' => $profile_uid,
|
||||||
'$cid' => (($cid) ? $cid : '0'),
|
'$cid' => (($cid) ? $cid : '0'),
|
||||||
|
|
|
@ -174,7 +174,7 @@ class L10n
|
||||||
* @param int $count
|
* @param int $count
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function tt($singular, $plural, $count)
|
public static function tt($singular, $plural, $count)
|
||||||
{
|
{
|
||||||
global $lang;
|
global $lang;
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
|
|
|
@ -231,7 +231,7 @@ class UserImport
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($errorcount > 0) {
|
if ($errorcount > 0) {
|
||||||
notice(sprintf(tt("%d contact not imported", "%d contacts not imported", $errorcount), $errorcount));
|
notice(sprintf(L10n::tt("%d contact not imported", "%d contacts not imported", $errorcount), $errorcount));
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($account['group'] as &$group) {
|
foreach ($account['group'] as &$group) {
|
||||||
|
|
|
@ -8,6 +8,7 @@ use Friendica\BaseObject;
|
||||||
use Friendica\Content\ContactSelector;
|
use Friendica\Content\ContactSelector;
|
||||||
use Friendica\Content\Feature;
|
use Friendica\Content\Feature;
|
||||||
use Friendica\Core\Addon;
|
use Friendica\Core\Addon;
|
||||||
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\PConfig;
|
use Friendica\Core\PConfig;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
|
@ -420,9 +421,9 @@ class Post extends BaseObject
|
||||||
// Collapse
|
// Collapse
|
||||||
if (($nb_children > 2) || ($thread_level > 1)) {
|
if (($nb_children > 2) || ($thread_level > 1)) {
|
||||||
$result['children'][0]['comment_firstcollapsed'] = true;
|
$result['children'][0]['comment_firstcollapsed'] = true;
|
||||||
$result['children'][0]['num_comments'] = tt('%d comment', '%d comments', $total_children);
|
$result['children'][0]['num_comments'] = L10n::tt('%d comment', '%d comments', $total_children);
|
||||||
$result['children'][0]['hidden_comments_num'] = $total_children;
|
$result['children'][0]['hidden_comments_num'] = $total_children;
|
||||||
$result['children'][0]['hidden_comments_text'] = tt('comment', 'comments', $total_children);
|
$result['children'][0]['hidden_comments_text'] = L10n::tt('comment', 'comments', $total_children);
|
||||||
$result['children'][0]['hide_text'] = t('show more');
|
$result['children'][0]['hide_text'] = t('show more');
|
||||||
if ($thread_level > 1) {
|
if ($thread_level > 1) {
|
||||||
$result['children'][$nb_children - 1]['comment_lastcollapsed'] = true;
|
$result['children'][$nb_children - 1]['comment_lastcollapsed'] = true;
|
||||||
|
@ -434,7 +435,7 @@ class Post extends BaseObject
|
||||||
|
|
||||||
if ($this->isToplevel()) {
|
if ($this->isToplevel()) {
|
||||||
$result['total_comments_num'] = "$total_children";
|
$result['total_comments_num'] = "$total_children";
|
||||||
$result['total_comments_text'] = tt('comment', 'comments', $total_children);
|
$result['total_comments_text'] = L10n::tt('comment', 'comments', $total_children);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result['private'] = $item['private'];
|
$result['private'] = $item['private'];
|
||||||
|
|
|
@ -61,7 +61,7 @@ e.g.
|
||||||
|
|
||||||
Plural
|
Plural
|
||||||
|
|
||||||
The tt() function supports plural form. Script extract.php write this in
|
The L10n::tt() function supports plural form. Script extract.php write this in
|
||||||
strings.php as an array, one string for every plural form language supports:
|
strings.php as an array, one string for every plural form language supports:
|
||||||
|
|
||||||
$a->string["%d message sent"] = Array(
|
$a->string["%d message sent"] = Array(
|
||||||
|
@ -79,7 +79,7 @@ More info at http://www.gnu.org/software/hello/manual/gettext/Plural-forms.html
|
||||||
Xgettext and .po workflow
|
Xgettext and .po workflow
|
||||||
|
|
||||||
1. Run util/run_xgettext.sh script (on *unix sistems, with GNU xgettext installed)
|
1. Run util/run_xgettext.sh script (on *unix sistems, with GNU xgettext installed)
|
||||||
This script runs xgettext on source tree, extracting strings from t() and tt()
|
This script runs xgettext on source tree, extracting strings from L10n::t() and L10n::tt()
|
||||||
functions, and creates a util/messages.po file.
|
functions, and creates a util/messages.po file.
|
||||||
|
|
||||||
$ cd util; ./run_xgettext.sh
|
$ cd util; ./run_xgettext.sh
|
||||||
|
|
Loading…
Reference in a new issue