$sender = Profile::staticGet('id', $from);
if (!$sender->hasRight(Right::NEWMESSAGE)) {
+ // TRANS: Client exception thrown when a user tries to send a direct message while being banned from sending them.
throw new ClientException(_('You are banned from sending direct messages.'));
}
if (!$result) {
common_log_db_error($msg, 'INSERT', __FILE__);
+ // TRANS: Message given when a message could not be stored on the server.
return _('Could not insert message.');
}
if (!$result) {
common_log_db_error($msg, 'UPDATE', __FILE__);
+ // TRANS: Message given when a message could not be updated on the server.
return _('Could not update message with new URI.');
}
'role' => $name));
if (empty($role)) {
- throw new Exception('Cannot revoke role "'.$name.'" for user #'.$this->id.'; does not exist.');
+ // TRANS: Exception thrown when trying to revoke an existing role for a user that does not exist.
+ // TRANS: %1$s is the role name, %2$s is the user ID.
+ throw new Exception(sprintf(_('Cannot revoke role "%s" for user #%2$s; does not exist.'),$name, $this->id));
}
$result = $role->delete();
if (!$result) {
common_log_db_error($role, 'DELETE', __FILE__);
- throw new Exception('Cannot revoke role "'.$name.'" for user #'.$this->id.'; database error.');
+ // TRANS: Exception thrown when trying to revoke a role for a user with a failing database query.
+ // TRANS: %1$s is the role name, %2$s is the user ID.
+ throw new Exception(sprintf(_('Cannot revoke role "%1$s" for user #%2$s; database error.'),$name, $this->id));
}
return true;
if ($profile) {
return $profile->hasright($right);
} else {
- throw new Exception("Missing profile");
+ // TRANS: Exception thrown when a right for a non-existing user profile is checked.
+ throw new Exception(_("Missing profile."));
}
}
}
$id = $snt->insert();
if (!$id) {
+ // TRANS: Exception thrown when a tag cannot be saved.
throw new Exception(_("Unable to save tag."));
}
}
}
if (!$subscriber->hasRight(Right::SUBSCRIBE)) {
+ // TRANS: Exception thrown when trying to subscribe while being banned from subscribing.
throw new Exception(_('You have been banned from subscribing.'));
}
if (self::exists($subscriber, $other)) {
+ // TRANS: Exception thrown when trying to subscribe while already subscribed.
throw new Exception(_('Already subscribed!'));
}
if ($other->hasBlocked($subscriber)) {
+ // TRANS: Exception thrown when trying to subscribe to a user who has blocked the subscribing user.
throw new Exception(_('User has blocked you.'));
}
if (!$result) {
common_log_db_error($sub, 'INSERT', __FILE__);
+ // TRANS: Exception thrown when a subscription could not be stored on the server.
throw new Exception(_('Could not save subscription.'));
}
* Cancel a subscription
*
*/
-
function cancel($subscriber, $other)
{
if (!self::exists($subscriber, $other)) {
+ // TRANS: Exception thrown when trying to unsibscribe without a subscription.
throw new Exception(_('Not subscribed!'));
}
// Don't allow deleting self subs
if ($subscriber->id == $other->id) {
- throw new Exception(_('Couldn\'t delete self-subscription.'));
+ // TRANS: Exception thrown when trying to unsubscribe a user from themselves.
+ throw new Exception(_('Could not delete self-subscription.'));
}
if (Event::handle('StartUnsubscribe', array($subscriber, $other))) {
if (!$result) {
common_log_db_error($token, 'DELETE', __FILE__);
- throw new Exception(_('Couldn\'t delete subscription OMB token.'));
+ // TRANS: Exception thrown when the OMB token for a subscription could not deleted on the server.
+ throw new Exception(_('Could not delete subscription OMB token.'));
}
} else {
common_log(LOG_ERR, "Couldn't find credentials with token {$token->tok}");
if (!$result) {
common_log_db_error($sub, 'DELETE', __FILE__);
- throw new Exception(_('Couldn\'t delete subscription.'));
+ // TRANS: Exception thrown when a subscription could not be deleted on the server.
+ throw new Exception(_('Could not delete subscription.'));
}
self::blow('user:notices_with_friends:%d', $subscriber->id);
__FILE__);
} else {
$notice = Notice::saveNew($welcomeuser->id,
+ // TRANS: Notice given on user registration.
+ // TRANS: %1$s is the sitename, $2$s is the registering user's nickname.
sprintf(_('Welcome to %1$s, @%2$s!'),
common_config('site', 'name'),
$user->nickname),
'system');
-
}
}
}
// Things we do when the email changes
-
function emailChanged()
{
if (!$result) {
common_log_db_error($group, 'INSERT', __FILE__);
+ // TRANS: Server exception thrown when creating a group failed.
throw new ServerException(_('Could not create group.'));
}
$result = $group->update($orig);
if (!$result) {
common_log_db_error($group, 'UPDATE', __FILE__);
+ // TRANS: Server exception thrown when updating a group URI failed.
throw new ServerException(_('Could not set group URI.'));
}
}
$result = $group->setAliases($aliases);
if (!$result) {
+ // TRANS: Server exception thrown when creating group aliases failed.
throw new ServerException(_('Could not create aliases.'));
}
if (!$result) {
common_log_db_error($member, 'INSERT', __FILE__);
+ // TRANS: Server exception thrown when setting group membership failed.
throw new ServerException(_('Could not set group membership.'));
}
if (!$result) {
common_log_db_error($local_group, 'INSERT', __FILE__);
+ // TRANS: Server exception thrown when saving local group information failed.
throw new ServerException(_('Could not save local group info.'));
}
}