Commit 9758134d authored by Siebrand Mazeland's avatar Siebrand Mazeland

Update translator documentation.

Update whitespace.
L10n/i18n updates.
parent 323f7f1e
...@@ -80,7 +80,8 @@ class EmailregisterAction extends Action ...@@ -80,7 +80,8 @@ class EmailregisterAction extends Action
parent::prepare($argarray); parent::prepare($argarray);
if (common_config('site', 'closed')) { if (common_config('site', 'closed')) {
throw new ClientException(_('Registration not allowed.'), 403); // TRANS: Client exception trown when registration by e-mail is not allowed.
throw new ClientException(_m('Registration not allowed.'), 403);
} }
if ($this->isPost()) { if ($this->isPost()) {
...@@ -91,7 +92,8 @@ class EmailregisterAction extends Action ...@@ -91,7 +92,8 @@ class EmailregisterAction extends Action
if (!empty($this->email)) { if (!empty($this->email)) {
if (common_config('site', 'inviteonly')) { if (common_config('site', 'inviteonly')) {
throw new ClientException(_('Sorry, only invited people can register.'), 403); // TRANS: Client exception trown when trying to register without an invitation.
throw new ClientException(_m('Sorry, only invited people can register.'), 403);
} }
$this->email = common_canonical_email($this->email); $this->email = common_canonical_email($this->email);
$this->state = self::NEWEMAIL; $this->state = self::NEWEMAIL;
...@@ -109,6 +111,7 @@ class EmailregisterAction extends Action ...@@ -109,6 +111,7 @@ class EmailregisterAction extends Action
if (!empty($this->invitation)) { if (!empty($this->invitation)) {
if (!empty($this->invitation->registered_user_id)) { if (!empty($this->invitation->registered_user_id)) {
// TRANS: Client exception trown when using an invitation multiple times.
throw new ClientException(_m('Invitation already used.'), 403); throw new ClientException(_m('Invitation already used.'), 403);
} }
} else { } else {
...@@ -131,13 +134,15 @@ class EmailregisterAction extends Action ...@@ -131,13 +134,15 @@ class EmailregisterAction extends Action
if (empty($this->code)) { if (empty($this->code)) {
if (common_config('site', 'inviteonly')) { if (common_config('site', 'inviteonly')) {
throw new ClientException(_('Sorry, only invited people can register.'), 403); // TRANS: Client exception trown when trying to register without an invitation.
throw new ClientException(_m('Sorry, only invited people can register.'), 403);
} }
$this->state = self::NEWREGISTER; $this->state = self::NEWREGISTER;
} else { } else {
$this->invitation = Invitation::staticGet('code', $this->code); $this->invitation = Invitation::staticGet('code', $this->code);
if (!empty($this->invitation)) { if (!empty($this->invitation)) {
if (!empty($this->invitation->registered_user_id)) { if (!empty($this->invitation->registered_user_id)) {
// TRANS: Client exception trown when using an invitation multiple times.
throw new ClientException(_m('Invitation already used.'), 403); throw new ClientException(_m('Invitation already used.'), 403);
} }
$this->state = self::CONFIRMINVITE; $this->state = self::CONFIRMINVITE;
...@@ -180,7 +185,6 @@ class EmailregisterAction extends Action ...@@ -180,7 +185,6 @@ class EmailregisterAction extends Action
* *
* @return void * @return void
*/ */
function handle($argarray=null) function handle($argarray=null)
{ {
$cur = common_current_user(); $cur = common_current_user();
...@@ -263,7 +267,8 @@ class EmailregisterAction extends Action ...@@ -263,7 +267,8 @@ class EmailregisterAction extends Action
} else if (!empty($this->confirmation)) { } else if (!empty($this->confirmation)) {
$email = trim($this->confirmation->address); $email = trim($this->confirmation->address);
} else { } else {
throw new Exception('No confirmation thing.'); // TRANS: Client exception trown when trying to set password with an invalid confirmation code.
throw new Exception(_m('No confirmation thing.'));
} }
if (!$this->tos) { if (!$this->tos) {
...@@ -308,7 +313,8 @@ class EmailregisterAction extends Action ...@@ -308,7 +313,8 @@ class EmailregisterAction extends Action
} }
if (empty($this->user)) { if (empty($this->user)) {
throw new Exception('Failed to register user.'); // TRANS: Exception trown when using an invitation multiple times.
throw new Exception(_m('Failed to register user.'));
} }
common_set_user($this->user); common_set_user($this->user);
...@@ -346,8 +352,8 @@ class EmailregisterAction extends Action ...@@ -346,8 +352,8 @@ class EmailregisterAction extends Action
$confirmUrl = common_local_url('register', array('code' => $confirm->code)); $confirmUrl = common_local_url('register', array('code' => $confirm->code));
// TRANS: Body for confirmation e-mail. // TRANS: Body for confirmation e-mail.
// TRANS: %1$s is the StatusNet sitename, %2$s is the confirmation URL. // TRANS: %1$s is the StatusNet sitename, %2$s is the confirmation URL.
$body = sprintf(_m('Someone (probably you) has requested an account on %1$s using this email address.'. $body = sprintf(_m('Someone (probably you) has requested an account on %1$s using this email address.'.
"\n". "\n".
'To confirm the address, click the following URL or copy it into the address bar of your browser.'. 'To confirm the address, click the following URL or copy it into the address bar of your browser.'.
......
...@@ -175,7 +175,7 @@ class QnAPlugin extends MicroAppPlugin ...@@ -175,7 +175,7 @@ class QnAPlugin extends MicroAppPlugin
function appTitle() { function appTitle() {
// TRANS: Application title. // TRANS: Application title.
return _m('Question'); return _m('TITLE','Question');
} }
function tag() { function tag() {
...@@ -202,12 +202,14 @@ class QnAPlugin extends MicroAppPlugin ...@@ -202,12 +202,14 @@ class QnAPlugin extends MicroAppPlugin
function saveNoticeFromActivity($activity, $actor, $options=array()) function saveNoticeFromActivity($activity, $actor, $options=array())
{ {
if (count($activity->objects) != 1) { if (count($activity->objects) != 1) {
// TRANS: Exception thrown when there are too many activity objects.
throw new Exception(_m('Too many activity objects.')); throw new Exception(_m('Too many activity objects.'));
} }
$questionObj = $activity->objects[0]; $questionObj = $activity->objects[0];
if ($questionObj->type != QnA_Question::OBJECT_TYPE) { if ($questionObj->type != QnA_Question::OBJECT_TYPE) {
// TRANS: Exception thrown when an incorrect object type is encountered.
throw new Exception(_m('Wrong type for object.')); throw new Exception(_m('Wrong type for object.'));
} }
...@@ -226,12 +228,14 @@ class QnAPlugin extends MicroAppPlugin ...@@ -226,12 +228,14 @@ class QnAPlugin extends MicroAppPlugin
$question = QnA_Question::staticGet('uri', $questionObj->id); $question = QnA_Question::staticGet('uri', $questionObj->id);
if (empty($question)) { if (empty($question)) {
// FIXME: save the question // FIXME: save the question
// TRANS: Exception thrown when answering a non-existing question.
throw new Exception(_m('Answer to unknown question.')); throw new Exception(_m('Answer to unknown question.'));
} }
$notice = QnA_Answer::saveNew($actor, $question, $options); $notice = QnA_Answer::saveNew($actor, $question, $options);
break; break;
default: default:
throw new Exception(_m('Unknown object type received by QnA Plugin.')); // TRANS: Exception thrown when an object type is encountered that cannot be handled.
throw new Exception(_m('Unknown object type.'));
} }
return $notice; return $notice;
...@@ -260,12 +264,14 @@ class QnAPlugin extends MicroAppPlugin ...@@ -260,12 +264,14 @@ class QnAPlugin extends MicroAppPlugin
} }
if (empty($question)) { if (empty($question)) {
// TRANS: Exception thrown when an object type is encountered that cannot be handled.
throw new Exception(_m('Unknown object type.')); throw new Exception(_m('Unknown object type.'));
} }
$notice = $question->getNotice(); $notice = $question->getNotice();
if (empty($notice)) { if (empty($notice)) {
// TRANS: Exception thrown when requesting a non-existing question notice.
throw new Exception(_m('Unknown question notice.')); throw new Exception(_m('Unknown question notice.'));
} }
...@@ -387,6 +393,7 @@ class QnAPlugin extends MicroAppPlugin ...@@ -387,6 +393,7 @@ class QnAPlugin extends MicroAppPlugin
$form->show(); $form->show();
} else { } else {
// TRANS: Error message displayed when question data is not present.
$out->text(_m('Question data is missing.')); $out->text(_m('Question data is missing.'));
} }
$out->elementEnd('div'); $out->elementEnd('div');
...@@ -395,7 +402,6 @@ class QnAPlugin extends MicroAppPlugin ...@@ -395,7 +402,6 @@ class QnAPlugin extends MicroAppPlugin
$out->elementStart('div', array('class' => 'entry-content')); $out->elementStart('div', array('class' => 'entry-content'));
} }
/** /**
* Output the HTML for this kind of object in a list * Output the HTML for this kind of object in a list
* *
...@@ -403,7 +409,7 @@ class QnAPlugin extends MicroAppPlugin ...@@ -403,7 +409,7 @@ class QnAPlugin extends MicroAppPlugin
* *
* @return boolean hook value * @return boolean hook value
* *
* @fixme WARNING WARNING WARNING this closes a 'div' that is implicitly opened in BookmarkPlugin's showNotice implementation * @todo FIXME: WARNING WARNING WARNING this closes a 'div' that is implicitly opened in BookmarkPlugin's showNotice implementation
*/ */
function onStartShowNoticeItem($nli) function onStartShowNoticeItem($nli)
{ {
...@@ -427,12 +433,10 @@ class QnAPlugin extends MicroAppPlugin ...@@ -427,12 +433,10 @@ class QnAPlugin extends MicroAppPlugin
$nli->showNoticeOptions(); $nli->showNoticeOptions();
if ($notice->object_type == QnA_Question::OBJECT_TYPE) { if ($notice->object_type == QnA_Question::OBJECT_TYPE) {
$user = common_current_user(); $user = common_current_user();
$question = QnA_Question::getByNotice($notice); $question = QnA_Question::getByNotice($notice);
if (!empty($user)) { if (!empty($user)) {
$profile = $user->getProfile(); $profile = $user->getProfile();
$answer = $question->getAnswer($profile); $answer = $question->getAnswer($profile);
...@@ -447,6 +451,8 @@ class QnAPlugin extends MicroAppPlugin ...@@ -447,6 +451,8 @@ class QnAPlugin extends MicroAppPlugin
'input', 'input',
array( array(
'class' => 'placeholder', 'class' => 'placeholder',
// TRANS: Placeholder value for a possible answer to a question
// TRANS: by the logged in user.
'value' => _m('Your answer...') 'value' => _m('Your answer...')
) )
); );
...@@ -459,7 +465,6 @@ class QnAPlugin extends MicroAppPlugin ...@@ -459,7 +465,6 @@ class QnAPlugin extends MicroAppPlugin
return false; return false;
} }
function showNoticeAnswer($notice, $out) function showNoticeAnswer($notice, $out)
{ {
$user = common_current_user(); $user = common_current_user();
...@@ -476,12 +481,13 @@ class QnAPlugin extends MicroAppPlugin ...@@ -476,12 +481,13 @@ class QnAPlugin extends MicroAppPlugin
$form = new QnashowanswerForm($out, $answer); $form = new QnashowanswerForm($out, $answer);
$form->show(); $form->show();
} else { } else {
// TRANS: Error message displayed when answer data is not present.
$out->text(_m('Answer data is missing.')); $out->text(_m('Answer data is missing.'));
} }
$out->elementEnd('div'); $out->elementEnd('div');
// @fixme // @todo FIXME
$out->elementStart('div', array('class' => 'entry-content')); $out->elementStart('div', array('class' => 'entry-content'));
} }
...@@ -492,14 +498,15 @@ class QnAPlugin extends MicroAppPlugin ...@@ -492,14 +498,15 @@ class QnAPlugin extends MicroAppPlugin
if (Notice::contentTooLong($content)) { if (Notice::contentTooLong($content)) {
common_debug("content too long"); common_debug("content too long");
$max = Notice::maxContent(); $max = Notice::maxContent();
// TRANS: Link description for link to full notice text if it is longer than
// TRANS: what will be dispplayed.
$ellipsis = _m('…');
$short = mb_substr($content, 0, $max - 1); $short = mb_substr($content, 0, $max - 1);
$short .= sprintf( $short .= sprintf('<a href="%1$s" rel="more" title="%2$s">%3$s</a>',
// TRANS: Link to full notice text if it is longer than what will be dispplayed. $notice->uri,
// TRANS: %s a notice URI. // TRANS: Title for link that is an ellipsis in English.
_m('<a href="%s" rel="more" title="%s">…</a>'), _m('more...'),
$notice->uri, $ellipsis);
_m('more...')
);
} else { } else {
$short = $content; $short = $content;
} }
...@@ -513,7 +520,6 @@ class QnAPlugin extends MicroAppPlugin ...@@ -513,7 +520,6 @@ class QnAPlugin extends MicroAppPlugin
* @param HTMLOutputter $out * @param HTMLOutputter $out
* @return Widget * @return Widget
*/ */
function entryForm($out) function entryForm($out)
{ {
return new QnanewquestionForm($out); return new QnanewquestionForm($out);
...@@ -524,7 +530,6 @@ class QnAPlugin extends MicroAppPlugin ...@@ -524,7 +530,6 @@ class QnAPlugin extends MicroAppPlugin
* *
* @param Notice $notice * @param Notice $notice
*/ */
function deleteRelated($notice) function deleteRelated($notice)
{ {
switch ($notice->object_type) { switch ($notice->object_type) {
......
...@@ -80,8 +80,8 @@ class QnaclosequestionAction extends Action ...@@ -80,8 +80,8 @@ class QnaclosequestionAction extends Action
$this->user = common_current_user(); $this->user = common_current_user();
if (empty($this->user)) { if (empty($this->user)) {
// TRANS: Client exception thrown trying to close a question when not logged in
throw new ClientException( throw new ClientException(
// TRANS: Client exception thrown trying to close a question when not logged in
_m("You must be logged in to close a question."), _m("You must be logged in to close a question."),
403 403
); );
...@@ -128,13 +128,12 @@ class QnaclosequestionAction extends Action ...@@ -128,13 +128,12 @@ class QnaclosequestionAction extends Action
*/ */
function closeQuestion() function closeQuestion()
{ {
$user = common_current_user(); $user = common_current_user();
try { try {
if ($user->id != $this->question->profile_id) { if ($user->id != $this->question->profile_id) {
throw new Exception(_m('You didn\'t ask this question.')); // TRANS: Exception thrown trying to close another user's question.
throw new Exception(_m('You did not ask this question.'));
} }
$orig = clone($this->question); $orig = clone($this->question);
......
...@@ -80,8 +80,8 @@ class QnanewanswerAction extends Action ...@@ -80,8 +80,8 @@ class QnanewanswerAction extends Action
$this->user = common_current_user(); $this->user = common_current_user();
if (empty($this->user)) { if (empty($this->user)) {
// TRANS: Client exception thrown trying to answer a question while not logged in.
throw new ClientException( throw new ClientException(
// TRANS: Client exception thrown trying to answer a question while not logged in.
_m("You must be logged in to answer to a question."), _m("You must be logged in to answer to a question."),
403 403
); );
...@@ -96,8 +96,8 @@ class QnanewanswerAction extends Action ...@@ -96,8 +96,8 @@ class QnanewanswerAction extends Action
$this->question = QnA_Question::staticGet('id', $id); $this->question = QnA_Question::staticGet('id', $id);
if (empty($this->question)) { if (empty($this->question)) {
// TRANS: Client exception thrown trying to respond to a non-existing question.
throw new ClientException( throw new ClientException(
// TRANS: Client exception thrown trying to respond to a non-existing question.
_m('Invalid or missing question.'), _m('Invalid or missing question.'),
404 404
); );
...@@ -162,7 +162,6 @@ class QnanewanswerAction extends Action ...@@ -162,7 +162,6 @@ class QnanewanswerAction extends Action
$this->elementStart('body'); $this->elementStart('body');
$nli = new NoticeAnswerListItem($notice, $this, $this->question, $answer); $nli = new NoticeAnswerListItem($notice, $this, $this->question, $answer);
$nli->show(); $nli->show();
...@@ -278,7 +277,6 @@ class QnanewanswerAction extends Action ...@@ -278,7 +277,6 @@ class QnanewanswerAction extends Action
$this->msg = $msg; $this->msg = $msg;
$this->showPage(); $this->showPage();
} }
} }
class NoticeAnswerListItem extends NoticeListItem class NoticeAnswerListItem extends NoticeListItem
...@@ -344,10 +342,10 @@ class NoticeAnswerListItem extends NoticeListItem ...@@ -344,10 +342,10 @@ class NoticeAnswerListItem extends NoticeListItem
$form = new QnashowanswerForm($this->out, $this->answer); $form = new QnashowanswerForm($this->out, $this->answer);
$form->show(); $form->show();
} else { } else {
// TRANS: Error message displayed when an answer has no content.
$out->text(_m('Answer data is missing.')); $out->text(_m('Answer data is missing.'));
} }
$this->out->elementEnd('p'); $this->out->elementEnd('p');
} }
}
}
\ No newline at end of file
...@@ -76,8 +76,8 @@ class QnanewquestionAction extends Action ...@@ -76,8 +76,8 @@ class QnanewquestionAction extends Action
$this->user = common_current_user(); $this->user = common_current_user();
if (empty($this->user)) { if (empty($this->user)) {
// TRANS: Client exception thrown trying to create a Question while not logged in.
throw new ClientException( throw new ClientException(
// TRANS: Client exception thrown trying to create a Question while not logged in.
_m('You must be logged in to post a question.'), _m('You must be logged in to post a question.'),
403 403
); );
...@@ -240,5 +240,4 @@ class NoticeQuestionListItem extends NoticeListItem ...@@ -240,5 +240,4 @@ class NoticeQuestionListItem extends NoticeListItem
$this->out->element('ul', 'notices threaded-replies xoxo'); $this->out->element('ul', 'notices threaded-replies xoxo');
parent::showEnd(); parent::showEnd();
} }
}
}
\ No newline at end of file
...@@ -79,8 +79,8 @@ class QnareviseanswerAction extends Action ...@@ -79,8 +79,8 @@ class QnareviseanswerAction extends Action
$this->user = common_current_user(); $this->user = common_current_user();
if (empty($this->user)) { if (empty($this->user)) {
// TRANS: Client exception thrown trying to answer a question while not logged in.
throw new ClientException( throw new ClientException(
// TRANS: Client exception thrown trying to answer a question while not logged in.
_m("You must be logged in to answer to a question."), _m("You must be logged in to answer to a question."),
403 403
); );
...@@ -92,8 +92,8 @@ class QnareviseanswerAction extends Action ...@@ -92,8 +92,8 @@ class QnareviseanswerAction extends Action
$this->question = $this->answer->getQuestion(); $this->question = $this->answer->getQuestion();
if (empty($this->answer) || empty($this->question)) { if (empty($this->answer) || empty($this->question)) {
// TRANS: Client exception thrown trying to respond to a non-existing question.
throw new ClientException( throw new ClientException(
// TRANS: Client exception thrown trying to respond to a non-existing question.
_m('Invalid or missing answer.'), _m('Invalid or missing answer.'),
404 404
); );
...@@ -243,7 +243,8 @@ class QnareviseanswerAction extends Action ...@@ -243,7 +243,8 @@ class QnareviseanswerAction 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');
$this->element('title', null, _m('Answer')); // TRANS: Form title for sending an answer.
$this->element('title', null, _m('TITLE','Answer'));
$this->elementEnd('head'); $this->elementEnd('head');
$this->elementStart('body'); $this->elementStart('body');
$form = new QnareviseanswerForm($this->answer, $this); $form = new QnareviseanswerForm($this->answer, $this);
......
...@@ -64,31 +64,35 @@ class QnashowanswerAction extends ShownoticeAction ...@@ -64,31 +64,35 @@ class QnashowanswerAction extends ShownoticeAction
$this->answer = QnA_Answer::staticGet('id', $this->id); $this->answer = QnA_Answer::staticGet('id', $this->id);
if (empty($this->answer)) { if (empty($this->answer)) {
// TRANS: Client exception thrown when requesting a non-existing answer.
throw new ClientException(_m('No such answer.'), 404); throw new ClientException(_m('No such answer.'), 404);
} }
$this->question = $this->answer->getQuestion(); $this->question = $this->answer->getQuestion();
if (empty($this->question)) { if (empty($this->question)) {
// TRANS: Client exception thrown when requesting an answer that has no connected question.
throw new ClientException(_m('No question for this answer.'), 404); throw new ClientException(_m('No question for this answer.'), 404);
} }
$this->notice = Notice::staticGet('uri', $this->answer->uri); $this->notice = Notice::staticGet('uri', $this->answer->uri);
if (empty($this->notice)) { if (empty($this->notice)) {
// Did we used to have it, and it got deleted? // TRANS: Did we used to have it, and it got deleted?
throw new ClientException(_m('No such answer.'), 404); throw new ClientException(_m('No such answer.'), 404);
} }
$this->user = User::staticGet('id', $this->answer->profile_id); $this->user = User::staticGet('id', $this->answer->profile_id);
if (empty($this->user)) { if (empty($this->user)) {
// TRANS: Client exception thrown when requesting answer data for a non-existing user.
throw new ClientException(_m('No such user.'), 404); throw new ClientException(_m('No such user.'), 404);
} }
$this->profile = $this->user->getProfile(); $this->profile = $this->user->getProfile();
if (empty($this->profile)) { if (empty($this->profile)) {
// TRANS: Client exception thrown when requesting answer data for a user without a profile.
throw new ServerException(_m('User without a profile.')); throw new ServerException(_m('User without a profile.'));
} }
......
...@@ -151,9 +151,9 @@ class QnashowquestionAction extends ShownoticeAction ...@@ -151,9 +151,9 @@ class QnashowquestionAction extends ShownoticeAction
*/ */
function title() function title()
{ {
// TRANS: Page title for a question.
// TRANS: %1$s is the nickname of the user who asked the question, %2$s is the question.
return sprintf( return sprintf(
// TRANS: Page title for a question.
// TRANS: %1$s is the nickname of the user who asked the question, %2$s is the question.
_m('%1$s\'s question: %2$s'), _m('%1$s\'s question: %2$s'),
$this->user->nickname, $this->user->nickname,
$this->question->title $this->question->title
...@@ -168,7 +168,6 @@ class QnashowquestionAction extends ShownoticeAction ...@@ -168,7 +168,6 @@ class QnashowquestionAction extends ShownoticeAction
return Action::lastModified(); return Action::lastModified();
} }
/** /**
* @fixme combine the notice time with question update time * @fixme combine the notice time with question update time
*/ */
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* StatusNet - the distributed open-source microblogging tool * StatusNet - the distributed open-source microblogging tool
* Copyright (C) 2011, StatusNet, Inc. * Copyright (C) 2011, StatusNet, Inc.
* *
* Vote on a questino or answer * Vote on a question or answer
* *
* PHP version 5 * PHP version 5
* *
...@@ -81,7 +81,7 @@ class Qnavote extends Action ...@@ -81,7 +81,7 @@ class Qnavote extends Action
if (empty($this->user)) { if (empty($this->user)) {
// TRANS: Client exception thrown trying to answer a question while not logged in. // TRANS: Client exception thrown trying to answer a question while not logged in.
throw new ClientException(_m("You must be logged in to answer to a question."), throw new ClientException(_m('You must be logged in to answer to a question.'),
403); 403);
} }
...@@ -146,7 +146,7 @@ class Qnavote extends Action ...@@ -146,7 +146,7 @@ class Qnavote 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: Page title after sending an answer.