forked from GNUsocial/gnu-social
i18n/L10n updates
Translator documentation added
This commit is contained in:
parent
a70914cd57
commit
843ace580d
@ -235,12 +235,15 @@ class Poll extends Managed_DataObject
|
||||
common_log(LOG_DEBUG, "Saving poll: $p->id $p->uri");
|
||||
$p->insert();
|
||||
|
||||
$content = sprintf(_m('Poll: %s %s'),
|
||||
// TRANS: Notice content creating a poll.
|
||||
// TRANS: %1$s is the poll question, %2$s is a link to the poll.
|
||||
$content = sprintf(_m('Poll: %1$s %2$s'),
|
||||
$question,
|
||||
$p->uri);
|
||||
$rendered = sprintf(_m('Poll: <a href="%s">%s</a>'),
|
||||
htmlspecialchars($p->uri),
|
||||
htmlspecialchars($question));
|
||||
$link = '<a href="' . htmlspecialchars($p->uri) . '">' . htmlspecialchars($question) . '</a>';
|
||||
// TRANS: Rendered version of the notice content creating a poll.
|
||||
// TRANS: %s a link to the poll with the question as link description.
|
||||
$rendered = sprintf(_m('Poll: %s'), $link);
|
||||
|
||||
$tags = array('poll');
|
||||
$replies = array();
|
||||
|
@ -153,6 +153,7 @@ class PollPlugin extends MicroAppPlugin
|
||||
'author' => 'Brion Vibber',
|
||||
'homepage' => 'http://status.net/wiki/Plugin:Poll',
|
||||
'rawdescription' =>
|
||||
// TRANS: Plugin description.
|
||||
_m('Simple extension for supporting basic polls.'));
|
||||
return true;
|
||||
}
|
||||
@ -229,11 +230,13 @@ class PollPlugin extends MicroAppPlugin
|
||||
$selection = intval($data->getAttribute('selection'));
|
||||
|
||||
if (!$pollUri) {
|
||||
throw new Exception('Invalid poll response: no poll reference.');
|
||||
// TRANS: Exception thrown trying to respond to a poll without a poll reference.
|
||||
throw new Exception(_m('Invalid poll response: no poll reference.'));
|
||||
}
|
||||
$poll = Poll::staticGet('uri', $pollUri);
|
||||
if (!$poll) {
|
||||
throw new Exception('Invalid poll response: poll is unknown.');
|
||||
// TRANS: Exception thrown trying to respond to a non-existing poll.
|
||||
throw new Exception(_m('Invalid poll response: poll is unknown.'));
|
||||
}
|
||||
try {
|
||||
$notice = Poll_response::saveNew($profile, $poll, $selection, $options);
|
||||
@ -258,7 +261,9 @@ class PollPlugin extends MicroAppPlugin
|
||||
case self::POLL_RESPONSE_OBJECT:
|
||||
return $this->activityObjectFromNoticePollResponse($notice);
|
||||
default:
|
||||
throw new Exception('Unexpected type for poll plugin: ' . $notice->object_type);
|
||||
// TRANS: Exception thrown when performing an unexpected action on a poll.
|
||||
// TRANS: %s is the unpexpected object type.
|
||||
throw new Exception(sprintf(_m('Unexpected type for poll plugin: %s.'), $notice->object_type));
|
||||
}
|
||||
}
|
||||
|
||||
@ -361,7 +366,9 @@ class PollPlugin extends MicroAppPlugin
|
||||
case self::POLL_RESPONSE_OBJECT:
|
||||
return $this->showNoticePollResponse($notice, $out);
|
||||
default:
|
||||
throw new Exception('Unexpected type for poll plugin: ' . $notice->object_type);
|
||||
// TRANS: Exception thrown when performing an unexpected action on a poll.
|
||||
// TRANS: %s is the unpexpected object type.
|
||||
throw new Exception(sprintf(_m('Unexpected type for poll plugin: %s.'), $notice->object_type));
|
||||
}
|
||||
}
|
||||
|
||||
@ -388,7 +395,7 @@ class PollPlugin extends MicroAppPlugin
|
||||
$form->show();
|
||||
}
|
||||
} else {
|
||||
$out->text('Poll data is missing');
|
||||
$out->text(_('Poll data is missing'));
|
||||
}
|
||||
$out->elementEnd('div');
|
||||
|
||||
@ -421,6 +428,7 @@ class PollPlugin extends MicroAppPlugin
|
||||
|
||||
function appTitle()
|
||||
{
|
||||
return _m('Poll');
|
||||
// TRANS: Application title.
|
||||
return _m('APPTITLE','Poll');
|
||||
}
|
||||
}
|
||||
|
@ -162,6 +162,7 @@ class Poll_response extends Managed_DataObject
|
||||
}
|
||||
|
||||
if (!$poll->isValidSelection($selection)) {
|
||||
// TRANS: Client exception thrown when responding to a poll with an invalid option.
|
||||
throw new ClientException(_m('Invalid poll selection.'));
|
||||
}
|
||||
$opts = $poll->getOptions();
|
||||
@ -189,11 +190,14 @@ class Poll_response extends Managed_DataObject
|
||||
common_log(LOG_DEBUG, "Saving poll response: $pr->id $pr->uri");
|
||||
$pr->insert();
|
||||
|
||||
// TRANS: Notice content voting for a poll.
|
||||
// TRANS: %s is the chosen option in the poll.
|
||||
$content = sprintf(_m('voted for "%s"'),
|
||||
$answer);
|
||||
$rendered = sprintf(_m('voted for “<a href="%s">%s</a>”'),
|
||||
htmlspecialchars($poll->uri),
|
||||
htmlspecialchars($answer));
|
||||
$link = '<a href="' . htmlspecialchars($poll->uri) . '">' . htmlspecialchars($answer) . '</a>';
|
||||
// TRANS: Rendered version of the notice content voting for a poll.
|
||||
// TRANS: %s a link to the poll with the chosen option as link description.
|
||||
$rendered = sprintf(_m('voted for "%s"'), $link);
|
||||
|
||||
$tags = array();
|
||||
$replies = array();
|
||||
|
@ -59,6 +59,7 @@ class NewPollAction extends Action
|
||||
*/
|
||||
function title()
|
||||
{
|
||||
// TRANS: Title for poll page.
|
||||
return _m('New poll');
|
||||
}
|
||||
|
||||
@ -76,6 +77,7 @@ class NewPollAction extends Action
|
||||
$this->user = common_current_user();
|
||||
|
||||
if (empty($this->user)) {
|
||||
// TRANS: Client exception thrown trying to create a poll while not logged in.
|
||||
throw new ClientException(_m('You must be logged in to post a poll.'),
|
||||
403);
|
||||
}
|
||||
@ -127,10 +129,12 @@ class NewPollAction extends Action
|
||||
}
|
||||
try {
|
||||
if (empty($this->question)) {
|
||||
// TRANS: Client exception thrown trying to create a poll without a question.
|
||||
throw new ClientException(_m('Poll must have a question.'));
|
||||
}
|
||||
|
||||
if (count($this->options) < 2) {
|
||||
// TRANS: Client exception thrown trying to create a poll with fewer than two options.
|
||||
throw new ClientException(_m('Poll must have at least two options.'));
|
||||
}
|
||||
|
||||
|
@ -103,8 +103,10 @@ class NewpollForm extends Form
|
||||
|
||||
$this->li();
|
||||
$this->out->input('question',
|
||||
// TRANS: Field label on the page to create a poll.
|
||||
_m('Question'),
|
||||
$this->question,
|
||||
// TRANS: Field title on the page to create a poll.
|
||||
_m('What question are people answering?'));
|
||||
$this->unli();
|
||||
|
||||
@ -121,6 +123,8 @@ class NewpollForm extends Form
|
||||
}
|
||||
$this->li();
|
||||
$this->out->input('option' . ($i + 1),
|
||||
// TRANS: Field label for an answer option on the page to create a poll.
|
||||
// TRANS: %d is the option number.
|
||||
sprintf(_m('Option %d'), $i + 1),
|
||||
$default);
|
||||
$this->unli();
|
||||
@ -137,6 +141,7 @@ class NewpollForm extends Form
|
||||
*/
|
||||
function formActions()
|
||||
{
|
||||
// TRANS: Button text for saving a new poll.
|
||||
$this->out->submit('submit', _m('BUTTON', 'Save'));
|
||||
}
|
||||
}
|
||||
|
@ -123,6 +123,7 @@ class PollResponseForm extends Form
|
||||
*/
|
||||
function formActions()
|
||||
{
|
||||
// TRANS: Button text for submitting a poll response.
|
||||
$this->out->submit('submit', _m('BUTTON', 'Submit'));
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
* StatusNet - the distributed open-source microblogging tool
|
||||
* Copyright (C) 2011, StatusNet, Inc.
|
||||
*
|
||||
* Add a new Poll
|
||||
* Respond to a Poll
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
@ -34,7 +34,7 @@ if (!defined('STATUSNET')) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new Poll
|
||||
* Respond to a Poll
|
||||
*
|
||||
* @category Poll
|
||||
* @package StatusNet
|
||||
@ -59,6 +59,7 @@ class RespondPollAction extends Action
|
||||
*/
|
||||
function title()
|
||||
{
|
||||
// TRANS: Page title for poll response.
|
||||
return _m('Poll response');
|
||||
}
|
||||
|
||||
@ -79,6 +80,7 @@ class RespondPollAction extends Action
|
||||
$this->user = common_current_user();
|
||||
|
||||
if (empty($this->user)) {
|
||||
// TRANS: Client exception thrown trying to respond to a poll while not logged in.
|
||||
throw new ClientException(_m("You must be logged in to respond to a poll."),
|
||||
403);
|
||||
}
|
||||
@ -90,11 +92,13 @@ class RespondPollAction extends Action
|
||||
$id = $this->trimmed('id');
|
||||
$this->poll = Poll::staticGet('id', $id);
|
||||
if (empty($this->poll)) {
|
||||
throw new ClientException(_m("Invalid or missing poll."), 404);
|
||||
// TRANS: Client exception thrown trying to respond to a non-existing poll.
|
||||
throw new ClientException(_m('Invalid or missing poll.'), 404);
|
||||
}
|
||||
|
||||
$selection = intval($this->trimmed('pollselection'));
|
||||
if ($selection < 1 || $selection > count($this->poll->getOptions())) {
|
||||
// TRANS: Client exception thrown responding to a poll with an invalid answer.
|
||||
throw new ClientException(_m('Invalid poll selection.'));
|
||||
}
|
||||
$this->selection = $selection;
|
||||
|
@ -64,6 +64,7 @@ class ShowPollAction extends ShownoticeAction
|
||||
$this->poll = Poll::staticGet('id', $this->id);
|
||||
|
||||
if (empty($this->poll)) {
|
||||
// TRANS: Client exception thrown trying to view a non-existing poll.
|
||||
throw new ClientException(_m('No such poll.'), 404);
|
||||
}
|
||||
|
||||
@ -71,18 +72,21 @@ class ShowPollAction extends ShownoticeAction
|
||||
|
||||
if (empty($this->notice)) {
|
||||
// Did we used to have it, and it got deleted?
|
||||
// TRANS: Client exception thrown trying to view a non-existing poll notice.
|
||||
throw new ClientException(_m('No such poll notice.'), 404);
|
||||
}
|
||||
|
||||
$this->user = User::staticGet('id', $this->poll->profile_id);
|
||||
|
||||
if (empty($this->user)) {
|
||||
// TRANS: Client exception thrown trying to view a poll of a non-existing user.
|
||||
throw new ClientException(_m('No such user.'), 404);
|
||||
}
|
||||
|
||||
$this->profile = $this->user->getProfile();
|
||||
|
||||
if (empty($this->profile)) {
|
||||
// TRANS: Server exception thrown trying to view a poll for a user for which the profile could not be loaded.
|
||||
throw new ServerException(_m('User without a profile.'));
|
||||
}
|
||||
|
||||
@ -100,7 +104,9 @@ class ShowPollAction extends ShownoticeAction
|
||||
*/
|
||||
function title()
|
||||
{
|
||||
return sprintf(_m('%s\'s poll: %s'),
|
||||
// TRANS: Page title for a poll.
|
||||
// TRANS: %1$s is the nickname of the user that created the poll, %2$s is the poll question.
|
||||
return sprintf(_m('%1$s\'s poll: %2$s'),
|
||||
$this->user->nickname,
|
||||
$this->poll->question);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user