* i18n/L10n update

* translator comments added
* remove superfluous whitespace
This commit is contained in:
Siebrand Mazeland 2010-09-19 15:17:36 +02:00
parent 07cd52afc7
commit 5a6f616206
26 changed files with 236 additions and 194 deletions

View File

@ -223,6 +223,7 @@ class OStatusPlugin extends Plugin
array('nickname' => $profile->nickname)); array('nickname' => $profile->nickname));
$output->element('a', array('href' => $url, $output->element('a', array('href' => $url,
'class' => 'entity_remote_subscribe'), 'class' => 'entity_remote_subscribe'),
// TRANS: Link description for link to subscribe to a remote user.
_m('Subscribe')); _m('Subscribe'));
$output->elementEnd('li'); $output->elementEnd('li');
@ -241,6 +242,7 @@ class OStatusPlugin extends Plugin
array('group' => $group->nickname)); array('group' => $group->nickname));
$output->element('a', array('href' => $url, $output->element('a', array('href' => $url,
'class' => 'entity_remote_subscribe'), 'class' => 'entity_remote_subscribe'),
// TRANS: Link description for link to join a remote group.
_m('Join')); _m('Join'));
} }
@ -453,6 +455,7 @@ class OStatusPlugin extends Plugin
} }
$url = $notice->url; $url = $notice->url;
// TRANSLATE: %s is a domain.
$title = sprintf(_m("Sent from %s via OStatus"), $domain); $title = sprintf(_m("Sent from %s via OStatus"), $domain);
return false; return false;
} }
@ -524,6 +527,7 @@ class OStatusPlugin extends Plugin
} }
if (!$oprofile->subscribe()) { if (!$oprofile->subscribe()) {
// TRANS: Exception.
throw new Exception(_m('Could not set up remote subscription.')); throw new Exception(_m('Could not set up remote subscription.'));
} }
} }
@ -563,10 +567,10 @@ class OStatusPlugin extends Plugin
common_date_iso8601(time())); common_date_iso8601(time()));
$act->time = time(); $act->time = time();
$act->title = _("Follow"); $act->title = _m("Follow");
// TRANS: Success message for subscribe to user attempt through OStatus. // TRANS: Success message for subscribe to user attempt through OStatus.
// TRANS: %1$s is the subscriber name, %2$s is the subscribed user's name. // TRANS: %1$s is the subscriber name, %2$s is the subscribed user's name.
$act->content = sprintf(_("%1$s is now following %2$s."), $act->content = sprintf(_m('%1$s is now following %2$s.'),
$subscriber->getBestName(), $subscriber->getBestName(),
$other->getBestName()); $other->getBestName());
@ -613,10 +617,10 @@ class OStatusPlugin extends Plugin
common_date_iso8601(time())); common_date_iso8601(time()));
$act->time = time(); $act->time = time();
$act->title = _("Unfollow"); $act->title = _m('Unfollow');
// TRANS: Success message for unsubscribe from user attempt through OStatus. // 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. // TRANS: %1$s is the unsubscriber's name, %2$s is the unsubscribed user's name.
$act->content = sprintf(_("%1$s stopped following %2$s."), $act->content = sprintf(_m('%1$s stopped following %2$s.'),
$profile->getBestName(), $profile->getBestName(),
$other->getBestName()); $other->getBestName());
@ -671,6 +675,7 @@ class OStatusPlugin extends Plugin
return true; return true;
} else { } else {
$oprofile->garbageCollect(); $oprofile->garbageCollect();
// TRANS: Exception.
throw new Exception(_m("Failed joining remote group.")); throw new Exception(_m("Failed joining remote group."));
} }
} }
@ -729,7 +734,6 @@ class OStatusPlugin extends Plugin
* @param Notice $notice being favored * @param Notice $notice being favored
* @return hook return value * @return hook return value
*/ */
function onEndFavorNotice(Profile $profile, Notice $notice) function onEndFavorNotice(Profile $profile, Notice $notice)
{ {
$user = User::staticGet('id', $profile->id); $user = User::staticGet('id', $profile->id);
@ -753,10 +757,10 @@ class OStatusPlugin extends Plugin
common_date_iso8601(time())); common_date_iso8601(time()));
$act->time = time(); $act->time = time();
$act->title = _("Favor"); $act->title = _m('Favor');
// TRANS: Success message for adding a favorite notice through OStatus. // TRANS: Success message for adding a favorite notice through OStatus.
// TRANS: %1$s is the favoring user's name, %2$s is URI to the favored notice. // TRANS: %1$s is the favoring user's name, %2$s is URI to the favored notice.
$act->content = sprintf(_("%1$s marked notice %2$s as a favorite."), $act->content = sprintf(_m('%1$s marked notice %2$s as a favorite.'),
$profile->getBestName(), $profile->getBestName(),
$notice->uri); $notice->uri);
@ -799,10 +803,10 @@ class OStatusPlugin extends Plugin
$notice->id, $notice->id,
common_date_iso8601(time())); common_date_iso8601(time()));
$act->time = time(); $act->time = time();
$act->title = _("Disfavor"); $act->title = _m('Disfavor');
// TRANS: Success message for remove a favorite notice through OStatus. // TRANS: Success message for remove a favorite notice through OStatus.
// TRANS: %1$s is the unfavoring user's name, %2$s is URI to the no longer favored notice. // TRANS: %1$s is the unfavoring user's name, %2$s is URI to the no longer favored notice.
$act->content = sprintf(_("%1$s marked notice %2$s as no longer a favorite."), $act->content = sprintf(_m('%1$s marked notice %2$s as no longer a favorite.'),
$profile->getBestName(), $profile->getBestName(),
$notice->uri); $notice->uri);
@ -876,8 +880,9 @@ class OStatusPlugin extends Plugin
$action->elementStart('p', array('id' => 'entity_remote_subscribe', $action->elementStart('p', array('id' => 'entity_remote_subscribe',
'class' => 'entity_subscribe')); 'class' => 'entity_subscribe'));
$action->element('a', array('href' => common_local_url($target), $action->element('a', array('href' => common_local_url($target),
'class' => 'entity_remote_subscribe') 'class' => 'entity_remote_subscribe'),
, _m('Remote')); // @todo: i18n: Add translator hint for this text. // TRANS: Link text for link to remote subscribe.
_m('Remote'));
$action->elementEnd('p'); $action->elementEnd('p');
$action->elementEnd('div'); $action->elementEnd('div');
} }
@ -916,6 +921,7 @@ class OStatusPlugin extends Plugin
$profile->id, $profile->id,
common_date_iso8601(time())); common_date_iso8601(time()));
$act->time = time(); $act->time = time();
// TRANS: Title for activity.
$act->title = _m("Profile update"); $act->title = _m("Profile update");
// TRANS: Ping text for remote profile update through OStatus. // TRANS: Ping text for remote profile update through OStatus.
// TRANS: %s is user that updated their profile. // TRANS: %s is user that updated their profile.
@ -948,7 +954,8 @@ class OStatusPlugin extends Plugin
array('nickname' => $profileUser->nickname)); array('nickname' => $profileUser->nickname));
$output->element('a', array('href' => $url, $output->element('a', array('href' => $url,
'class' => 'entity_remote_subscribe'), 'class' => 'entity_remote_subscribe'),
_m('Subscribe')); // @todo: i18n: Add context. // TRANS: Link text for a user to subscribe to an OStatus user.
_m('Subscribe'));
$output->elementEnd('li'); $output->elementEnd('li');
} }
} }
@ -962,9 +969,9 @@ class OStatusPlugin extends Plugin
'version' => STATUSNET_VERSION, 'version' => STATUSNET_VERSION,
'author' => 'Evan Prodromou, James Walker, Brion Vibber, Zach Copley', 'author' => 'Evan Prodromou, James Walker, Brion Vibber, Zach Copley',
'homepage' => 'http://status.net/wiki/Plugin:OStatus', 'homepage' => 'http://status.net/wiki/Plugin:OStatus',
'rawdescription' => // TRANS: Plugin description.
_m('Follow people across social networks that implement '. 'rawdescription' => _m('Follow people across social networks that implement '.
'<a href="http://ostatus.org/">OStatus</a>.')); // @todo i18n: Add translator hint. '<a href="http://ostatus.org/">OStatus</a>.'));
return true; return true;
} }

View File

@ -17,15 +17,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/**
* @package OStatusPlugin
* @author James Walker <james@status.net>
*/
if (!defined('STATUSNET')) { if (!defined('STATUSNET')) {
exit(1); exit(1);
} }
/**
* @package OStatusPlugin
* @author James Walker <james@status.net>
*/
class GroupsalmonAction extends SalmonAction class GroupsalmonAction extends SalmonAction
{ {
var $group = null; var $group = null;
@ -37,17 +36,20 @@ class GroupsalmonAction extends SalmonAction
$id = $this->trimmed('id'); $id = $this->trimmed('id');
if (!$id) { if (!$id) {
$this->clientError(_('No ID.')); // TRANS: Client error.
$this->clientError(_m('No ID.'));
} }
$this->group = User_group::staticGet('id', $id); $this->group = User_group::staticGet('id', $id);
if (empty($this->group)) { if (empty($this->group)) {
$this->clientError(_('No such group.')); // TRANS: Client error.
$this->clientError(_m('No such group.'));
} }
$oprofile = Ostatus_profile::staticGet('group_id', $id); $oprofile = Ostatus_profile::staticGet('group_id', $id);
if ($oprofile) { if ($oprofile) {
// TRANS: Client error.
$this->clientError(_m("Can't accept remote posts for a remote group.")); $this->clientError(_m("Can't accept remote posts for a remote group."));
} }
@ -57,7 +59,6 @@ class GroupsalmonAction extends SalmonAction
/** /**
* We've gotten a post event on the Salmon backchannel, probably a reply. * We've gotten a post event on the Salmon backchannel, probably a reply.
*/ */
function handlePost() function handlePost()
{ {
// @fixme process all objects? // @fixme process all objects?
@ -69,18 +70,20 @@ class GroupsalmonAction extends SalmonAction
case ActivityObject::COMMENT: case ActivityObject::COMMENT:
break; break;
default: default:
// TRANS: Client exception.
throw new ClientException("Can't handle that kind of post."); throw new ClientException("Can't handle that kind of post.");
} }
// Notice must be to the attention of this group // Notice must be to the attention of this group
$context = $this->activity->context; $context = $this->activity->context;
if (empty($context->attention)) { if (empty($context->attention)) {
// TRANS: Client exception.
throw new ClientException("Not to the attention of anyone."); throw new ClientException("Not to the attention of anyone.");
} else { } else {
$uri = common_local_url('groupbyid', array('id' => $this->group->id)); $uri = common_local_url('groupbyid', array('id' => $this->group->id));
if (!in_array($uri, $context->attention)) { if (!in_array($uri, $context->attention)) {
// TRANS: Client exception.
throw new ClientException("Not to the attention of this group."); throw new ClientException("Not to the attention of this group.");
} }
} }
@ -116,14 +119,15 @@ class GroupsalmonAction extends SalmonAction
* currently we're doing the main logic in joingroup action * currently we're doing the main logic in joingroup action
* and so have to repeat it here. * and so have to repeat it here.
*/ */
function handleJoin() function handleJoin()
{ {
$oprofile = $this->ensureProfile(); $oprofile = $this->ensureProfile();
if (!$oprofile) { if (!$oprofile) {
// TRANS: Client error.
$this->clientError(_m("Can't read profile to set up group membership.")); $this->clientError(_m("Can't read profile to set up group membership."));
} }
if ($oprofile->isGroup()) { if ($oprofile->isGroup()) {
// TRANS: Client error.
$this->clientError(_m("Groups can't join groups.")); $this->clientError(_m("Groups can't join groups."));
} }
@ -137,7 +141,7 @@ class GroupsalmonAction extends SalmonAction
} }
if (Group_block::isBlocked($this->group, $profile)) { if (Group_block::isBlocked($this->group, $profile)) {
$this->clientError(_('You have been blocked from that group by the admin.'), 403); $this->clientError(_m('You have been blocked from that group by the admin.'), 403);
return false; return false;
} }
@ -151,6 +155,7 @@ class GroupsalmonAction extends SalmonAction
//Event::handle('EndJoinGroup', array($this->group, $profile)); //Event::handle('EndJoinGroup', array($this->group, $profile));
//} //}
} catch (Exception $e) { } catch (Exception $e) {
// TRANS: Server error. %1$s is a profile URI, %2$s is a group nickname.
$this->serverError(sprintf(_m('Could not join remote user %1$s to group %2$s.'), $this->serverError(sprintf(_m('Could not join remote user %1$s to group %2$s.'),
$oprofile->uri, $this->group->nickname)); $oprofile->uri, $this->group->nickname));
} }
@ -159,7 +164,6 @@ class GroupsalmonAction extends SalmonAction
/** /**
* A remote user left our group. * A remote user left our group.
*/ */
function handleLeave() function handleLeave()
{ {
$oprofile = $this->ensureProfile(); $oprofile = $this->ensureProfile();
@ -180,10 +184,10 @@ class GroupsalmonAction extends SalmonAction
//Event::handle('EndLeaveGroup', array($this->group, $profile)); //Event::handle('EndLeaveGroup', array($this->group, $profile));
//} //}
} catch (Exception $e) { } catch (Exception $e) {
// TRANS: Server error. %1$s is a profile URI, %2$s is a group nickname.
$this->serverError(sprintf(_m('Could not remove remote user %1$s from group %2$s.'), $this->serverError(sprintf(_m('Could not remove remote user %1$s from group %2$s.'),
$oprofile->uri, $this->group->nickname)); $oprofile->uri, $this->group->nickname));
return; return;
} }
} }
} }

View File

@ -26,7 +26,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
class HostMetaAction extends Action class HostMetaAction extends Action
{ {
function handle() function handle()
{ {
parent::handle(); parent::handle();

View File

@ -72,13 +72,16 @@ class OStatusGroupAction extends OStatusSubAction
$this->elementStart('ul', 'form_data'); $this->elementStart('ul', 'form_data');
$this->elementStart('li'); $this->elementStart('li');
$this->input('profile', $this->input('profile',
// TRANS: Field label.
_m('Join group'), _m('Join group'),
$this->profile_uri, $this->profile_uri,
// TRANS: Tooltip for field label "Join group".
_m("OStatus group's address, like http://example.net/group/nickname.")); _m("OStatus group's address, like http://example.net/group/nickname."));
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementEnd('ul'); $this->elementEnd('ul');
$this->submit('validate', _m('Continue')); // TRANS: Button text.
$this->submit('validate', _m('BUTTON','Continue'));
$this->elementEnd('fieldset'); $this->elementEnd('fieldset');
@ -156,7 +159,6 @@ class OStatusGroupAction extends OStatusSubAction
* *
* @return string Title of the page * @return string Title of the page
*/ */
function title() function title()
{ {
// TRANS: Page title for OStatus remote group join form // TRANS: Page title for OStatus remote group join form
@ -168,9 +170,9 @@ class OStatusGroupAction extends OStatusSubAction
* *
* @return instructions for use * @return instructions for use
*/ */
function getInstructions() function getInstructions()
{ {
// TRANS: Instructions.
return _m('You can subscribe to groups from other supported sites. Paste the group\'s profile URI below:'); return _m('You can subscribe to groups from other supported sites. Paste the group\'s profile URI below:');
} }

View File

@ -27,7 +27,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
class OStatusInitAction extends Action class OStatusInitAction extends Action
{ {
var $nickname; var $nickname;
var $group; var $group;
var $profile; var $profile;
@ -38,6 +37,7 @@ class OStatusInitAction extends Action
parent::prepare($args); parent::prepare($args);
if (common_logged_in()) { if (common_logged_in()) {
// TRANS: Client error.
$this->clientError(_m('You can use the local subscription!')); $this->clientError(_m('You can use the local subscription!'));
return false; return false;
} }
@ -78,6 +78,7 @@ class OStatusInitAction extends Action
$this->xw->startDocument('1.0', 'UTF-8'); $this->xw->startDocument('1.0', 'UTF-8');
$this->elementStart('html'); $this->elementStart('html');
$this->elementStart('head'); $this->elementStart('head');
// TRANS: Form title.
$this->element('title', null, _m('Subscribe to user')); $this->element('title', null, _m('Subscribe to user'));
$this->elementEnd('head'); $this->elementEnd('head');
$this->elementStart('body'); $this->elementStart('body');
@ -92,11 +93,15 @@ class OStatusInitAction extends Action
function showContent() function showContent()
{ {
if ($this->group) { if ($this->group) {
// TRANS: Form legend.
$header = sprintf(_m('Join group %s'), $this->group); $header = sprintf(_m('Join group %s'), $this->group);
$submit = _m('Join'); // TRANS: Button text.
$submit = _m('BUTTON','Join');
} else { } else {
// TRANS: Form legend.
$header = sprintf(_m('Subscribe to %s'), $this->nickname); $header = sprintf(_m('Subscribe to %s'), $this->nickname);
$submit = _m('Subscribe'); // TRANS: Button text.
$submit = _m('BUTTON','Subscribe');
} }
$this->elementStart('form', array('id' => 'form_ostatus_connect', $this->elementStart('form', array('id' => 'form_ostatus_connect',
'method' => 'post', 'method' => 'post',
@ -108,12 +113,15 @@ class OStatusInitAction extends Action
$this->elementStart('ul', 'form_data'); $this->elementStart('ul', 'form_data');
$this->elementStart('li', array('id' => 'ostatus_nickname')); $this->elementStart('li', array('id' => 'ostatus_nickname'));
// TRANS: Field label.
$this->input('nickname', _m('User nickname'), $this->nickname, $this->input('nickname', _m('User nickname'), $this->nickname,
_m('Nickname of the user you want to follow.')); _m('Nickname of the user you want to follow.'));
$this->hidden('group', $this->group); // pass-through for magic links $this->hidden('group', $this->group); // pass-through for magic links
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementStart('li', array('id' => 'ostatus_profile')); $this->elementStart('li', array('id' => 'ostatus_profile'));
// TRANS: Field label.
$this->input('profile', _m('Profile Account'), $this->profile, $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('li');
$this->elementEnd('ul'); $this->elementEnd('ul');
@ -135,6 +143,7 @@ class OStatusInitAction extends Action
} elseif (strpos($this->profile, '@') !== false) { } elseif (strpos($this->profile, '@') !== false) {
$this->connectWebfinger($this->profile); $this->connectWebfinger($this->profile);
} else { } else {
// TRANS: Client error.
$this->clientError(_m("Must provide a remote profile.")); $this->clientError(_m("Must provide a remote profile."));
} }
} }
@ -146,6 +155,7 @@ class OStatusInitAction extends Action
$disco = new Discovery; $disco = new Discovery;
$result = $disco->lookup($acct); $result = $disco->lookup($acct);
if (!$result) { if (!$result) {
// TRANS: Client error.
$this->clientError(_m("Couldn't look up OStatus account profile.")); $this->clientError(_m("Couldn't look up OStatus account profile."));
} }
@ -158,6 +168,7 @@ class OStatusInitAction extends Action
} }
} }
// TRANS: Client error.
$this->clientError(_m("Couldn't confirm remote profile address.")); $this->clientError(_m("Couldn't confirm remote profile address."));
} }
@ -183,6 +194,7 @@ class OStatusInitAction extends Action
if ($user) { if ($user) {
return common_local_url('userbyid', array('id' => $user->id)); return common_local_url('userbyid', array('id' => $user->id));
} else { } else {
// TRANS: Client error.
$this->clientError("No such user."); $this->clientError("No such user.");
} }
} else if ($this->group) { } else if ($this->group) {
@ -190,16 +202,18 @@ class OStatusInitAction extends Action
if ($group) { if ($group) {
return common_local_url('groupbyid', array('id' => $group->group_id)); return common_local_url('groupbyid', array('id' => $group->group_id));
} else { } else {
// TRANS: Client error.
$this->clientError("No such group."); $this->clientError("No such group.");
} }
} else { } else {
// TRANS: Client error.
$this->clientError("No local user or group nickname provided."); $this->clientError("No local user or group nickname provided.");
} }
} }
function title() function title()
{ {
// TRANS: Page title.
return _m('OStatus Connect'); return _m('OStatus Connect');
} }
} }

View File

@ -62,13 +62,15 @@ class OStatusSubAction extends Action
$this->elementStart('ul', 'form_data'); $this->elementStart('ul', 'form_data');
$this->elementStart('li'); $this->elementStart('li');
$this->input('profile', $this->input('profile',
// TRANS: Field label for a field that takes an OStatus user address.
_m('Subscribe to'), _m('Subscribe to'),
$this->profile_uri, $this->profile_uri,
_m("OStatus user's address, like nickname@example.com or http://example.net/nickname")); // @todo i18n FIXME: needs context/translator hint. // TRANS: Tooltip for field label "Subscribe to".
_m('OStatus user\'s address, like nickname@example.com or http://example.net/nickname'));
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementEnd('ul'); $this->elementEnd('ul');
// TRANS: Button text.
$this->submit('validate', _m('Continue')); // @todo i18n FIXME: needs context/translator hint. $this->submit('validate', _m('BUTTON','Continue'));
$this->elementEnd('fieldset'); $this->elementEnd('fieldset');
@ -103,10 +105,14 @@ class OStatusSubAction extends Action
$this->hidden('profile', $this->profile_uri); $this->hidden('profile', $this->profile_uri);
if ($this->oprofile->isGroup()) { if ($this->oprofile->isGroup()) {
$this->submit('submit', _m('Join'), 'submit', null, $this->submit('submit', _m('Join'), 'submit', null,
_m('Join this group')); // @todo i18n FIXME: needs context/translator hint. // TRANS: Button text.
// TRANS: Tooltip for button "Join".
_m('BUTTON','Join this group'));
} else { } else {
$this->submit('submit', _m('Confirm'), 'submit', null, // TRANS: Button text.
_m('Subscribe to this user')); // @todo i18n FIXME: needs context/translator hint. $this->submit('submit', _m('BUTTON','Confirm'), 'submit', null,
// TRANS: Tooltip for button "Confirm".
_m('Subscribe to this user'));
} }
$this->elementEnd('fieldset'); $this->elementEnd('fieldset');
$this->elementEnd('form'); $this->elementEnd('form');
@ -156,7 +162,7 @@ class OStatusSubAction extends Action
$this->elementStart('div', 'entity_profile vcard'); $this->elementStart('div', 'entity_profile vcard');
$this->elementStart('dl', 'entity_depiction'); $this->elementStart('dl', 'entity_depiction');
$this->element('dt', null, _('Photo')); $this->element('dt', null, _m('Photo'));
$this->elementStart('dd'); $this->elementStart('dd');
$this->element('img', array('src' => $avatar, $this->element('img', array('src' => $avatar,
'class' => 'photo avatar', 'class' => 'photo avatar',
@ -167,7 +173,7 @@ class OStatusSubAction extends Action
$this->elementEnd('dl'); $this->elementEnd('dl');
$this->elementStart('dl', 'entity_nickname'); $this->elementStart('dl', 'entity_nickname');
$this->element('dt', null, _('Nickname')); $this->element('dt', null, _m('Nickname'));
$this->elementStart('dd'); $this->elementStart('dd');
$hasFN = ($fullname !== '') ? 'nickname' : 'fn nickname'; $hasFN = ($fullname !== '') ? 'nickname' : 'fn nickname';
$this->elementStart('a', array('href' => $profile, $this->elementStart('a', array('href' => $profile,
@ -188,7 +194,7 @@ class OStatusSubAction extends Action
} }
if (!is_null($location)) { if (!is_null($location)) {
$this->elementStart('dl', 'entity_location'); $this->elementStart('dl', 'entity_location');
$this->element('dt', null, _('Location')); $this->element('dt', null, _m('Location'));
$this->elementStart('dd', 'label'); $this->elementStart('dd', 'label');
$this->raw($location); $this->raw($location);
$this->elementEnd('dd'); $this->elementEnd('dd');
@ -197,7 +203,7 @@ class OStatusSubAction extends Action
if (!is_null($homepage)) { if (!is_null($homepage)) {
$this->elementStart('dl', 'entity_url'); $this->elementStart('dl', 'entity_url');
$this->element('dt', null, _('URL')); $this->element('dt', null, _m('URL'));
$this->elementStart('dd'); $this->elementStart('dd');
$this->elementStart('a', array('href' => $homepage, $this->elementStart('a', array('href' => $homepage,
'class' => 'url')); 'class' => 'url'));
@ -209,7 +215,7 @@ class OStatusSubAction extends Action
if (!is_null($note)) { if (!is_null($note)) {
$this->elementStart('dl', 'entity_note'); $this->elementStart('dl', 'entity_note');
$this->element('dt', null, _('Note')); $this->element('dt', null, _m('Note'));
$this->elementStart('dd', 'note'); $this->elementStart('dd', 'note');
$this->raw($note); $this->raw($note);
$this->elementEnd('dd'); $this->elementEnd('dd');
@ -244,31 +250,39 @@ class OStatusSubAction extends Action
} else if (Validate::uri($this->profile_uri)) { } else if (Validate::uri($this->profile_uri)) {
$this->oprofile = Ostatus_profile::ensureProfileURL($this->profile_uri); $this->oprofile = Ostatus_profile::ensureProfileURL($this->profile_uri);
} else { } else {
// TRANS: Error text.
$this->error = _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."); $this->error = _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.");
common_debug('Invalid address format.', __FILE__); common_debug('Invalid address format.', __FILE__);
return false; return false;
} }
return true; return true;
} catch (FeedSubBadURLException $e) { } catch (FeedSubBadURLException $e) {
// TRANS: Error text.
$this->error = _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."); $this->error = _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.");
common_debug('Invalid URL or could not reach server.', __FILE__); common_debug('Invalid URL or could not reach server.', __FILE__);
} catch (FeedSubBadResponseException $e) { } catch (FeedSubBadResponseException $e) {
// TRANS: Error text.
$this->error = _m("Sorry, we could not reach that feed. Please try that OStatus address again later."); $this->error = _m("Sorry, we could not reach that feed. Please try that OStatus address again later.");
common_debug('Cannot read feed; server returned error.', __FILE__); common_debug('Cannot read feed; server returned error.', __FILE__);
} catch (FeedSubEmptyException $e) { } catch (FeedSubEmptyException $e) {
// TRANS: Error text.
$this->error = _m("Sorry, we could not reach that feed. Please try that OStatus address again later."); $this->error = _m("Sorry, we could not reach that feed. Please try that OStatus address again later.");
common_debug('Cannot read feed; server returned an empty page.', __FILE__); common_debug('Cannot read feed; server returned an empty page.', __FILE__);
} catch (FeedSubBadHTMLException $e) { } catch (FeedSubBadHTMLException $e) {
// TRANS: Error text.
$this->error = _m("Sorry, we could not reach that feed. Please try that OStatus address again later."); $this->error = _m("Sorry, we could not reach that feed. Please try that OStatus address again later.");
common_debug('Bad HTML, could not find feed link.', __FILE__); common_debug('Bad HTML, could not find feed link.', __FILE__);
} catch (FeedSubNoFeedException $e) { } catch (FeedSubNoFeedException $e) {
// TRANS: Error text.
$this->error = _m("Sorry, we could not reach that feed. Please try that OStatus address again later."); $this->error = _m("Sorry, we could not reach that feed. Please try that OStatus address again later.");
common_debug('Could not find a feed linked from this URL.', __FILE__); common_debug('Could not find a feed linked from this URL.', __FILE__);
} catch (FeedSubUnrecognizedTypeException $e) { } catch (FeedSubUnrecognizedTypeException $e) {
// TRANS: Error text.
$this->error = _m("Sorry, we could not reach that feed. Please try that OStatus address again later."); $this->error = _m("Sorry, we could not reach that feed. Please try that OStatus address again later.");
common_debug('Not a recognized feed type.', __FILE__); common_debug('Not a recognized feed type.', __FILE__);
} catch (Exception $e) { } catch (Exception $e) {
// Any new ones we forgot about // Any new ones we forgot about
// TRANS: Error text.
$this->error = _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."); $this->error = _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.");
common_debug(sprintf('Bad feed URL: %s %s', get_class($e), $e->getMessage()), __FILE__); common_debug(sprintf('Bad feed URL: %s %s', get_class($e), $e->getMessage()), __FILE__);
} }
@ -350,7 +364,7 @@ class OStatusSubAction extends Action
// CSRF protection // CSRF protection
$token = $this->trimmed('token'); $token = $this->trimmed('token');
if (!$token || $token != common_session_token()) { if (!$token || $token != common_session_token()) {
$this->showForm(_('There was a problem with your session token. '. $this->showForm(_m('There was a problem with your session token. '.
'Try again, please.')); 'Try again, please.'));
return; return;
} }
@ -377,6 +391,7 @@ class OStatusSubAction extends Action
$this->xw->startDocument('1.0', 'UTF-8'); $this->xw->startDocument('1.0', 'UTF-8');
$this->elementStart('html'); $this->elementStart('html');
$this->elementStart('head'); $this->elementStart('head');
// TRANS: Form title.
$this->element('title', null, _m('Subscribe to user')); $this->element('title', null, _m('Subscribe to user'));
$this->elementEnd('head'); $this->elementEnd('head');
$this->elementStart('body'); $this->elementStart('body');
@ -408,6 +423,7 @@ class OStatusSubAction extends Action
function getInstructions() function getInstructions()
{ {
// TRANS: Instructions.
return _m('You can subscribe to users from other supported sites. Paste their address or profile URI below:'); return _m('You can subscribe to users from other supported sites. Paste their address or profile URI below:');
} }
@ -426,7 +442,6 @@ class OStatusSubAction extends Action
* *
* @return void * @return void
*/ */
function showContent() function showContent()
{ {
if ($this->oprofile) { if ($this->oprofile) {
@ -459,5 +474,4 @@ class OStatusSubAction extends Action
function showNoticeForm() { function showNoticeForm() {
// nop // nop
} }
} }

View File

@ -34,7 +34,7 @@ class OwnerxrdAction extends XrdAction
$this->user = User::siteOwner(); $this->user = User::siteOwner();
if (!$this->user) { if (!$this->user) {
$this->clientError(_('No such user.'), 404); $this->clientError(_m('No such user.'), 404);
return false; return false;
} }

View File

@ -24,7 +24,6 @@
if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
class PushCallbackAction extends Action class PushCallbackAction extends Action
{ {
function handle() function handle()
@ -46,13 +45,13 @@ class PushCallbackAction extends Action
$feedid = $this->arg('feed'); $feedid = $this->arg('feed');
common_log(LOG_INFO, "POST for feed id $feedid"); common_log(LOG_INFO, "POST for feed id $feedid");
if (!$feedid) { if (!$feedid) {
throw new ServerException('Empty or invalid feed id.', 400); throw new ServerException(_m('Empty or invalid feed id.'), 400);
} }
$feedsub = FeedSub::staticGet('id', $feedid); $feedsub = FeedSub::staticGet('id', $feedid);
if (!$feedsub) { if (!$feedsub) {
// @todo i18n FIXME: added i18n and use sprintf when using parameters. // TRANS: Server exception. %s is a feed ID.
throw new ServerException('Unknown PuSH feed id ' . $feedid, 400); throw new ServerException(sprintf(_m('Unknown PuSH feed id %s'),$feedid), 400);
} }
$hmac = ''; $hmac = '';
@ -84,30 +83,31 @@ class PushCallbackAction extends Action
$verify_token = $this->arg('hub_verify_token'); $verify_token = $this->arg('hub_verify_token');
if ($mode != 'subscribe' && $mode != 'unsubscribe') { if ($mode != 'subscribe' && $mode != 'unsubscribe') {
throw new ClientException("Bad hub.mode $mode", 404); // TRANS: Client exception. %s is an invalid value for hub.mode.
throw new ClientException(sprintf(_m('Bad hub.mode "$s".',$mode)), 404);
} }
$feedsub = FeedSub::staticGet('uri', $topic); $feedsub = FeedSub::staticGet('uri', $topic);
if (!$feedsub) { if (!$feedsub) {
// @todo i18n FIXME: added i18n and use sprintf when using parameters. // TRANS: Client exception. %s is an invalid feed name.
throw new ClientException("Bad hub.topic feed $topic.", 404); throw new ClientException(sprintf(_m('Bad hub.topic feed "%s".'),$topic), 404);
} }
if ($feedsub->verify_token !== $verify_token) { if ($feedsub->verify_token !== $verify_token) {
// @todo i18n FIXME: added i18n and use sprintf when using parameters. // TRANS: Client exception. %1$s the invalid token, %2$s is the topic for which the invalid token was given.
throw new ClientException("Bad hub.verify_token $token for $topic.", 404); throw new ClientException(sprintf(_m('Bad hub.verify_token %1$s for %2$s.'),$token,$topic), 404);
} }
if ($mode == 'subscribe') { if ($mode == 'subscribe') {
// We may get re-sub requests legitimately. // We may get re-sub requests legitimately.
if ($feedsub->sub_state != 'subscribe' && $feedsub->sub_state != 'active') { if ($feedsub->sub_state != 'subscribe' && $feedsub->sub_state != 'active') {
// @todo i18n FIXME: added i18n and use sprintf when using parameters. // TRANS: Client exception. %s is an invalid topic.
throw new ClientException("Unexpected subscribe request for $topic.", 404); throw new ClientException(sprintf(_m('Unexpected subscribe request for %s.'),$topic), 404);
} }
} else { } else {
if ($feedsub->sub_state != 'unsubscribe') { if ($feedsub->sub_state != 'unsubscribe') {
// @todo i18n FIXME: added i18n and use sprintf when using parameters. // TRANS: Client exception. %s is an invalid topic.
throw new ClientException("Unexpected unsubscribe request for $topic.", 404); throw new ClientException(sprintf(_m('Unexpected unsubscribe request for %s.'),$topic), 404);
} }
} }

View File

@ -62,11 +62,11 @@ class PushHubAction extends Action
$this->subunsub($mode); $this->subunsub($mode);
break; break;
case "publish": case "publish":
// @todo i18n FIXME: added i18n and use sprintf when using parameters. // TRANS: Client exception.
throw new ClientException("Publishing outside feeds not supported.", 400); throw new ClientException(_m('Publishing outside feeds not supported.'), 400);
default: default:
// @todo i18n FIXME: added i18n and use sprintf when using parameters. // TRANS: Client exception. %s is a mode.
throw new ClientException("Unrecognized mode '$mode'.", 400); throw new ClientException(sprintf(_m('Unrecognized mode "%s".'),$mode), 400);
} }
} }
@ -85,28 +85,28 @@ class PushHubAction extends Action
$topic = $this->argUrl('hub.topic'); $topic = $this->argUrl('hub.topic');
if (!$this->recognizedFeed($topic)) { if (!$this->recognizedFeed($topic)) {
// @todo i18n FIXME: added i18n and use sprintf when using parameters. // TRANS: Client exception. %s is a topic.
throw new ClientException("Unsupported hub.topic $topic; this hub only serves local user and group Atom feeds."); throw new ClientException(sprintf(_m('Unsupported hub.topic %s this hub only serves local user and group Atom feeds.'),$topic));
} }
$verify = $this->arg('hub.verify'); // @fixme may be multiple $verify = $this->arg('hub.verify'); // @fixme may be multiple
if ($verify != 'sync' && $verify != 'async') { if ($verify != 'sync' && $verify != 'async') {
// @todo i18n FIXME: added i18n and use sprintf when using parameters. // TRANS: Client exception.
throw new ClientException("Invalid hub.verify $verify; must be 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); $lease = $this->arg('hub.lease_seconds', null);
if ($mode == 'subscribe' && $lease != '' && !preg_match('/^\d+$/', $lease)) { if ($mode == 'subscribe' && $lease != '' && !preg_match('/^\d+$/', $lease)) {
// @todo i18n FIXME: added i18n and use sprintf when using parameters. // TRANS: Client exception.
throw new ClientException("Invalid hub.lease $lease; must be empty or positive integer."); throw new ClientException(sprintf(_m('Invalid hub.lease "%s". It must be empty or positive integer.'),$lease));
} }
$token = $this->arg('hub.verify_token', null); $token = $this->arg('hub.verify_token', null);
$secret = $this->arg('hub.secret', null); $secret = $this->arg('hub.secret', null);
if ($secret != '' && strlen($secret) >= 200) { if ($secret != '' && strlen($secret) >= 200) {
// @todo i18n FIXME: added i18n and use sprintf when using parameters. // TRANS: Client exception.
throw new ClientException("Invalid hub.secret $secret; must be under 200 bytes."); throw new ClientException(sprintf(_m('Invalid hub.secret "%s". It must be under 200 bytes.'),$secret));
} }
$sub = HubSub::staticGet($topic, $callback); $sub = HubSub::staticGet($topic, $callback);
@ -157,8 +157,8 @@ class PushHubAction extends Action
if ($feed == $userFeed) { if ($feed == $userFeed) {
$user = User::staticGet('id', $id); $user = User::staticGet('id', $id);
if (!$user) { if (!$user) {
// @todo i18n FIXME: added i18n and use sprintf when using parameters. // TRANS: Client exception.
throw new ClientException("Invalid hub.topic $feed; user doesn't exist."); throw new ClientException(sprintt(_m('Invalid hub.topic "%s". User doesn\'t exist.'),$feed));
} else { } else {
return true; return true;
} }
@ -166,8 +166,8 @@ class PushHubAction extends Action
if ($feed == $groupFeed) { if ($feed == $groupFeed) {
$user = User_group::staticGet('id', $id); $user = User_group::staticGet('id', $id);
if (!$user) { if (!$user) {
// @todo i18n FIXME: added i18n and use sprintf when using parameters. // TRANS: Client exception.
throw new ClientException("Invalid hub.topic $feed; group doesn't exist."); throw new ClientException(sprintf(_m('Invalid hub.topic "%s". Group doesn\'t exist.'),$feed));
} else { } else {
return true; return true;
} }
@ -190,8 +190,9 @@ class PushHubAction extends Action
if (Validate::uri($url, $params)) { if (Validate::uri($url, $params)) {
return $url; return $url;
} else { } else {
// @todo i18n FIXME: added i18n and use sprintf when using parameters. // TRANS: Client exception.
throw new ClientException("Invalid URL passed for $arg: '$url'"); // TRANS: %1$s is this argument to the method this exception occurs in, %2$s is a URL.
throw new ClientException(sprintf(_m('Invalid URL passed for %1$s: "%2$s"'),$arg,$url));
} }
} }

View File

@ -17,15 +17,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/**
* @package OStatusPlugin
* @author James Walker <james@status.net>
*/
if (!defined('STATUSNET')) { if (!defined('STATUSNET')) {
exit(1); exit(1);
} }
/**
* @package OStatusPlugin
* @author James Walker <james@status.net>
*/
class UsersalmonAction extends SalmonAction class UsersalmonAction extends SalmonAction
{ {
function prepare($args) function prepare($args)
@ -35,13 +34,13 @@ class UsersalmonAction extends SalmonAction
$id = $this->trimmed('id'); $id = $this->trimmed('id');
if (!$id) { if (!$id) {
$this->clientError(_('No ID.')); $this->clientError(_m('No ID.'));
} }
$this->user = User::staticGet('id', $id); $this->user = User::staticGet('id', $id);
if (empty($this->user)) { if (empty($this->user)) {
$this->clientError(_('No such user.')); $this->clientError(_m('No such user.'));
} }
return true; return true;
@ -78,20 +77,24 @@ class UsersalmonAction extends SalmonAction
if (!empty($context->replyToID)) { if (!empty($context->replyToID)) {
$notice = Notice::staticGet('uri', $context->replyToID); $notice = Notice::staticGet('uri', $context->replyToID);
if (empty($notice)) { if (empty($notice)) {
throw new ClientException("In reply to unknown notice"); // TRANS: Client exception.
throw new ClientException(_m('In reply to unknown notice.'));
} }
if ($notice->profile_id != $this->user->id && if ($notice->profile_id != $this->user->id &&
!in_array($this->user->id, $notice->getReplies())) { !in_array($this->user->id, $notice->getReplies())) {
throw new ClientException("In reply to a notice not by this user and not mentioning this user"); // TRANS: Client exception.
throw new ClientException(_m('In reply to a notice not by this user and not mentioning this user.'));
} }
} else if (!empty($context->attention)) { } else if (!empty($context->attention)) {
if (!in_array($this->user->uri, $context->attention) && if (!in_array($this->user->uri, $context->attention) &&
!in_array(common_profile_url($this->user->nickname), $context->attention)) { !in_array(common_profile_url($this->user->nickname), $context->attention)) {
common_log(LOG_ERR, "{$this->user->uri} not in attention list (".implode(',', $context->attention).")"); common_log(LOG_ERR, "{$this->user->uri} not in attention list (".implode(',', $context->attention).")");
throw new ClientException("To the attention of user(s) not including this one!"); // TRANS: Client exception.
throw new ClientException('To the attention of user(s), not including this one.');
} }
} else { } else {
throw new ClientException("Not to anyone in reply to anything!"); // TRANS: Client exception.
throw new ClientException('Not to anyone in reply to anything.');
} }
$existing = Notice::staticGet('uri', $this->activity->objects[0]->id); $existing = Notice::staticGet('uri', $this->activity->objects[0]->id);
@ -108,7 +111,6 @@ class UsersalmonAction extends SalmonAction
* We've gotten a follow/subscribe notification from a remote user. * We've gotten a follow/subscribe notification from a remote user.
* Save a subscription relationship for them. * Save a subscription relationship for them.
*/ */
function handleFollow() function handleFollow()
{ {
$oprofile = $this->ensureProfile(); $oprofile = $this->ensureProfile();
@ -152,11 +154,13 @@ class UsersalmonAction extends SalmonAction
'notice_id' => $notice->id)); 'notice_id' => $notice->id));
if (!empty($old)) { if (!empty($old)) {
throw new ClientException("We already know that's a fave!"); // TRANS: Client exception.
throw new ClientException(_('This is already a favorite.'));
} }
if (!Fave::addNew($profile, $notice)) { if (!Fave::addNew($profile, $notice)) {
throw new ClientException("Could not save new favorite."); // TRANS: Client exception.
throw new ClientException(_m('Could not save new favorite.'));
} }
} }
@ -172,7 +176,8 @@ class UsersalmonAction extends SalmonAction
$fave = Fave::pkeyGet(array('user_id' => $profile->id, $fave = Fave::pkeyGet(array('user_id' => $profile->id,
'notice_id' => $notice->id)); 'notice_id' => $notice->id));
if (empty($fave)) { if (empty($fave)) {
throw new ClientException("Notice wasn't favorited!"); // TRANS: Client exception.
throw new ClientException(_('Notice wasn\'t favorited!'));
} }
$fave->delete(); $fave->delete();
@ -186,7 +191,8 @@ class UsersalmonAction extends SalmonAction
function getNotice($object) function getNotice($object)
{ {
if (!$object) { if (!$object) {
throw new ClientException("Can't favorite/unfavorite without an object."); // TRANS: Client exception.
throw new ClientException(_m('Can\'t favorite/unfavorite without an object.'));
} }
switch ($object->type) { switch ($object->type) {
@ -197,20 +203,22 @@ class UsersalmonAction extends SalmonAction
case ActivityObject::COMMENT: case ActivityObject::COMMENT:
break; break;
default: default:
throw new ClientException("Can't handle that kind of object for liking/faving."); // TRANS: Client exception.
throw new ClientException(_m('Can\'t handle that kind of object for liking/faving.'));
} }
$notice = Notice::staticGet('uri', $object->id); $notice = Notice::staticGet('uri', $object->id);
if (empty($notice)) { if (empty($notice)) {
throw new ClientException("Notice with ID $object->id unknown."); // TRANS: Client exception. %s is an object ID.
throw new ClientException(sprintf(_m('Notice with ID %s unknown.'),$object->id));
} }
if ($notice->profile_id != $this->user->id) { if ($notice->profile_id != $this->user->id) {
throw new ClientException("Notice with ID $object->id not posted by $this->user->id."); // TRANS: Client exception. %1$s is a notice ID, %2$s is a user ID.
throw new ClientException(sprintf(_m('Notice with ID %1$s not posted by %2$s.'),$object->id,$this->user->id));
} }
return $notice; return $notice;
} }
} }

View File

@ -17,16 +17,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
if (!defined('STATUSNET')) { exit(1); }
/** /**
* @package OStatusPlugin * @package OStatusPlugin
* @maintainer James Walker <james@status.net> * @maintainer James Walker <james@status.net>
*/ */
if (!defined('STATUSNET')) { exit(1); }
class UserxrdAction extends XrdAction class UserxrdAction extends XrdAction
{ {
function prepare($args) function prepare($args)
{ {
parent::prepare($args); parent::prepare($args);
@ -46,7 +44,7 @@ class UserxrdAction extends XrdAction
$this->user = User::staticGet('uri', $this->uri); $this->user = User::staticGet('uri', $this->uri);
} }
if (!$this->user) { if (!$this->user) {
$this->clientError(_('No such user.'), 404); $this->clientError(_m('No such user.'), 404);
return false; return false;
} }

View File

@ -39,7 +39,6 @@ PuSH subscription flow:
hub sends us updates via POST hub sends us updates via POST
*/ */
class FeedDBException extends FeedSubException class FeedDBException extends FeedSubException
{ {
public $obj; public $obj;
@ -88,7 +87,6 @@ class FeedSub extends Memcached_DataObject
* *
* @return array array of column definitions * @return array array of column definitions
*/ */
function table() function table()
{ {
return array('id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL, return array('id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL,
@ -143,7 +141,6 @@ class FeedSub extends Memcached_DataObject
* *
* @return array key definitions * @return array key definitions
*/ */
function keys() function keys()
{ {
return array_keys($this->keyTypes()); return array_keys($this->keyTypes());
@ -157,7 +154,6 @@ class FeedSub extends Memcached_DataObject
* *
* @return array key definitions * @return array key definitions
*/ */
function keyTypes() function keyTypes()
{ {
return array('id' => 'K', 'uri' => 'U'); return array('id' => 'K', 'uri' => 'U');
@ -249,7 +245,7 @@ class FeedSub extends Memcached_DataObject
// We'll never actually get updates in this mode. // We'll never actually get updates in this mode.
return true; return true;
} else { } else {
throw new ServerException("Attempting to start PuSH subscription for feed with no hub."); throw new ServerException(_m('Attempting to start PuSH subscription for feed with no hub.'));
} }
} }
@ -279,7 +275,7 @@ class FeedSub extends Memcached_DataObject
// We'll never actually get updates in this mode. // We'll never actually get updates in this mode.
return true; return true;
} else { } else {
throw new ServerException("Attempting to end PuSH subscription for feed with no hub."); throw new ServerException(_m('Attempting to end PuSH subscription for feed with no hub.'));
} }
} }
@ -500,5 +496,4 @@ class FeedSub extends Memcached_DataObject
} }
return false; return false;
} }
} }

View File

@ -54,7 +54,6 @@ class HubSub extends Memcached_DataObject
* *
* @return array array of column definitions * @return array array of column definitions
*/ */
function table() function table()
{ {
return array('hashkey' => DB_DATAOBJECT_STR + DB_DATAOBJECT_NOTNULL, return array('hashkey' => DB_DATAOBJECT_STR + DB_DATAOBJECT_NOTNULL,
@ -112,7 +111,6 @@ class HubSub extends Memcached_DataObject
* *
* @return array key definitions * @return array key definitions
*/ */
function keyTypes() function keyTypes()
{ {
return array('hashkey' => 'K'); return array('hashkey' => 'K');
@ -206,8 +204,8 @@ class HubSub extends Memcached_DataObject
if ($status >= 200 && $status < 300) { if ($status >= 200 && $status < 300) {
common_log(LOG_INFO, "Verified $mode of $this->callback:$this->topic"); common_log(LOG_INFO, "Verified $mode of $this->callback:$this->topic");
} else { } else {
// @todo i18n FIXME: add i18n and use sprintf for parameter. // TRANS: Client exception. %s is a HTTP status code.
throw new ClientException("Hub subscriber verification returned HTTP $status"); throw new ClientException(sprintf(_m('Hub subscriber verification returned HTTP %s.'),$status));
} }
$old = HubSub::staticGet($this->topic, $this->callback); $old = HubSub::staticGet($this->topic, $this->callback);
@ -353,10 +351,9 @@ class HubSub extends Memcached_DataObject
if ($response->isOk()) { if ($response->isOk()) {
return true; return true;
} else { } else {
throw new Exception("Callback returned status: " . // TRANS: Exception. %1$s is a response status code, %2$s is the body of the response.
$response->getStatus() . throw new Exception(sprintf(_m('Callback returned status: %1$s. Body: %2$s'),
"; body: " . $response->getStatus(),trim($response->getBody())));
trim($response->getBody()));
} }
} }
} }

View File

@ -31,7 +31,6 @@ require_once 'Crypt/RSA.php';
class Magicsig extends Memcached_DataObject class Magicsig extends Memcached_DataObject
{ {
const PUBLICKEYREL = 'magic-public-key'; const PUBLICKEYREL = 'magic-public-key';
public $__table = 'magicsig'; public $__table = 'magicsig';
@ -86,7 +85,6 @@ class Magicsig extends Memcached_DataObject
64, false)); 64, false));
} }
function keys() function keys()
{ {
return array_keys($this->keyTypes()); return array_keys($this->keyTypes());
@ -126,7 +124,6 @@ class Magicsig extends Memcached_DataObject
$this->insert(); $this->insert();
} }
public function toString($full_pair = true) public function toString($full_pair = true)
{ {
$mod = Magicsig::base64_url_encode($this->publicKey->modulus->toBytes()); $mod = Magicsig::base64_url_encode($this->publicKey->modulus->toBytes());
@ -197,7 +194,6 @@ class Magicsig extends Memcached_DataObject
case 'RSA-SHA256': case 'RSA-SHA256':
return 'sha256'; return 'sha256';
} }
} }
public function sign($bytes) public function sign($bytes)

View File

@ -21,7 +21,6 @@
* @package OStatusPlugin * @package OStatusPlugin
* @maintainer Brion Vibber <brion@status.net> * @maintainer Brion Vibber <brion@status.net>
*/ */
class Ostatus_profile extends Memcached_DataObject class Ostatus_profile extends Memcached_DataObject
{ {
public $__table = 'ostatus_profile'; public $__table = 'ostatus_profile';
@ -51,7 +50,6 @@ class Ostatus_profile extends Memcached_DataObject
* *
* @return array array of column definitions * @return array array of column definitions
*/ */
function table() function table()
{ {
return array('uri' => DB_DATAOBJECT_STR + DB_DATAOBJECT_NOTNULL, return array('uri' => DB_DATAOBJECT_STR + DB_DATAOBJECT_NOTNULL,
@ -92,7 +90,6 @@ class Ostatus_profile extends Memcached_DataObject
* *
* @return array key definitions * @return array key definitions
*/ */
function keys() function keys()
{ {
return array_keys($this->keyTypes()); return array_keys($this->keyTypes());
@ -106,7 +103,6 @@ class Ostatus_profile extends Memcached_DataObject
* *
* @return array key definitions * @return array key definitions
*/ */
function keyTypes() function keyTypes()
{ {
return array('uri' => 'K', 'profile_id' => 'U', 'group_id' => 'U', 'feeduri' => 'U'); return array('uri' => 'K', 'profile_id' => 'U', 'group_id' => 'U', 'feeduri' => 'U');
@ -188,11 +184,11 @@ class Ostatus_profile extends Memcached_DataObject
} else if ($this->group_id && !$this->profile_id) { } else if ($this->group_id && !$this->profile_id) {
return true; return true;
} else if ($this->group_id && $this->profile_id) { } else if ($this->group_id && $this->profile_id) {
// @todo i18n FIXME: use sprintf and add i18n. // TRANS: Server exception.
throw new ServerException("Invalid ostatus_profile state: both group and profile IDs set for $this->uri."); throw new ServerException(sprintf(_m('Invalid ostatus_profile state: both group and profile IDs set for %s.'),$this->uri));
} else { } else {
// @todo i18n FIXME: use sprintf and add i18n. // TRANS: Server exception.
throw new ServerException("Invalid ostatus_profile state: both group and profile IDs empty for $this->uri."); throw new ServerException(sprintf(_m('Invalid ostatus_profile state: both group and profile IDs empty for %s.'),$this->uri));
} }
} }
@ -280,7 +276,9 @@ class Ostatus_profile extends Memcached_DataObject
if ($type == 'object') { if ($type == 'object') {
$type = get_class($actor); $type = get_class($actor);
} }
throw new ServerException("Invalid actor passed to " . __METHOD__ . ": " . $type); // TRANS: Server exception.
// TRANS: %1$s is the method name the exception occured in, %2$s is the actor type.
throw new ServerException(sprintf(_m('Invalid actor passed to %1$s: %2$s.'),__METHOD__,$type));
} }
if ($object == null) { if ($object == null) {
$object = $this; $object = $this;
@ -372,8 +370,8 @@ class Ostatus_profile extends Memcached_DataObject
} else if ($entry instanceof Notice) { } else if ($entry instanceof Notice) {
return $preamble . $entry->asAtomEntry(true, true); return $preamble . $entry->asAtomEntry(true, true);
} else { } else {
// @todo i18n FIXME: use sprintf and add i18n. // TRANS: Server exception.
throw new ServerException("Invalid type passed to Ostatus_profile::notify; must be XML string or Activity entry."); throw new ServerException(_m('Invalid type passed to Ostatus_profile::notify. It must be XML string or Activity entry.'));
} }
} }
@ -403,7 +401,7 @@ class Ostatus_profile extends Memcached_DataObject
} else if ($feed->localName == 'rss') { // @fixme check namespace } else if ($feed->localName == 'rss') { // @fixme check namespace
$this->processRssFeed($feed, $source); $this->processRssFeed($feed, $source);
} else { } else {
throw new Exception("Unknown feed format."); throw new Exception(_m('Unknown feed format.'));
} }
} }
@ -426,7 +424,7 @@ class Ostatus_profile extends Memcached_DataObject
$channels = $rss->getElementsByTagName('channel'); $channels = $rss->getElementsByTagName('channel');
if ($channels->length == 0) { if ($channels->length == 0) {
throw new Exception("RSS feed without a channel."); throw new Exception(_m('RSS feed without a channel.'));
} else if ($channels->length > 1) { } else if ($channels->length > 1) {
common_log(LOG_WARNING, __METHOD__ . ": more than one channel in an RSS feed"); common_log(LOG_WARNING, __METHOD__ . ": more than one channel in an RSS feed");
} }
@ -470,7 +468,8 @@ class Ostatus_profile extends Memcached_DataObject
} }
break; break;
default: default:
throw new ClientException("Can't handle that kind of post."); // TRANS: Client exception.
throw new ClientException(_m('Can\'t handle that kind of post.'));
} }
Event::handle('EndHandleFeedEntry', array($activity)); Event::handle('EndHandleFeedEntry', array($activity));
@ -552,8 +551,8 @@ class Ostatus_profile extends Memcached_DataObject
$sourceContent = $note->title; $sourceContent = $note->title;
} else { } else {
// @fixme fetch from $sourceUrl? // @fixme fetch from $sourceUrl?
// @todo i18n FIXME: use sprintf and add i18n. // TRANS: Client exception. %s is a source URL.
throw new ClientException("No content for notice {$sourceUri}."); throw new ClientException(sprintf(_m('No content for notice %s.'),$sourceUri));
} }
// Get (safe!) HTML and text versions of the content // Get (safe!) HTML and text versions of the content
@ -584,14 +583,17 @@ class Ostatus_profile extends Memcached_DataObject
// We mark up the attachment link specially for the HTML output // We mark up the attachment link specially for the HTML output
// so we can fold-out the full version inline. // so we can fold-out the full version inline.
// TRANS: Shown when a notice is longer than supported and/or when attachments are present.
$showMoreText = _m('Show more');
$attachUrl = common_local_url('attachment', $attachUrl = common_local_url('attachment',
array('attachment' => $attachment->id)); array('attachment' => $attachment->id));
$rendered = common_render_text($shortSummary) . $rendered = common_render_text($shortSummary) .
'<a href="' . htmlspecialchars($attachUrl) .'"'. '<a href="' . htmlspecialchars($attachUrl) .'"'.
' class="attachment more"' . ' class="attachment more"' .
' title="'. htmlspecialchars(_m('Show more')) . '">' . ' title="'. htmlspecialchars($showMoreText) . '">' .
'&#8230;' . '&#8230;' .
'</a>'; // @todo i18n FIXME: add translator hint/context. '</a>';
} }
} }
@ -775,8 +777,8 @@ class Ostatus_profile extends Memcached_DataObject
$response = $client->get($profile_url); $response = $client->get($profile_url);
if (!$response->isOk()) { if (!$response->isOk()) {
// @todo i18n FIXME: use sprintf and add i18n. // TRANS: Exception. %s is a profile URL.
throw new Exception("Could not reach profile page: " . $profile_url); throw new Exception(sprintf(_m('Could not reach profile page %s.'),$profile_url));
} }
// Check if we have a non-canonical URL // Check if we have a non-canonical URL
@ -833,8 +835,8 @@ class Ostatus_profile extends Memcached_DataObject
return self::ensureFeedURL($feedurl, $hints); return self::ensureFeedURL($feedurl, $hints);
} }
// @todo i18n FIXME: use sprintf and add i18n. // TRANS: Exception.
throw new Exception("Could not find a feed URL for profile page " . $finalUrl); throw new Exception(sprintf(_m('Could not find a feed URL for profile page %s.'),$finalUrl));
} }
/** /**
@ -866,7 +868,7 @@ class Ostatus_profile extends Memcached_DataObject
$user = User::staticGet('id', $profile->id); $user = User::staticGet('id', $profile->id);
if (!empty($user)) { if (!empty($user)) {
// @todo i18n FIXME: use sprintf and add i18n. // @todo i18n FIXME: use sprintf and add i18n (?)
throw new OStatusShadowException($profile, "'$profile_url' is the profile for local user '{$user->nickname}'."); throw new OStatusShadowException($profile, "'$profile_url' is the profile for local user '{$user->nickname}'.");
} }
@ -971,8 +973,7 @@ class Ostatus_profile extends Memcached_DataObject
} }
// XXX: make some educated guesses here // XXX: make some educated guesses here
throw new FeedSubException(_m('Can\'t find enough profile information to make a feed.'));
throw new FeedSubException("Can't find enough profile information to make a feed.");
} }
/** /**
@ -1270,13 +1271,13 @@ class Ostatus_profile extends Memcached_DataObject
$user = User::staticGet('uri', $homeuri); $user = User::staticGet('uri', $homeuri);
if ($user) { if ($user) {
// @todo i18n FIXME: add i18n. // TRANS: Exception.
throw new Exception("Local user can't be referenced as remote."); throw new Exception(_m('Local user can\'t be referenced as remote.'));
} }
if (OStatusPlugin::localGroupFromUrl($homeuri)) { if (OStatusPlugin::localGroupFromUrl($homeuri)) {
// @todo i18n FIXME: add i18n. // TRANS: Exception.
throw new Exception("Local group can't be referenced as remote."); throw new Exception(_m('Local group can\'t be referenced as remote.'));
} }
if (array_key_exists('feedurl', $hints)) { if (array_key_exists('feedurl', $hints)) {
@ -1327,8 +1328,8 @@ class Ostatus_profile extends Memcached_DataObject
$oprofile->profile_id = $profile->insert(); $oprofile->profile_id = $profile->insert();
if (!$oprofile->profile_id) { if (!$oprofile->profile_id) {
// @todo i18n FIXME: add i18n. // TRANS: Exception.
throw new ServerException("Can't save local profile."); throw new ServerException(_m('Can\'t save local profile.'));
} }
} else { } else {
$group = new User_group(); $group = new User_group();
@ -1338,16 +1339,16 @@ class Ostatus_profile extends Memcached_DataObject
$oprofile->group_id = $group->insert(); $oprofile->group_id = $group->insert();
if (!$oprofile->group_id) { if (!$oprofile->group_id) {
// @todo i18n FIXME: add i18n. // TRANS: Exception.
throw new ServerException("Can't save local profile."); throw new ServerException(_m('Can\'t save local profile.'));
} }
} }
$ok = $oprofile->insert(); $ok = $oprofile->insert();
if (!$ok) { if (!$ok) {
// @todo i18n FIXME: add i18n. // TRANS: Exception.
throw new ServerException("Can't save OStatus profile."); throw new ServerException(_m('Can\'t save OStatus profile.'));
} }
$avatar = self::getActivityObjectAvatar($object, $hints); $avatar = self::getActivityObjectAvatar($object, $hints);
@ -1605,8 +1606,8 @@ class Ostatus_profile extends Memcached_DataObject
if ($uri !== false) { if ($uri !== false) {
if (is_null($uri)) { if (is_null($uri)) {
// Negative cache entry // Negative cache entry
// @todo i18n FIXME: add i18n. // TRANS: Exception.
throw new Exception('Not a valid webfinger address.'); throw new Exception(_m('Not a valid webfinger address.'));
} }
$oprofile = Ostatus_profile::staticGet('uri', $uri); $oprofile = Ostatus_profile::staticGet('uri', $uri);
if (!empty($oprofile)) { if (!empty($oprofile)) {
@ -1633,8 +1634,8 @@ class Ostatus_profile extends Memcached_DataObject
// Save negative cache entry so we don't waste time looking it up again. // Save negative cache entry so we don't waste time looking it up again.
// @fixme distinguish temporary failures? // @fixme distinguish temporary failures?
self::cacheSet(sprintf('ostatus_profile:webfinger:%s', $addr), null); self::cacheSet(sprintf('ostatus_profile:webfinger:%s', $addr), null);
// @todo i18n FIXME: add i18n. // TRANS: Exception.
throw new Exception('Not a valid webfinger address.'); throw new Exception(_m('Not a valid webfinger address.'));
} }
$hints = array('webfinger' => $addr); $hints = array('webfinger' => $addr);
@ -1715,8 +1716,8 @@ class Ostatus_profile extends Memcached_DataObject
if (!$profile_id) { if (!$profile_id) {
common_log_db_error($profile, 'INSERT', __FILE__); common_log_db_error($profile, 'INSERT', __FILE__);
// @todo i18n FIXME: add i18n and use sprintf for parameter. // TRANS: Exception. %s is a webfinger address.
throw new Exception("Couldn't save profile for '$addr'."); throw new Exception(sprintf(_m('Couldn\'t save profile for "%s".'),$addr));
} }
$oprofile = new Ostatus_profile(); $oprofile = new Ostatus_profile();
@ -1734,16 +1735,16 @@ class Ostatus_profile extends Memcached_DataObject
if (!$result) { if (!$result) {
common_log_db_error($oprofile, 'INSERT', __FILE__); common_log_db_error($oprofile, 'INSERT', __FILE__);
// @todo i18n FIXME: add i18n and use sprintf for parameter. // TRANS: Exception. %s is a webfinger address.
throw new Exception("Couldn't save ostatus_profile for '$addr'."); throw new Exception(sprintf(_m('Couldn\'t save ostatus_profile for "%s".'),$addr));
} }
self::cacheSet(sprintf('ostatus_profile:webfinger:%s', $addr), $oprofile->uri); self::cacheSet(sprintf('ostatus_profile:webfinger:%s', $addr), $oprofile->uri);
return $oprofile; return $oprofile;
} }
// @todo i18n FIXME: add i18n and use sprintf for parameter. // TRANS: Exception. %s is a webfinger address.
throw new Exception("Couldn't find a valid profile for '$addr'"); throw new Exception(sprintf(_m('Couldn\'t find a valid profile for "%s".'),$addr));
} }
/** /**
@ -1785,7 +1786,7 @@ class Ostatus_profile extends Memcached_DataObject
if ($file_id === false) { if ($file_id === false) {
common_log_db_error($file, "INSERT", __FILE__); common_log_db_error($file, "INSERT", __FILE__);
throw new ServerException(_('Could not store HTML content of long post as file.')); throw new ServerException(_m('Could not store HTML content of long post as file.'));
} }
return $file; return $file;

View File

@ -21,7 +21,6 @@
* @package OStatusPlugin * @package OStatusPlugin
* @maintainer Brion Vibber <brion@status.net> * @maintainer Brion Vibber <brion@status.net>
*/ */
class Ostatus_source extends Memcached_DataObject class Ostatus_source extends Memcached_DataObject
{ {
public $__table = 'ostatus_source'; public $__table = 'ostatus_source';
@ -43,7 +42,6 @@ class Ostatus_source extends Memcached_DataObject
* *
* @return array array of column definitions * @return array array of column definitions
*/ */
function table() function table()
{ {
return array('notice_id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL, return array('notice_id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL,
@ -69,7 +67,6 @@ class Ostatus_source extends Memcached_DataObject
* *
* @return array key definitions * @return array key definitions
*/ */
function keys() function keys()
{ {
return array_keys($this->keyTypes()); return array_keys($this->keyTypes());
@ -83,7 +80,6 @@ class Ostatus_source extends Memcached_DataObject
* *
* @return array key definitions * @return array key definitions
*/ */
function keyTypes() function keyTypes()
{ {
return array('notice_id' => 'K'); return array('notice_id' => 'K');

View File

@ -106,8 +106,8 @@ class Discovery
} }
} }
// @todo Needs i18n. // TRANS: Exception.
throw new Exception('Unable to find services for '. $id . '.'); throw new Exception(sprintf(_m('Unable to find services for %s.'),$id));
} }
public static function getService($links, $service) { public static function getService($links, $service) {

View File

@ -20,7 +20,6 @@
*/ */
class DiscoveryHints { class DiscoveryHints {
static function fromXRD($xrd) static function fromXRD($xrd)
{ {
$hints = array(); $hints = array();

View File

@ -1,4 +1,7 @@
<?php <?php
/**
* @todo Add file header and documentation.
*/
class LinkHeader class LinkHeader
{ {

View File

@ -76,7 +76,8 @@ class MagicEnvelope
} }
} }
} }
throw new Exception('Unable to locate signer public key.'); // TRANS: Exception.
throw new Exception(_m('Unable to locate signer public key.'));
} }
@ -92,7 +93,6 @@ class MagicEnvelope
'sig' => $signature_alg->sign($armored_text), 'sig' => $signature_alg->sign($armored_text),
'alg' => $signature_alg->getName() 'alg' => $signature_alg->getName()
); );
} }
public function toXML($env) { public function toXML($env) {
@ -110,7 +110,6 @@ class MagicEnvelope
return $string; return $string;
} }
public function unfold($env) public function unfold($env)
{ {
$dom = new DOMDocument(); $dom = new DOMDocument();
@ -218,5 +217,4 @@ class MagicEnvelope
'sig' => preg_replace('/\s/', '', $sig_element->nodeValue), 'sig' => preg_replace('/\s/', '', $sig_element->nodeValue),
); );
} }
} }

View File

@ -221,5 +221,4 @@ class OStatusQueueHandler extends QueueHandler
return $feed; return $feed;
} }
} }

View File

@ -22,7 +22,6 @@
* @package FeedSub * @package FeedSub
* @author Brion Vibber <brion@status.net> * @author Brion Vibber <brion@status.net>
*/ */
class PushInQueueHandler extends QueueHandler class PushInQueueHandler extends QueueHandler
{ {
function transport() function transport()

View File

@ -89,8 +89,8 @@ class Salmon
$magickey->generate($user->id); $magickey->generate($user->id);
} }
} else { } else {
// @todo i18n FIXME: added i18n and use sprintf when using parameters. // TRANS: Exception.
throw new Exception("Salmon invalid actor for signing."); throw new Exception(_m('Salmon invalid actor for signing.'));
} }
try { try {
@ -101,7 +101,6 @@ class Salmon
return $magic_env->toXML($env); return $magic_env->toXML($env);
} }
public function verifyMagicEnv($text) public function verifyMagicEnv($text)
{ {
$magic_env = new MagicEnvelope(); $magic_env = new MagicEnvelope();

View File

@ -38,11 +38,12 @@ class SalmonAction extends Action
parent::prepare($args); parent::prepare($args);
if ($_SERVER['REQUEST_METHOD'] != 'POST') { if ($_SERVER['REQUEST_METHOD'] != 'POST') {
// TRANS: POST is a HTTP command. It should not be translated. // TRANS: Client error. POST is a HTTP command. It should not be translated.
$this->clientError(_m('This method requires a POST.')); $this->clientError(_m('This method requires a POST.'));
} }
if (empty($_SERVER['CONTENT_TYPE']) || $_SERVER['CONTENT_TYPE'] != 'application/magic-envelope+xml') { if (empty($_SERVER['CONTENT_TYPE']) || $_SERVER['CONTENT_TYPE'] != 'application/magic-envelope+xml') {
// TRANS: Client error. Do not translate "application/magic-envelope+xml"
$this->clientError(_m('Salmon requires "application/magic-envelope+xml".')); $this->clientError(_m('Salmon requires "application/magic-envelope+xml".'));
} }
@ -52,6 +53,7 @@ class SalmonAction extends Action
$salmon = new Salmon; $salmon = new Salmon;
if (!$salmon->verifyMagicEnv($xml)) { if (!$salmon->verifyMagicEnv($xml)) {
common_log(LOG_DEBUG, "Salmon signature verification failed."); common_log(LOG_DEBUG, "Salmon signature verification failed.");
// TRANS: Client error.
$this->clientError(_m('Salmon signature verification failed.')); $this->clientError(_m('Salmon signature verification failed.'));
} else { } else {
$magic_env = new MagicEnvelope(); $magic_env = new MagicEnvelope();
@ -63,6 +65,7 @@ class SalmonAction extends Action
if ($dom->documentElement->namespaceURI != Activity::ATOM || if ($dom->documentElement->namespaceURI != Activity::ATOM ||
$dom->documentElement->localName != 'entry') { $dom->documentElement->localName != 'entry') {
common_log(LOG_DEBUG, "Got invalid Salmon post: $xml"); common_log(LOG_DEBUG, "Got invalid Salmon post: $xml");
// TRANS: Client error.
$this->clientError(_m('Salmon post must be an Atom entry.')); $this->clientError(_m('Salmon post must be an Atom entry.'));
} }
@ -111,6 +114,7 @@ class SalmonAction extends Action
$this->handleUpdateProfile(); $this->handleUpdateProfile();
break; break;
default: 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('EndHandleSalmon', array($this->activity));
@ -119,41 +123,49 @@ class SalmonAction extends Action
function handlePost() function handlePost()
{ {
// TRANS: Client exception.
throw new ClientException(_m("This target doesn't understand posts.")); throw new ClientException(_m("This target doesn't understand posts."));
} }
function handleFollow() function handleFollow()
{ {
// TRANS: Client exception.
throw new ClientException(_m("This target doesn't understand follows.")); throw new ClientException(_m("This target doesn't understand follows."));
} }
function handleUnfollow() function handleUnfollow()
{ {
// TRANS: Client exception.
throw new ClientException(_m("This target doesn't understand unfollows.")); throw new ClientException(_m("This target doesn't understand unfollows."));
} }
function handleFavorite() function handleFavorite()
{ {
// TRANS: Client exception.
throw new ClientException(_m("This target doesn't understand favorites.")); throw new ClientException(_m("This target doesn't understand favorites."));
} }
function handleUnfavorite() function handleUnfavorite()
{ {
// TRANS: Client exception.
throw new ClientException(_m("This target doesn't understand unfavorites.")); throw new ClientException(_m("This target doesn't understand unfavorites."));
} }
function handleShare() function handleShare()
{ {
// TRANS: Client exception.
throw new ClientException(_m("This target doesn't understand share events.")); throw new ClientException(_m("This target doesn't understand share events."));
} }
function handleJoin() function handleJoin()
{ {
// TRANS: Client exception.
throw new ClientException(_m("This target doesn't understand joins.")); throw new ClientException(_m("This target doesn't understand joins."));
} }
function handleLeave() function handleLeave()
{ {
// TRANS: Client exception.
throw new ClientException(_m("This target doesn't understand leave events.")); throw new ClientException(_m("This target doesn't understand leave events."));
} }
@ -181,7 +193,8 @@ class SalmonAction extends Action
if (empty($actor->id)) { if (empty($actor->id)) {
common_log(LOG_ERR, "broken actor: " . var_export($actor, true)); common_log(LOG_ERR, "broken actor: " . var_export($actor, true));
common_log(LOG_ERR, "activity with no actor: " . var_export($this->activity, true)); common_log(LOG_ERR, "activity with no actor: " . var_export($this->activity, true));
throw new Exception("Received a salmon slap from unidentified actor."); // TRANS: Exception.
throw new Exception(_m('Received a salmon slap from unidentified actor.'));
} }
return Ostatus_profile::ensureActivityObjectProfile($actor); return Ostatus_profile::ensureActivityObjectProfile($actor);

View File

@ -27,7 +27,6 @@
* @link http://status.net/ * @link http://status.net/
*/ */
class XRD class XRD
{ {
const XML_NS = 'http://www.w3.org/2000/xmlns/'; const XML_NS = 'http://www.w3.org/2000/xmlns/';
@ -61,11 +60,13 @@ class XRD
error_reporting($old); error_reporting($old);
if (!$ok) { if (!$ok) {
throw new Exception("Invalid XML."); // TRANS: Exception.
throw new Exception(_m('Invalid XML.'));
} }
$xrd_element = $dom->getElementsByTagName('XRD')->item(0); $xrd_element = $dom->getElementsByTagName('XRD')->item(0);
if (!$xrd_element) { if (!$xrd_element) {
throw new Exception("Invalid XML, missing XRD root."); // TRANS: Exception.
throw new Exception(_m('Invalid XML, missing XRD root.'));
} }
// Check for host-meta host // Check for host-meta host

View File

@ -103,5 +103,4 @@ class XrdAction extends Action
header('Content-type: application/xrd+xml'); header('Content-type: application/xrd+xml');
print $xrd->toXML(); print $xrd->toXML();
} }
} }