Update whitespace.
L10n/i18n updates.
parent::prepare($argarray);
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 (!empty($this->email)) {
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->state = self::NEWEMAIL;
if (!empty($this->invitation)) {
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);
}
} else {
if (empty($this->code)) {
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;
} else {
$this->invitation = Invitation::staticGet('code', $this->code);
if (!empty($this->invitation)) {
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);
}
$this->state = self::CONFIRMINVITE;
*
* @return void
*/
-
function handle($argarray=null)
{
$cur = common_current_user();
} else if (!empty($this->confirmation)) {
$email = trim($this->confirmation->address);
} 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 (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);
$confirmUrl = common_local_url('register', array('code' => $confirm->code));
- // TRANS: Body for confirmation e-mail.
- // TRANS: %1$s is the StatusNet sitename, %2$s is the confirmation URL.
+ // TRANS: Body for confirmation e-mail.
+ // 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.'.
"\n".
'To confirm the address, click the following URL or copy it into the address bar of your browser.'.
function appTitle() {
// TRANS: Application title.
- return _m('Question');
+ return _m('TITLE','Question');
}
function tag() {
function saveNoticeFromActivity($activity, $actor, $options=array())
{
if (count($activity->objects) != 1) {
+ // TRANS: Exception thrown when there are too many activity objects.
throw new Exception(_m('Too many activity objects.'));
}
$questionObj = $activity->objects[0];
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.'));
}
$question = QnA_Question::staticGet('uri', $questionObj->id);
if (empty($question)) {
// FIXME: save the question
+ // TRANS: Exception thrown when answering a non-existing question.
throw new Exception(_m('Answer to unknown question.'));
}
$notice = QnA_Answer::saveNew($actor, $question, $options);
break;
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;
}
if (empty($question)) {
+ // TRANS: Exception thrown when an object type is encountered that cannot be handled.
throw new Exception(_m('Unknown object type.'));
}
$notice = $question->getNotice();
if (empty($notice)) {
+ // TRANS: Exception thrown when requesting a non-existing question notice.
throw new Exception(_m('Unknown question notice.'));
}
$form->show();
} else {
+ // TRANS: Error message displayed when question data is not present.
$out->text(_m('Question data is missing.'));
}
$out->elementEnd('div');
$out->elementStart('div', array('class' => 'entry-content'));
}
-
/**
* Output the HTML for this kind of object in a list
*
*
* @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)
{
$nli->showNoticeOptions();
if ($notice->object_type == QnA_Question::OBJECT_TYPE) {
-
$user = common_current_user();
$question = QnA_Question::getByNotice($notice);
if (!empty($user)) {
-
$profile = $user->getProfile();
$answer = $question->getAnswer($profile);
'input',
array(
'class' => 'placeholder',
+ // TRANS: Placeholder value for a possible answer to a question
+ // TRANS: by the logged in user.
'value' => _m('Your answer...')
)
);
return false;
}
-
function showNoticeAnswer($notice, $out)
{
$user = common_current_user();
$form = new QnashowanswerForm($out, $answer);
$form->show();
} else {
+ // TRANS: Error message displayed when answer data is not present.
$out->text(_m('Answer data is missing.'));
}
$out->elementEnd('div');
- // @fixme
+ // @todo FIXME
$out->elementStart('div', array('class' => 'entry-content'));
}
if (Notice::contentTooLong($content)) {
common_debug("content too long");
$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 .= sprintf(
- // TRANS: Link to full notice text if it is longer than what will be dispplayed.
- // TRANS: %s a notice URI.
- _m('<a href="%s" rel="more" title="%s">…</a>'),
- $notice->uri,
- _m('more...')
- );
+ $short .= sprintf('<a href="%1$s" rel="more" title="%2$s">%3$s</a>',
+ $notice->uri,
+ // TRANS: Title for link that is an ellipsis in English.
+ _m('more...'),
+ $ellipsis);
} else {
$short = $content;
}
* @param HTMLOutputter $out
* @return Widget
*/
-
function entryForm($out)
{
return new QnanewquestionForm($out);
*
* @param Notice $notice
*/
-
function deleteRelated($notice)
{
switch ($notice->object_type) {
$this->user = common_current_user();
if (empty($this->user)) {
- // TRANS: Client exception thrown trying to close a question when not logged in
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."),
403
);
*/
function closeQuestion()
{
-
$user = common_current_user();
try {
-
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);
$this->user = common_current_user();
if (empty($this->user)) {
- // TRANS: Client exception thrown trying to answer a question while not logged in.
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."),
403
);
$this->question = QnA_Question::staticGet('id', $id);
if (empty($this->question)) {
- // TRANS: Client exception thrown trying to respond to a non-existing question.
throw new ClientException(
+ // TRANS: Client exception thrown trying to respond to a non-existing question.
_m('Invalid or missing question.'),
404
);
$this->elementStart('body');
-
$nli = new NoticeAnswerListItem($notice, $this, $this->question, $answer);
$nli->show();
$this->msg = $msg;
$this->showPage();
}
-
}
class NoticeAnswerListItem extends NoticeListItem
$form = new QnashowanswerForm($this->out, $this->answer);
$form->show();
} else {
+ // TRANS: Error message displayed when an answer has no content.
$out->text(_m('Answer data is missing.'));
}
$this->out->elementEnd('p');
}
-
-}
\ No newline at end of file
+}
$this->user = common_current_user();
if (empty($this->user)) {
- // TRANS: Client exception thrown trying to create a Question while not logged in.
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.'),
403
);
$this->out->element('ul', 'notices threaded-replies xoxo');
parent::showEnd();
}
-
-}
\ No newline at end of file
+}
$this->user = common_current_user();
if (empty($this->user)) {
- // TRANS: Client exception thrown trying to answer a question while not logged in.
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."),
403
);
$this->question = $this->answer->getQuestion();
if (empty($this->answer) || empty($this->question)) {
- // TRANS: Client exception thrown trying to respond to a non-existing question.
throw new ClientException(
+ // TRANS: Client exception thrown trying to respond to a non-existing question.
_m('Invalid or missing answer.'),
404
);
$this->xw->startDocument('1.0', 'UTF-8');
$this->elementStart('html');
$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->elementStart('body');
$form = new QnareviseanswerForm($this->answer, $this);
$this->answer = QnA_Answer::staticGet('id', $this->id);
if (empty($this->answer)) {
+ // TRANS: Client exception thrown when requesting a non-existing answer.
throw new ClientException(_m('No such answer.'), 404);
}
$this->question = $this->answer->getQuestion();
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);
}
$this->notice = Notice::staticGet('uri', $this->answer->uri);
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);
}
$this->user = User::staticGet('id', $this->answer->profile_id);
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);
}
$this->profile = $this->user->getProfile();
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.'));
}
*/
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(
+ // 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'),
$this->user->nickname,
$this->question->title
return Action::lastModified();
}
-
/**
* @fixme combine the notice time with question update time
*/
* StatusNet - the distributed open-source microblogging tool
* Copyright (C) 2011, StatusNet, Inc.
*
- * Vote on a questino or answer
+ * Vote on a question or answer
*
* PHP version 5
*
if (empty($this->user)) {
// 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);
}
$this->xw->startDocument('1.0', 'UTF-8');
$this->elementStart('html');
$this->elementStart('head');
- // TRANS: Page title after sending an answer.
+ // TRANS: Page title after sending in a vote for a question or answer.
$this->element('title', null, _m('Answers'));
$this->elementEnd('head');
$this->elementStart('body');
{
$question = QnA_Question::staticGet('id', $this->question_id);
if (empty($question)) {
- throw new Exception("No question with ID {$this->question_id}");
+ // TRANS: Exception thown when getting a question with a non-existing ID.
+ // TRANS: %s is the non-existing question ID.
+ throw new Exception(sprintf(_m('No question with ID %s'),$this->question_id));
}
return $question;
}
{
$profile = Profile::staticGet('id', $this->profile_id);
if (empty($profile)) {
- throw new Exception("No profile with ID {$this->profile_id}");
+ // TRANS: Exception thown when getting a profile with a non-existing ID.
+ // TRANS: %s is the non-existing profile ID.
+ throw new Exception(sprintf(_m('No profile with ID %s'),$this->profile_id));
}
return $profile;
}
$out->elementstart('span', 'answer-revisions');
$out->text(
htmlspecialchars(
- sprintf(_m('%s revisions'), $answer->revisions)
+ // Notification of how often an answer was revised.
+ // TRANS: %s is the number of answer revisions.
+ sprintf(_m('%s revision','%s revisions',$answer->revisions), $answer->revisions)
)
);
$out->elementEnd('span');
static function toString($profile, $question, $answer)
{
+ // @todo FIXME: unused variable?
$notice = $question->getNotice();
- $fmt = _m(
- '%1$s answered the question "%2$s": %3$s'
- );
-
return sprintf(
- $fmt,
+ // TRANS: Text for a question that was answered.
+ // TRANS: %1$s is the user that answered, %2$s is the question title,
+ // TRANS: %2$s is the answer content.
+ _m('%1$s answered the question "%2$s": %3$s'),
htmlspecialchars($profile->getBestName()),
htmlspecialchars($question->title),
htmlspecialchars($answer->content)
$answer->insert();
$content = sprintf(
+ // TRANS: Text for a question that was answered.
+ // TRANS: %s is the question title.
_m('answered "%s"'),
$question->title
);
*
* @see DB_DataObject
*/
-
class QnA_Question extends Managed_DataObject
{
const OBJECT_TYPE = 'http://activityschema.org/object/question';
{
$profile = Profile::staticGet('id', $this->profile_id);
if (empty($profile)) {
- throw new Exception("No profile with ID {$this->profile_id}");
+ // TRANS: Exception trown when getting a profile for a non-existing ID.
+ // TRANS: %s is the provided profile ID.
+ throw new Exception(sprintf(_m('No profile with ID %s'),$this->profile_id));
}
return $profile;
}
if (!empty($cnt)) {
$out->elementStart('span', 'answer-count');
- $out->text(sprintf(_m('%s answers'), $cnt));
+ // TRANS: Number of given answers to a question.
+ // TRANS: %d is the number of given answers.
+ $out->text(sprintf(_m('%s answer','%s answers'), $cnt));
$out->elementEnd('span');
}
if (!empty($question->closed)) {
$out->elementStart('span', 'question-closed');
+ // TRANS: Notification that a question cannot be answered anymore because it is closed.
$out->text(_m('This question is closed.'));
$out->elementEnd('span');
}
$uriLen = mb_strlen($q->uri);
$targetLen = $max - ($uriLen + 15);
$title = mb_substr($q->title, 0, $targetLen) . '…';
-
}
$content = $title . ' ' . $q->uri;
$this->out->submit('qna-answer-submit', _m('BUTTON', 'Answer'), 'submit', 'submit');
}
}
-
$this->li();
$this->out->input(
'qna-question-title',
- _m('Title'),
+ // TRANS: Field label for a new question.
+ _m('LABEL','Title'),
$this->title,
- _m('Title of your question'),
+ // TRANS: Field title for a new question.
+ _m('The title of your question.'),
'title'
);
$this->unli();
$this->li();
$this->out->textarea(
'qna-question-description',
- _m('Description'),
+ // TRANS: Field label for question details.
+ _m('LABEL','Description'),
$this->description,
- _m('Your question in detail'),
+ // TRANS: Field title for question details.
+ _m('Your question in detail.'),
'description'
);
$this->unli();
*/
function formActions()
{
- // TRANS: Button text for submitting a poll response.
+ // TRANS: Button text for submitting a revised answer.
$this->out->submit('submit', _m('BUTTON', 'Submit'));
}
}
if (empty($this->answer->best)) {
$this->out->submit(
'qna-best-answer',
- // TRANS: Button text for marking an answer as "best"
+ // TRANS: Button text for marking an answer as "best".
_m('BUTTON', 'Best'),
'submit',
'best',
- // TRANS: Title for button text marking an answer as "best"
- _m('Mark as best answer')
+ // TRANS: Title for button text marking an answer as "best".
+ _m('Mark this answer as the best answer.')
);
}
}
/*
- * @fixme: Revise is disabled until we figure out the
+ * @todo FIXME: Revise is disabled until we figure out the
* Ostatus bits This comment is just a reminder
* that the UI for this works.
*/
if ($user->id == $this->answer->profile_id) {
$this->out->submit(
'revise',
- // TRANS: Button text for revising an answer
+ // TRANS: Button text for revising an answer.
_m('BUTTON', 'Revise'),
'submit',
null,
- // TRANS: Title for button text for revising an answer
- _m('Revise your answer')
+ // TRANS: Title for button text for revising an answer.
+ _m('Revise your answer.')
);
}
*/
function formLegend()
{
// TRANS: Form legend for revising the answer.
- $this->out->element('legend', null, _m('Question'));
+ $this->out->element('legend', null, _m('LEGEND','Question'));
}
/**
function formData()
{
$this->out->hidden(
- 'qna-quesiton-id',
+ 'qna-question-id',
'question-' . $this->question->id,
'id'
);
if ($user->id == $this->question->profile_id) {
$this->out->submit(
'qna-question-close',
- // TRANS: Button text for closing a question
+ // TRANS: Button text for closing a question.
_m('BUTTON', 'Close'),
'submit',
'submit',
- // TRANS: Title for button text for closing a question
- _m('Close the question')
+ // TRANS: Title for button text for closing a question.
+ _m('Close the question to no one can answer it anymore.')
);
}
}
$this->out->submit('submit', _m('BUTTON', 'Submit'));
}
}
-