Update translator documentation.

i18n fixes (gettext domain).
L10n updates.
Whitespace updates.
Some tabs to spaces.
This commit is contained in:
Siebrand Mazeland 2011-04-11 00:39:27 +02:00
parent d375317c7f
commit b83e0fd0e8
14 changed files with 157 additions and 146 deletions

View File

@ -245,6 +245,7 @@ class OStatusPlugin extends Plugin
array('group' => $group->nickname));
$widget->out->element('a', array('href' => $url,
'class' => 'entity_remote_subscribe'),
// TRANS: Link to subscribe to a remote entity.
_m('Subscribe'));
$output->elementEnd('li');
@ -265,6 +266,7 @@ class OStatusPlugin extends Plugin
array('tagger' => $profile->nickname, 'peopletag' => $peopletag->tag));
$output->element('a', array('href' => $url,
'class' => 'entity_remote_subscribe'),
// TRANS: Link to subscribe to a remote entity.
_m('Subscribe'));
$output->elementEnd('li');
@ -283,7 +285,8 @@ class OStatusPlugin extends Plugin
'action' => common_local_url('tagprofile', array('id' => @$profile->id))));
$action->elementStart('fieldset');
$action->element('legend', null, _('Tag remote profile'));
// TRANS: Fieldset legend.
$action->element('legend', null, _m('Tag remote profile'));
$action->hidden('token', common_session_token());
$user = common_current_user();
@ -291,11 +294,14 @@ class OStatusPlugin extends Plugin
$action->elementStart('ul', 'form_data');
$action->elementStart('li');
$action->input('uri', _('Remote profile'), $action->trimmed('uri'),
_('OStatus user\'s address, like nickname@example.com or http://example.net/nickname'));
// TRANS: Field label.
$action->input('uri', _m('LABEL','Remote profile'), $action->trimmed('uri'),
// TRANS: Field title.
_m('OStatus user\'s address, like nickname@example.com or http://example.net/nickname.'));
$action->elementEnd('li');
$action->elementEnd('ul');
$action->submit('fetch', _('Fetch'));
// TRANS: Button text to fetch remote profile.
$action->submit('fetch', _m('BUTTON','Fetch'));
$action->elementEnd('fieldset');
$action->elementEnd('form');
}
@ -312,7 +318,8 @@ class OStatusPlugin extends Plugin
} else if (Validate::uri($uri)) {
$oprofile = Ostatus_profile::ensureProfileURL($uri);
} else {
throw new Exception('Invalid URI');
// TRANS: Exception in OStatus when invalid URI was entered.
throw new Exception(_m('Invalid URI.'));
}
// redirect to the new profile.
@ -320,7 +327,8 @@ class OStatusPlugin extends Plugin
return false;
} catch (Exception $e) {
$err = _m("Sorry, we could not reach that address. Please make sure that the OStatus address is like nickname@example.com or http://example.net/nickname");
// TRANS: Error message in OStatus plugin.
$err = _m("Sorry, we could not reach that address. Please make sure that the OStatus address is like nickname@example.com or http://example.net/nickname.");
}
$action->showForm($err);
@ -346,12 +354,14 @@ class OStatusPlugin extends Plugin
} else if (Validate::uri($q)) {
$oprofile = Ostatus_profile::ensureProfileURL($q);
} else {
throw new Exception('Invalid URI');
// TRANS: Exception in OStatus when invalid URI was entered.
throw new Exception(_m('Invalid URI.'));
}
return $this->filter(array($oprofile->localProfile()));
} catch (Exception $e) {
$this->msg = _m("Sorry, we could not reach that address. Please make sure that the OStatus address is like nickname@example.com or http://example.net/nickname");
// TRANS: Error message in OStatus plugin.
$this->msg = _m("Sorry, we could not reach that address. Please make sure that the OStatus address is like nickname@example.com or http://example.net/nickname.");
return array();
}
}
@ -369,7 +379,6 @@ class OStatusPlugin extends Plugin
* @param array &$mention in/out param: set of found mentions
* @return boolean hook return value
*/
function onEndFindMentions($sender, $text, &$mentions)
{
$matches = array();
@ -566,12 +575,13 @@ class OStatusPlugin extends Plugin
}
$url = $notice->url;
// TRANSLATE: %s is a domain.
$title = sprintf(_m("Sent from %s via OStatus"), $domain);
// TRANS: Title.
// TRANS: %s is a domain name.
$title = sprintf(_m('Sent from %s via OStatus'), $domain);
return false;
}
}
return true;
return true;
}
/**
@ -638,7 +648,7 @@ class OStatusPlugin extends Plugin
}
if (!$oprofile->subscribe()) {
// TRANS: Exception.
// TRANS: Exception thrown when setup of remote subscription fails.
throw new Exception(_m('Could not set up remote subscription.'));
}
}
@ -680,7 +690,7 @@ class OStatusPlugin extends Plugin
/**
* Notify remote server and garbage collect unused feeds on unsubscribe.
* @fixme send these operations to background queues
* @todo FIXME: Send these operations to background queues
*
* @param User $user
* @param Profile $other
@ -713,7 +723,8 @@ class OStatusPlugin extends Plugin
common_date_iso8601(time()));
$act->time = time();
$act->title = _m('Unfollow');
// TRANS: Title for unfollowing a remote profile.
$act->title = _m('TITLE','Unfollow');
// TRANS: Success message for unsubscribe from user attempt through OStatus.
// TRANS: %1$s is the unsubscriber's name, %2$s is the unsubscribed user's name.
$act->content = sprintf(_m('%1$s stopped following %2$s.'),
@ -738,12 +749,12 @@ class OStatusPlugin extends Plugin
*
* @return mixed hook return value
*/
function onStartJoinGroup($group, $user)
{
$oprofile = Ostatus_profile::staticGet('group_id', $group->id);
if ($oprofile) {
if (!$oprofile->subscribe()) {
// TRANS: Exception thrown when setup of remote group membership fails.
throw new Exception(_m('Could not set up remote group membership.'));
}
@ -763,7 +774,8 @@ class OStatusPlugin extends Plugin
$act->object = $oprofile->asActivityObject();
$act->time = time();
$act->title = _m("Join");
// TRANS: Title to join a remote group.
$act->title = _m('TITLE','Join');
// TRANS: Success message for subscribe to group attempt through OStatus.
// TRANS: %1$s is the member name, %2$s is the subscribed group's name.
$act->content = sprintf(_m('%1$s has joined group %2$s.'),
@ -774,8 +786,8 @@ class OStatusPlugin extends Plugin
return true;
} else {
$oprofile->garbageCollect();
// TRANS: Exception.
throw new Exception(_m("Failed joining remote group."));
// TRANS: Exception thrown when joining a remote group fails.
throw new Exception(_m('Failed joining remote group.'));
}
}
}
@ -794,7 +806,6 @@ class OStatusPlugin extends Plugin
*
* @return mixed hook return value
*/
function onEndLeaveGroup($group, $user)
{
$oprofile = Ostatus_profile::staticGet('group_id', $group->id);
@ -815,7 +826,8 @@ class OStatusPlugin extends Plugin
$act->object = $oprofile->asActivityObject();
$act->time = time();
$act->title = _m("Leave");
// TRANS: Title for leaving a remote group.
$act->title = _m('TITLE','Leave');
// TRANS: Success message for unsubscribe from group attempt through OStatus.
// TRANS: %1$s is the member name, %2$s is the unsubscribed group's name.
$act->content = sprintf(_m('%1$s has left group %2$s.'),
@ -842,7 +854,8 @@ class OStatusPlugin extends Plugin
$oprofile = Ostatus_profile::staticGet('peopletag_id', $peopletag->id);
if ($oprofile) {
if (!$oprofile->subscribe()) {
throw new Exception(_m('Could not set up remote peopletag subscription.'));
// TRANS: Exception thrown when setup of remote people tag subscription fails.
throw new Exception(_m('Could not set up remote people tag subscription.'));
}
$sub = $user->getProfile();
@ -859,8 +872,11 @@ class OStatusPlugin extends Plugin
$act->object = $oprofile->asActivityObject();
$act->time = time();
$act->title = _m("Follow list");
$act->content = sprintf(_m("%s is now following people tagged %s by %s."),
// TRANS: Title for remote follow list.
$act->title = _m('TITLE','Follow list');
// TRANS: Success message for remote list follow through OStatus.
// TRANS: %1$s is the subscriber name, %2$s the prople tag, %3$s is the tagger's name.
$act->content = sprintf(_m("%1$s is now following people tagged %2$s by %3$s."),
$sub->getBestName(),
$oprofile->getBestName(),
$tagger->getBestName());
@ -869,7 +885,8 @@ class OStatusPlugin extends Plugin
return true;
} else {
$oprofile->garbageCollect();
throw new Exception(_m("Failed subscribing to remote peopletag."));
// TRANS: Exception thrown when subscription of remote people tag fails.
throw new Exception(_m('Failed subscribing to remote people tag.'));
}
}
}
@ -905,8 +922,8 @@ class OStatusPlugin extends Plugin
$act->object = $oprofile->asActivityObject();
$act->time = time();
$act->title = _m("Unfollow peopletag");
$act->content = sprintf(_m("%s stopped following the list %s by %s."),
$act->title = _m('Unfollow people tag');
$act->content = sprintf(_m('%1$s stopped following the list %2$s by %3$s.'),
$sub->getBestName(),
$oprofile->getBestName(),
$tagger->getBestName());
@ -982,8 +999,8 @@ class OStatusPlugin extends Plugin
$plist->tagger, $plist->id,
common_date_iso8601(time()));
$act->time = time();
$act->title = _("Tag");
$act->content = sprintf(_("%s tagged %s in the list %s"),
$act->title = _m('TITLE','Tag');
$act->content = sprintf(_m('%1$s tagged %2$s in the list %3$s.'),
$tagger->getBestName(),
$tagged->getBestName(),
$plist->getBestName());
@ -996,7 +1013,7 @@ class OStatusPlugin extends Plugin
// initiate a PuSH subscription for the person being tagged
if (!$oprofile->subscribe()) {
throw new Exception(sprintf(_('Could not complete subscription to remote '.
throw new Exception(sprintf(_m('Could not complete subscription to remote '.
'profile\'s feed. Tag %s could not be saved.'), $ptag->tag));
return false;
}
@ -1035,8 +1052,8 @@ class OStatusPlugin extends Plugin
$plist->tagger, $plist->id,
common_date_iso8601(time()));
$act->time = time();
$act->title = _("Untag");
$act->content = sprintf(_("%s untagged %s from the list %s"),
$act->title = _m('TITLE','Untag');
$act->content = sprintf(_('%1$s untagged %2$s from the list %3$s.'),
$tagger->getBestName(),
$tagged->getBestName(),
$plist->getBestName());
@ -1061,7 +1078,6 @@ class OStatusPlugin extends Plugin
*
* @return hook return value
*/
function onEndDisfavorNotice(Profile $profile, Notice $notice)
{
$user = User::staticGet('id', $profile->id);
@ -1206,7 +1222,7 @@ class OStatusPlugin extends Plugin
$act->title = _m("Profile update");
// TRANS: Ping text for remote profile update through OStatus.
// TRANS: %s is user that updated their profile.
$act->content = sprintf(_m("%s has updated their profile page."),
$act->content = sprintf(_m('%s has updated their profile page.'),
$profile->getBestName());
$act->actor = ActivityObject::fromProfile($profile);
@ -1317,7 +1333,7 @@ class OStatusPlugin extends Plugin
// so we check locally first.
$user = User::staticGet('uri', $uri);
if (!empty($user)) {
$profile = $user->getProfile();
return false;
@ -1339,13 +1355,13 @@ class OStatusPlugin extends Plugin
function onEndXrdActionLinks(&$xrd, $user)
{
$xrd->links[] = array('rel' => Discovery::UPDATESFROM,
'href' => common_local_url('ApiTimelineUser',
array('id' => $user->id,
'format' => 'atom')),
'type' => 'application/atom+xml');
// Salmon
$xrd->links[] = array('rel' => Discovery::UPDATESFROM,
'href' => common_local_url('ApiTimelineUser',
array('id' => $user->id,
'format' => 'atom')),
'type' => 'application/atom+xml');
// Salmon
$salmon_url = common_local_url('usersalmon',
array('id' => $user->id));
@ -1373,7 +1389,7 @@ class OStatusPlugin extends Plugin
$url = common_local_url('ostatussub') . '?profile={uri}';
$xrd->links[] = array('rel' => 'http://ostatus.org/schema/1.0/subscribe',
'template' => $url );
return true;
return true;
}
}

View File

@ -50,7 +50,6 @@ $config['feedsub']['nohub']
and we have no polling backend. (The fallback hub option can be used
with a 3rd-party service to provide such polling.)
Todo:
* better support for feeds that aren't natively oriented at social networking
* make use of tags/categories from feeds

View File

@ -53,7 +53,7 @@ class GroupsalmonAction extends SalmonAction
$oprofile = Ostatus_profile::staticGet('group_id', $id);
if ($oprofile) {
// TRANS: Client error.
$this->clientError(_m("Can't accept remote posts for a remote group."));
$this->clientError(_m('Cannot accept remote posts for a remote group.'));
}
return true;
@ -74,7 +74,7 @@ class GroupsalmonAction extends SalmonAction
break;
default:
// TRANS: Client exception.
throw new ClientException("Can't handle that kind of post.");
throw new ClientException('Cannot handle that kind of post.');
}
// Notice must be to the attention of this group
@ -127,11 +127,11 @@ class GroupsalmonAction extends SalmonAction
$oprofile = $this->ensureProfile();
if (!$oprofile) {
// TRANS: Client error.
$this->clientError(_m("Can't read profile to set up group membership."));
$this->clientError(_m('Cannot read profile to set up group membership.'));
}
if ($oprofile->isGroup()) {
// TRANS: Client error.
$this->clientError(_m("Groups can't join groups."));
$this->clientError(_m('Groups cannot join groups.'));
}
common_log(LOG_INFO, "Remote profile {$oprofile->uri} joining local group {$this->group->nickname}");
@ -164,10 +164,10 @@ class GroupsalmonAction extends SalmonAction
{
$oprofile = $this->ensureProfile();
if (!$oprofile) {
$this->clientError(_m("Can't read profile to cancel group membership."));
$this->clientError(_m('Cannot read profile to cancel group membership.'));
}
if ($oprofile->isGroup()) {
$this->clientError(_m("Groups can't join groups."));
$this->clientError(_m('Groups cannot join groups.'));
}
common_log(LOG_INFO, "Remote profile {$oprofile->uri} leaving local group {$this->group->nickname}");

View File

@ -65,6 +65,7 @@ class OStatusInitAction extends Action
/* Use a session token for CSRF protection. */
$token = $this->trimmed('token');
if (!$token || $token != common_session_token()) {
// TRANS: Client error displayed when the session token does not match or is not given.
$this->showForm(_m('There was a problem with your session token. '.
'Try again, please.'));
return;
@ -84,7 +85,7 @@ class OStatusInitAction extends Action
$this->elementStart('html');
$this->elementStart('head');
// TRANS: Form title.
$this->element('title', null, _m('Subscribe to user'));
$this->element('title', null, _m('TITLE','Subscribe to user'));
$this->elementEnd('head');
$this->elementStart('body');
$this->showContent();
@ -98,18 +99,20 @@ class OStatusInitAction extends Action
function showContent()
{
if ($this->group) {
// TRANS: Form legend.
// TRANS: Form legend. %s is a group name.
$header = sprintf(_m('Join group %s'), $this->group);
// TRANS: Button text to join a group.
$submit = _m('BUTTON','Join');
} else if ($this->peopletag && $this->tagger) {
$header = sprintf(_m('Subscribe to people tagged %s by %s'), $this->peopletag, $this->tagger);
$submit = _m('Subscribe');
// TRANS: Form legend. %1$s is a people tag, %2$s is a tagger's name.
$header = sprintf(_m('Subscribe to people tagged %1$s by %2$s'), $this->peopletag, $this->tagger);
// TRANS: Button text to subscribe to a people tag.
$submit = _m('BUTTON','Subscribe');
// TRANS: Button text.
} else {
// TRANS: Form legend.
// TRANS: Form legend. %s is a nickname.
$header = sprintf(_m('Subscribe to %s'), $this->nickname);
// TRANS: Button text.
// TRANS: Button text to subscribe to a profile.
$submit = _m('BUTTON','Subscribe');
}
$this->elementStart('form', array('id' => 'form_ostatus_connect',
@ -126,10 +129,12 @@ class OStatusInitAction extends Action
if ($this->group) {
// TRANS: Field label.
$this->input('group', _m('Group nickname'), $this->group,
// TRANS: Field title.
_m('Nickname of the group you want to join.'));
} else {
// TRANS: Field label.
$this->input('nickname', _m('User nickname'), $this->nickname,
// TRANS: Field title.
_m('Nickname of the user you want to follow.'));
$this->hidden('tagger', $this->tagger);
$this->hidden('peopletag', $this->peopletag);
@ -140,7 +145,7 @@ class OStatusInitAction extends Action
// TRANS: Field label.
$this->input('profile', _m('Profile Account'), $this->profile,
// TRANS: Tooltip for field label "Profile Account".
_m('Your account id (e.g. user@identi.ca).'));
_m('Your account ID (e.g. user@identi.ca).'));
$this->elementEnd('li');
$this->elementEnd('ul');
$this->submit('submit', $submit);
@ -174,7 +179,7 @@ class OStatusInitAction extends Action
$result = $disco->lookup($acct);
if (!$result) {
// TRANS: Client error.
$this->clientError(_m("Couldn't look up OStatus account profile."));
$this->clientError(_m('Could not look up OStatus account profile.'));
}
foreach ($result->links as $link) {
@ -187,7 +192,7 @@ class OStatusInitAction extends Action
}
// TRANS: Client error.
$this->clientError(_m("Couldn't confirm remote profile address."));
$this->clientError(_m('Could not confirm remote profile address.'));
}
function connectProfile($subscriber_profile)

View File

@ -95,7 +95,7 @@ class OStatusPeopletagAction extends OStatusSubAction
$cur = common_current_user();
if ($ptag->hasSubscriber($cur->id)) {
$this->element('div', array('class' => 'error'),
_m("You are already subscribed to this peopletag."));
_m('You are already subscribed to this people tag.'));
$ok = false;
} else {
$ok = true;

View File

@ -345,6 +345,7 @@ class OStatusSubAction extends Action
// CSRF protection
$token = $this->trimmed('token');
if (!$token || $token != common_session_token()) {
// TRANS: Client error displayed when the session token does not match or is not given.
$this->showForm(_m('There was a problem with your session token. '.
'Try again, please.'));
return;

View File

@ -83,7 +83,7 @@ class OStatusTagAction extends OStatusInitAction
$disco = new Discovery;
$result = $disco->lookup($acct);
if (!$result) {
$this->clientError(_m("Couldn't look up OStatus account profile."));
$this->clientError(_m('Could not look up OStatus account profile.'));
}
foreach ($result->links as $link) {
@ -95,7 +95,7 @@ class OStatusTagAction extends OStatusInitAction
}
}
$this->clientError(_m("Couldn't confirm remote profile address."));
$this->clientError(_m('Could not confirm remote profile address.'));
}
function connectProfile($subscriber_profile)

View File

@ -36,19 +36,19 @@ class PeopletagsalmonAction extends SalmonAction
$id = $this->trimmed('id');
if (!$id) {
$this->clientError(_('No ID.'));
$this->clientError(_m('No ID.'));
}
$this->peopletag = Profile_list::staticGet('id', $id);
if (empty($this->peopletag)) {
$this->clientError(_('No such peopletag.'));
$this->clientError(_m('No such people tag.'));
}
$oprofile = Ostatus_profile::staticGet('peopletag_id', $id);
if (!empty($oprofile)) {
$this->clientError(_m("Can't accept remote posts for a remote peopletag."));
$this->clientError(_m('Cannot accept remote posts for a remote people tag.'));
}
return true;
@ -86,10 +86,10 @@ class PeopletagsalmonAction extends SalmonAction
{
$oprofile = $this->ensureProfile();
if (!$oprofile) {
$this->clientError(_m("Can't read profile to set up profiletag subscription."));
$this->clientError(_m('Cannot read profile to set up profile tag subscription.'));
}
if ($oprofile->isGroup()) {
$this->clientError(_m("Groups can't subscribe to peopletags."));
$this->clientError(_m('Groups cannot subscribe to people tags.'));
}
common_log(LOG_INFO, "Remote profile {$oprofile->uri} subscribing to local peopletag ".$this->peopletag->getBestName());
@ -107,7 +107,7 @@ class PeopletagsalmonAction extends SalmonAction
try {
Profile_tag_subscription::add($this->peopletag, $profile);
} catch (Exception $e) {
$this->serverError(sprintf(_m('Could not subscribe remote user %1$s to peopletag %2$s.'),
$this->serverError(sprintf(_m('Could not subscribe remote user %1$s to people tag %2$s.'),
$oprofile->uri, $this->peopletag->getBestName()));
}
}
@ -120,10 +120,10 @@ class PeopletagsalmonAction extends SalmonAction
{
$oprofile = $this->ensureProfile();
if (!$oprofile) {
$this->clientError(_m("Can't read profile to cancel peopletag membership."));
$this->clientError(_m('Cannot read profile to cancel people tag membership.'));
}
if ($oprofile->isGroup()) {
$this->clientError(_m("Groups can't subscribe to peopletags."));
$this->clientError(_m('Groups cannot subscribe to people tags.'));
}
common_log(LOG_INFO, "Remote profile {$oprofile->uri} unsubscribing from local peopletag ".$this->peopletag->getBestName());
@ -133,7 +133,7 @@ class PeopletagsalmonAction extends SalmonAction
Profile_tag_subscription::remove($this->peopletag->tagger, $this->peopletag->tag, $profile->id);
} catch (Exception $e) {
$this->serverError(sprintf(_m('Could not remove remote user %1$s from peopletag %2$s.'),
$this->serverError(sprintf(_m('Could not remove remote user %1$s from people tag %2$s.'),
$oprofile->uri, $this->peopletag->getBestName()));
return;
}

View File

@ -28,18 +28,14 @@ if (!defined('STATUSNET')) {
}
/**
Things to consider...
* should we purge incomplete subscriptions that never get a verification pingback?
* when can we send subscription renewal checks?
- at next send time probably ok
* when can we handle trimming of subscriptions?
- at next send time probably ok
* should we keep a fail count?
*/
* Things to consider...
* should we purge incomplete subscriptions that never get a verification pingback?
* when can we send subscription renewal checks?
* - at next send time probably ok
* when can we handle trimming of subscriptions?
* - at next send time probably ok
* should we keep a fail count?
*/
class PushHubAction extends Action
{
function arg($arg, $def=null)
@ -95,13 +91,13 @@ class PushHubAction extends Action
$verify = $this->arg('hub.verify'); // @fixme may be multiple
if ($verify != 'sync' && $verify != 'async') {
// TRANS: Client exception.
// TRANS: Client exception. %s is sync or async.
throw new ClientException(sprintf(_m('Invalid hub.verify "%s". It must be sync or async.'),$verify));
}
$lease = $this->arg('hub.lease_seconds', null);
if ($mode == 'subscribe' && $lease != '' && !preg_match('/^\d+$/', $lease)) {
// TRANS: Client exception.
// TRANS: Client exception. %s is the invalid lease value.
throw new ClientException(sprintf(_m('Invalid hub.lease "%s". It must be empty or positive integer.'),$lease));
}
@ -109,7 +105,7 @@ class PushHubAction extends Action
$secret = $this->arg('hub.secret', null);
if ($secret != '' && strlen($secret) >= 200) {
// TRANS: Client exception.
// TRANS: Client exception. %s is the invalid hub secret.
throw new ClientException(sprintf(_m('Invalid hub.secret "%s". It must be under 200 bytes.'),$secret));
}
@ -161,8 +157,8 @@ class PushHubAction extends Action
if ($feed == $userFeed) {
$user = User::staticGet('id', $id);
if (!$user) {
// TRANS: Client exception.
throw new ClientException(sprintt(_m('Invalid hub.topic "%s". User doesn\'t exist.'),$feed));
// TRANS: Client exception. %s is a feed URL.
throw new ClientException(sprintt(_m('Invalid hub.topic "%s". User does not exist.'),$feed));
} else {
return true;
}
@ -170,8 +166,8 @@ class PushHubAction extends Action
if ($feed == $groupFeed) {
$user = User_group::staticGet('id', $id);
if (!$user) {
// TRANS: Client exception.
throw new ClientException(sprintf(_m('Invalid hub.topic "%s". Group doesn\'t exist.'),$feed));
// TRANS: Client exception. %s is a feed URL.
throw new ClientException(sprintf(_m('Invalid hub.topic "%s". Group does not exist.'),$feed));
} else {
return true;
}
@ -186,7 +182,8 @@ class PushHubAction extends Action
$list = Profile_list::staticGet('id', $id);
$user = User::staticGet('id', $user);
if (!$list || !$user || $list->tagger != $user->id) {
throw new ClientException("Invalid hub.topic $feed; people tag doesn't exist.");
// TRANS: Client exception. %s is a feed URL.
throw new ClientException(sprintf(_m('Invalid hub.topic %s; people tag does not exist.'),$feed));
} else {
return true;
}

View File

@ -67,7 +67,7 @@ class UsersalmonAction extends SalmonAction
case ActivityObject::COMMENT:
break;
default:
throw new ClientException("Can't handle that kind of post.");
throw new ClientException(_m('Cannot handle that kind of post.'));
}
// Notice must either be a) in reply to a notice by this user
@ -255,7 +255,7 @@ class UsersalmonAction extends SalmonAction
{
if (!$object) {
// TRANS: Client exception.
throw new ClientException(_m('Can\'t favorite/unfavorite without an object.'));
throw new ClientException(_m('Cannot favorite/unfavorite without an object.'));
}
switch ($object->type) {
@ -267,7 +267,7 @@ class UsersalmonAction extends SalmonAction
break;
default:
// TRANS: Client exception.
throw new ClientException(_m('Can\'t handle that kind of object for liking/faving.'));
throw new ClientException(_m('Cannot handle that kind of object for liking/faving.'));
}
$notice = Notice::staticGet('uri', $object->id);

View File

@ -249,6 +249,7 @@ class FeedSub extends Memcached_DataObject
// We'll never actually get updates in this mode.
return true;
} else {
// TRANS: Server exception.
throw new ServerException(_m('Attempting to start PuSH subscription for feed with no hub.'));
}
}
@ -279,6 +280,7 @@ class FeedSub extends Memcached_DataObject
// We'll never actually get updates in this mode.
return true;
} else {
// TRANS: Server exception.
throw new ServerException(_m('Attempting to end PuSH subscription for feed with no hub.'));
}
}

View File

@ -53,7 +53,6 @@ class Ostatus_profile extends Managed_DataObject
*
* @return array array of column definitions
*/
static function schemaDef()
{
return array(
@ -172,10 +171,10 @@ class Ostatus_profile extends Managed_DataObject
return true;
} else if ($this->group_id && ($this->profile_id || $this->peopletag_id)) {
// TRANS: Server exception. %s is a URI
throw new ServerException(_m("Invalid ostatus_profile state: two or more IDs set for %s", $this->uri));
throw new ServerException(sprintf(_m('Invalid ostatus_profile state: two or more IDs set for %s'), $this->uri));
} else {
// TRANS: Server exception. %s is a URI
throw new ServerException(_m("Invalid ostatus_profile state: all IDs empty for %s", $this->uri));
throw new ServerException(sprintf(_m('Invalid ostatus_profile state: all IDs empty for %s.'), $this->uri));
}
}
@ -190,10 +189,10 @@ class Ostatus_profile extends Managed_DataObject
return true;
} else if ($this->peopletag_id && ($this->profile_id || $this->group_id)) {
// TRANS: Server exception. %s is a URI
throw new ServerException(_m("Invalid ostatus_profile state: two or more IDs set for %s", $this->uri));
throw new ServerException(sprintf(_m('Invalid ostatus_profile state: two or more IDs set for %s'), $this->uri));
} else {
// TRANS: Server exception. %s is a URI
throw new ServerException(_m("Invalid ostatus_profile state: all IDs empty for %s", $this->uri));
throw new ServerException(sprintf(_m('Invalid ostatus_profile state: all IDs empty for %s.'), $this->uri));
}
}
@ -296,7 +295,6 @@ class Ostatus_profile extends Managed_DataObject
$object = $this;
}
if ($this->salmonuri) {
$text = 'update';
$id = TagURI::mint('%s:%s:%s',
$verb,
@ -466,14 +464,12 @@ class Ostatus_profile extends Managed_DataObject
* @param DOMElement $feed for context
* @param string $source identifier ("push" or "salmon")
*/
public function processEntry($entry, $feed, $source)
{
$activity = new Activity($entry, $feed);
if (Event::handle('StartHandleFeedEntryWithProfile', array($activity, $this)) &&
Event::handle('StartHandleFeedEntry', array($activity))) {
// @todo process all activity objects
switch ($activity->objects[0]->type) {
case ActivityObject::ARTICLE:
@ -481,7 +477,7 @@ class Ostatus_profile extends Managed_DataObject
case ActivityObject::NOTE:
case ActivityObject::STATUS:
case ActivityObject::COMMENT:
case null:
case null:
if ($activity->verb == ActivityVerb::POST) {
$this->processPost($activity, $source);
} else {
@ -490,7 +486,7 @@ class Ostatus_profile extends Managed_DataObject
break;
default:
// TRANS: Client exception.
throw new ClientException(_m('Can\'t handle that kind of post.'));
throw new ClientException(_m('Cannot handle that kind of post.'));
}
Event::handle('EndHandleFeedEntry', array($activity));
@ -580,7 +576,7 @@ class Ostatus_profile extends Managed_DataObject
// We mark up the attachment link specially for the HTML output
// so we can fold-out the full version inline.
// @fixme I18N this tooltip will be saved with the site's default language
// @todo FIXME i18n: This tooltip will be saved with the site's default language
// TRANS: Shown when a notice is longer than supported and/or when attachments are present. At runtime
// TRANS: this will usually be replaced with localised text from StatusNet core messages.
$showMoreText = _m('Show more');
@ -761,7 +757,6 @@ class Ostatus_profile extends Managed_DataObject
* @throws Exception on various error conditions
* @throws OStatusShadowException if this reference would obscure a local user/group
*/
public static function ensureProfileURL($profile_url, $hints=array())
{
$oprofile = self::getFromProfileURL($profile_url);
@ -930,7 +925,6 @@ class Ostatus_profile extends Managed_DataObject
* @return Ostatus_profile
* @throws Exception
*/
public static function ensureAtomFeed($feedEl, $hints)
{
$author = ActivityUtils::getFeedAuthor($feedEl);
@ -938,7 +932,7 @@ class Ostatus_profile extends Managed_DataObject
if (empty($author)) {
// XXX: make some educated guesses here
// TRANS: Feed sub exception.
throw new FeedSubException(_m('Can\'t find enough profile '.
throw new FeedSubException(_m('Cannot find enough profile '.
'information to make a feed.'));
}
@ -1002,7 +996,7 @@ class Ostatus_profile extends Managed_DataObject
}
if (!common_valid_http_url($url)) {
// TRANS: Server exception. %s is a URL.
throw new ServerException(sprintf(_m("Invalid avatar URL %s."), $url));
throw new ServerException(sprintf(_m('Invalid avatar URL %s.'), $url));
}
if ($this->isGroup()) {
@ -1013,7 +1007,7 @@ class Ostatus_profile extends Managed_DataObject
if (!$self) {
throw new ServerException(sprintf(
// TRANS: Server exception. %s is a URI.
_m("Tried to update avatar for unsaved remote profile %s."),
_m('Tried to update avatar for unsaved remote profile %s.'),
$this->uri));
}
@ -1023,7 +1017,7 @@ class Ostatus_profile extends Managed_DataObject
try {
if (!copy($url, $temp_filename)) {
// TRANS: Server exception. %s is a URL.
throw new ServerException(sprintf(_m("Unable to fetch avatar from %s."), $url));
throw new ServerException(sprintf(_m('Unable to fetch avatar from %s.'), $url));
}
if ($this->isGroup()) {
@ -1064,7 +1058,6 @@ class Ostatus_profile extends Managed_DataObject
* @param array $hints
* @return mixed URL string or false
*/
public static function getActivityObjectAvatar($object, $hints=array())
{
if ($object->avatarLinks) {
@ -1094,7 +1087,6 @@ class Ostatus_profile extends Managed_DataObject
* @param DOMElement $feed
* @return string
*/
protected static function getAvatar($actor, $feed)
{
$url = '';
@ -1146,7 +1138,6 @@ class Ostatus_profile extends Managed_DataObject
* @return Ostatus_profile
* @throws Exception
*/
public static function ensureActorProfile($activity, $hints=array())
{
return self::ensureActivityObjectProfile($activity->actor, $hints);
@ -1163,7 +1154,6 @@ class Ostatus_profile extends Managed_DataObject
* @return Ostatus_profile
* @throws Exception
*/
public static function ensureActivityObjectProfile($object, $hints=array())
{
$profile = self::getActivityObjectProfile($object);
@ -1244,25 +1234,25 @@ class Ostatus_profile extends Managed_DataObject
if (!$homeuri) {
common_log(LOG_DEBUG, __METHOD__ . " empty actor profile URI: " . var_export($activity, true));
throw new Exception("No profile URI");
throw new Exception('No profile URI.');
}
$user = User::staticGet('uri', $homeuri);
if ($user) {
// TRANS: Exception.
throw new Exception(_m('Local user can\'t be referenced as remote.'));
throw new Exception(_m('Local user cannot be referenced as remote.'));
}
if (OStatusPlugin::localGroupFromUrl($homeuri)) {
// TRANS: Exception.
throw new Exception(_m('Local group can\'t be referenced as remote.'));
throw new Exception(_m('Local group cannot be referenced as remote.'));
}
$ptag = Profile_list::staticGet('uri', $homeuri);
if ($ptag) {
$local_user = User::staticGet('id', $ptag->tagger);
if (!empty($local_user)) {
throw new Exception("Local peopletag can't be referenced as remote.");
throw new Exception('Local people tag cannot be referenced as remote.');
}
}
@ -1315,7 +1305,7 @@ class Ostatus_profile extends Managed_DataObject
$oprofile->profile_id = $profile->insert();
if (!$oprofile->profile_id) {
// TRANS: Server exception.
throw new ServerException(_m('Can\'t save local profile.'));
throw new ServerException(_m('Cannot save local profile.'));
}
} else if ($object->type == ActivityObject::GROUP) {
$group = new User_group();
@ -1326,7 +1316,7 @@ class Ostatus_profile extends Managed_DataObject
$oprofile->group_id = $group->insert();
if (!$oprofile->group_id) {
// TRANS: Server exception.
throw new ServerException(_m('Can\'t save local profile.'));
throw new ServerException(_m('Cannot save local profile.'));
}
} else if ($object->type == ActivityObject::_LIST) {
$ptag = new Profile_list();
@ -1336,7 +1326,7 @@ class Ostatus_profile extends Managed_DataObject
$oprofile->peopletag_id = $ptag->insert();
if (!$oprofile->peopletag_id) {
throw new ServerException("Can't save local peopletag");
throw new ServerException('Cannot save local people tag.');
}
}
@ -1344,7 +1334,7 @@ class Ostatus_profile extends Managed_DataObject
if (!$ok) {
// TRANS: Server exception.
throw new ServerException(_m('Can\'t save OStatus profile.'));
throw new ServerException(_m('Cannot save OStatus profile.'));
}
$avatar = self::getActivityObjectAvatar($object, $hints);
@ -1666,7 +1656,6 @@ class Ostatus_profile extends Managed_DataObject
}
// Try looking it up
$oprofile = Ostatus_profile::staticGet('uri', 'acct:'.$addr);
if (!empty($oprofile)) {
@ -1695,7 +1684,6 @@ class Ostatus_profile extends Managed_DataObject
$hints = array_merge($hints, $dhints);
// If there's an Hcard, let's grab its info
if (array_key_exists('hcard', $hints)) {
if (!array_key_exists('profileurl', $hints) ||
$hints['hcard'] != $hints['profileurl']) {
@ -1705,7 +1693,6 @@ class Ostatus_profile extends Managed_DataObject
}
// If we got a feed URL, try that
if (array_key_exists('feedurl', $hints)) {
try {
common_log(LOG_INFO, "Discovery on acct:$addr with feed URL " . $hints['feedurl']);
@ -1719,7 +1706,6 @@ class Ostatus_profile extends Managed_DataObject
}
// If we got a profile page, try that!
if (array_key_exists('profileurl', $hints)) {
try {
common_log(LOG_INFO, "Discovery on acct:$addr with profile URL $profileUrl");
@ -1767,7 +1753,7 @@ class Ostatus_profile extends Managed_DataObject
if (!$profile_id) {
common_log_db_error($profile, 'INSERT', __FILE__);
// TRANS: Exception. %s is a webfinger address.
throw new Exception(sprintf(_m('Couldn\'t save profile for "%s".'),$addr));
throw new Exception(sprintf(_m('Could not save profile for "%s".'),$addr));
}
$oprofile = new Ostatus_profile();
@ -1786,7 +1772,7 @@ class Ostatus_profile extends Managed_DataObject
if (!$result) {
common_log_db_error($oprofile, 'INSERT', __FILE__);
// TRANS: Exception. %s is a webfinger address.
throw new Exception(sprintf(_m('Couldn\'t save ostatus_profile for "%s".'),$addr));
throw new Exception(sprintf(_m('Could not save ostatus_profile for "%s".'),$addr));
}
self::cacheSet(sprintf('ostatus_profile:webfinger:%s', $addr), $oprofile->uri);
@ -1794,7 +1780,7 @@ class Ostatus_profile extends Managed_DataObject
}
// TRANS: Exception. %s is a webfinger address.
throw new Exception(sprintf(_m('Couldn\'t find a valid profile for "%s".'),$addr));
throw new Exception(sprintf(_m('Could not find a valid profile for "%s".'),$addr));
}
/**
@ -1867,11 +1853,16 @@ class Ostatus_profile extends Managed_DataObject
$oprofile = Ostatus_profile::ensureWebfinger($rest);
break;
default:
throw new ServerException("Unrecognized URI protocol for profile: $protocol ($uri)");
// TRANS: Server exception.
// TRANS: %1$s is a protocol, %2$s is a URI.
throw new ServerException(sprintf(_m('Unrecognized URI protocol for profile: %1$s (%2$s).'),
$protocol,
$uri));
break;
}
} else {
throw new ServerException("No URI protocol for profile: ($uri)");
// TRANS: Server exception. %s is a URI.
throw new ServerException(sprintf(_m('No URI protocol for profile: %s.'),$uri));
}
}

View File

@ -26,7 +26,6 @@
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/
*/
class MagicEnvelope
{
const ENCODING = 'base64url';
@ -327,4 +326,3 @@ class MagicEnvelopeCompat extends MagicEnvelope {
return $env['data'];
}
}

View File

@ -123,7 +123,7 @@ class SalmonAction extends Action
break;
default:
// TRANS: Client exception.
throw new ClientException(_m("Unrecognized activity type."));
throw new ClientException(_m('Unrecognized activity type.'));
}
Event::handle('EndHandleSalmon', array($this->activity));
Event::handle('EndHandleSalmonTarget', array($this->activity, $this->target));
@ -133,59 +133,61 @@ class SalmonAction extends Action
function handlePost()
{
// TRANS: Client exception.
throw new ClientException(_m("This target doesn't understand posts."));
throw new ClientException(_m('This target does not understand posts.'));
}
function handleFollow()
{
// TRANS: Client exception.
throw new ClientException(_m("This target doesn't understand follows."));
throw new ClientException(_m('This target does not understand follows.'));
}
function handleUnfollow()
{
// TRANS: Client exception.
throw new ClientException(_m("This target doesn't understand unfollows."));
throw new ClientException(_m('This target does not understand unfollows.'));
}
function handleFavorite()
{
// TRANS: Client exception.
throw new ClientException(_m("This target doesn't understand favorites."));
throw new ClientException(_m('This target does not understand favorites.'));
}
function handleUnfavorite()
{
// TRANS: Client exception.
throw new ClientException(_m("This target doesn't understand unfavorites."));
throw new ClientException(_m('This target does not understand unfavorites.'));
}
function handleShare()
{
// TRANS: Client exception.
throw new ClientException(_m("This target doesn't understand share events."));
throw new ClientException(_m('This target does not understand share events.'));
}
function handleJoin()
{
// TRANS: Client exception.
throw new ClientException(_m("This target doesn't understand joins."));
throw new ClientException(_m('This target does not understand joins.'));
}
function handleLeave()
{
// TRANS: Client exception.
throw new ClientException(_m("This target doesn't understand leave events."));
throw new ClientException(_m('This target does not understand leave events.'));
}
function handleTag()
{
throw new ClientException(_m("This target doesn't understand tag events."));
// TRANS: Client exception.
throw new ClientException(_m('This target does not understand tag events.'));
}
function handleUntag()
{
throw new ClientException(_m("This target doesn't understand untag events."));
// TRANS: Client exception.
throw new ClientException(_m('This target does not understand untag events.'));
}
/**