Update translator documentation.

Update whitespace.
L10n/i18n updates.
This commit is contained in:
Siebrand Mazeland 2011-06-05 11:06:08 +02:00
parent 323f7f1e9c
commit 9758134d1a
17 changed files with 103 additions and 79 deletions

View File

@ -80,7 +80,8 @@ class EmailregisterAction extends Action
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()) {
@ -91,7 +92,8 @@ class EmailregisterAction extends Action
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;
@ -109,6 +111,7 @@ class EmailregisterAction extends Action
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 {
@ -131,13 +134,15 @@ class EmailregisterAction extends Action
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;
@ -180,7 +185,6 @@ class EmailregisterAction extends Action
*
* @return void
*/
function handle($argarray=null)
{
$cur = common_current_user();
@ -263,7 +267,8 @@ class EmailregisterAction extends Action
} 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) {
@ -308,7 +313,8 @@ class EmailregisterAction extends Action
}
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);
@ -346,8 +352,8 @@ class EmailregisterAction extends Action
$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.'.

View File

@ -175,7 +175,7 @@ class QnAPlugin extends MicroAppPlugin
function appTitle() {
// TRANS: Application title.
return _m('Question');
return _m('TITLE','Question');
}
function tag() {
@ -202,12 +202,14 @@ class QnAPlugin extends MicroAppPlugin
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.'));
}
@ -226,12 +228,14 @@ class QnAPlugin extends MicroAppPlugin
$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;
@ -260,12 +264,14 @@ class QnAPlugin extends MicroAppPlugin
}
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.'));
}
@ -387,6 +393,7 @@ class QnAPlugin extends MicroAppPlugin
$form->show();
} else {
// TRANS: Error message displayed when question data is not present.
$out->text(_m('Question data is missing.'));
}
$out->elementEnd('div');
@ -395,7 +402,6 @@ class QnAPlugin extends MicroAppPlugin
$out->elementStart('div', array('class' => 'entry-content'));
}
/**
* Output the HTML for this kind of object in a list
*
@ -403,7 +409,7 @@ class QnAPlugin extends MicroAppPlugin
*
* @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)
{
@ -427,12 +433,10 @@ class QnAPlugin extends MicroAppPlugin
$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);
@ -447,6 +451,8 @@ class QnAPlugin extends MicroAppPlugin
'input',
array(
'class' => 'placeholder',
// TRANS: Placeholder value for a possible answer to a question
// TRANS: by the logged in user.
'value' => _m('Your answer...')
)
);
@ -459,7 +465,6 @@ class QnAPlugin extends MicroAppPlugin
return false;
}
function showNoticeAnswer($notice, $out)
{
$user = common_current_user();
@ -476,12 +481,13 @@ class QnAPlugin extends MicroAppPlugin
$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'));
}
@ -492,14 +498,15 @@ class QnAPlugin extends MicroAppPlugin
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;
}
@ -513,7 +520,6 @@ class QnAPlugin extends MicroAppPlugin
* @param HTMLOutputter $out
* @return Widget
*/
function entryForm($out)
{
return new QnanewquestionForm($out);
@ -524,7 +530,6 @@ class QnAPlugin extends MicroAppPlugin
*
* @param Notice $notice
*/
function deleteRelated($notice)
{
switch ($notice->object_type) {

View File

@ -80,8 +80,8 @@ class QnaclosequestionAction extends Action
$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
);
@ -128,13 +128,12 @@ class QnaclosequestionAction extends Action
*/
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);

View File

@ -80,8 +80,8 @@ class QnanewanswerAction extends Action
$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
);
@ -96,8 +96,8 @@ class QnanewanswerAction extends Action
$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
);
@ -162,7 +162,6 @@ class QnanewanswerAction extends Action
$this->elementStart('body');
$nli = new NoticeAnswerListItem($notice, $this, $this->question, $answer);
$nli->show();
@ -278,7 +277,6 @@ class QnanewanswerAction extends Action
$this->msg = $msg;
$this->showPage();
}
}
class NoticeAnswerListItem extends NoticeListItem
@ -344,10 +342,10 @@ 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');
}
}
}

View File

@ -76,8 +76,8 @@ class QnanewquestionAction extends Action
$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
);
@ -240,5 +240,4 @@ class NoticeQuestionListItem extends NoticeListItem
$this->out->element('ul', 'notices threaded-replies xoxo');
parent::showEnd();
}
}
}

View File

@ -79,8 +79,8 @@ class QnareviseanswerAction extends Action
$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
);
@ -92,8 +92,8 @@ class QnareviseanswerAction extends Action
$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
);
@ -243,7 +243,8 @@ class QnareviseanswerAction extends Action
$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);

View File

@ -64,31 +64,35 @@ class QnashowanswerAction extends ShownoticeAction
$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.'));
}

View File

@ -151,9 +151,9 @@ class QnashowquestionAction extends ShownoticeAction
*/
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
@ -168,7 +168,6 @@ class QnashowquestionAction extends ShownoticeAction
return Action::lastModified();
}
/**
* @fixme combine the notice time with question update time
*/

View File

@ -3,7 +3,7 @@
* 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
*
@ -81,7 +81,7 @@ class Qnavote extends Action
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);
}
@ -146,7 +146,7 @@ class Qnavote extends Action
$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');

View File

@ -174,7 +174,9 @@ class QnA_Answer extends Managed_DataObject
{
$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;
}
@ -183,7 +185,9 @@ class QnA_Answer extends Managed_DataObject
{
$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;
}
@ -226,7 +230,9 @@ class QnA_Answer extends Managed_DataObject
$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');
@ -239,14 +245,14 @@ class QnA_Answer extends Managed_DataObject
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)
@ -285,6 +291,8 @@ class QnA_Answer extends Managed_DataObject
$answer->insert();
$content = sprintf(
// TRANS: Text for a question that was answered.
// TRANS: %s is the question title.
_m('answered "%s"'),
$question->title
);

View File

@ -42,7 +42,6 @@ if (!defined('STATUSNET')) {
*
* @see DB_DataObject
*/
class QnA_Question extends Managed_DataObject
{
const OBJECT_TYPE = 'http://activityschema.org/object/question';
@ -150,7 +149,9 @@ class QnA_Question extends Managed_DataObject
{
$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;
}
@ -235,12 +236,15 @@ class QnA_Question extends Managed_DataObject
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');
}
@ -298,7 +302,6 @@ class QnA_Question extends Managed_DataObject
$uriLen = mb_strlen($q->uri);
$targetLen = $max - ($uriLen + 15);
$title = mb_substr($q->title, 0, $targetLen) . '…';
}
$content = $title . ' ' . $q->uri;

View File

@ -124,4 +124,3 @@ class QnanewanswerForm extends Form
$this->out->submit('qna-answer-submit', _m('BUTTON', 'Answer'), 'submit', 'submit');
}
}

View File

@ -106,18 +106,22 @@ class QnanewquestionForm extends Form
$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();

View File

@ -115,7 +115,7 @@ class QnareviseanswerForm extends Form
*/
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'));
}
}

View File

@ -146,19 +146,19 @@ class QnashowanswerForm extends Form
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.
*/
@ -166,12 +166,12 @@ class QnashowanswerForm extends Form
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.')
);
}
*/

View File

@ -103,7 +103,7 @@ class QnashowquestionForm extends Form
function formLegend()
{
// TRANS: Form legend for revising the answer.
$this->out->element('legend', null, _m('Question'));
$this->out->element('legend', null, _m('LEGEND','Question'));
}
/**
@ -114,7 +114,7 @@ class QnashowquestionForm extends Form
function formData()
{
$this->out->hidden(
'qna-quesiton-id',
'qna-question-id',
'question-' . $this->question->id,
'id'
);
@ -147,12 +147,12 @@ class QnashowquestionForm extends Form
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.')
);
}
}

View File

@ -118,4 +118,3 @@ class QnavoteForm extends Form
$this->out->submit('submit', _m('BUTTON', 'Submit'));
}
}