Add dummy method MessageListItem::messageListItemDummyMessages() to allow xgettext to add possible sources to POT files.
Mark a few i18n issues as FIXME as well as some messages for which the use case was not clear to me.
Merged some code on multiple lines into one.
Translator documentation added.
Remove superfluous whiteapace.
* @see InboxAction
* @see OutboxAction
*/
-
class MailboxAction extends CurrentUserDesignAction
{
var $page = null;
*
* @return void
*/
-
function handle($args)
{
parent::handle($args);
if (!$this->user) {
+ // TRANS: Client error displayed when trying to access a mailbox without providing a user.
$this->clientError(_('No such user.'), 404);
return;
}
$cur = common_current_user();
if (!$cur || $cur->id != $this->user->id) {
+ // TRANS: Client error displayed when trying to access a mailbox that is not of the logged in user.
$this->clientError(_('Only the user can read their own mailboxes.'),
403);
return;
$this->trimmed('action'),
array('nickname' => $this->user->nickname));
} else {
- $this->element('p',
- 'guide',
+ $this->element('p',
+ 'guide',
+ // TRANS: Message displayed when there are no private messages in the inbox of a user.
_('You have no private messages. '.
'You can send private message to engage other users in conversation. '.
'People can send you messages for your eyes only.'));
*
* @return void
*/
-
function showPageNotice()
{
$instr = $this->getInstructions();
*
* @return boolean
*/
-
function isReadOnly($args)
{
return true;
* Copyright (C) 2011, StatusNet, Inc.
*
* Private mailboxes menu
- *
+ *
* PHP version 5
*
* This program is free software: you can redistribute it and/or modify
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/
*/
-
class MailboxMenu extends Menu
{
function show()
$this->item('inbox',
array('nickname' => $nickname),
- _('Inbox'),
- _('Your incoming messages'));
+ // TRANS: Menu item in mailbox menu. Leads to incoming private messages.
+ _m('MENU','Inbox'),
+ // TRANS: Menu item title in mailbox menu. Leads to incoming private messages.
+ _('Your incoming messages.'));
$this->item('outbox',
array('nickname' => $nickname),
- _('Outbox'),
- _('Your sent messages'));
+ // TRANS: Menu item in mailbox menu. Leads to outgoing private messages.
+ _m('MENU','Outbox'),
+ // TRANS: Menu item title in mailbox menu. Leads to outgoing private messages.
+ _('Your sent messages.'));
$this->out->elementEnd('ul');
}
-
}
require_once(INSTALLDIR . '/lib/mediafile.php');
require_once('Mail/mimeDecode.php');
-// FIXME: we use both Mail_mimeDecode and mailparse
+// @todo FIXME: we use both Mail_mimeDecode and mailparse
// Need to move everything to mailparse
class MailHandler
{
list($from, $to, $msg, $attachments) = $this->parse_message($rawmessage);
if (!$from || !$to || !$msg) {
+ // TRANS: Error message in incoming mail handler used when an incoming e-mail cannot be processed.
$this->error(null, _('Could not parse message.'));
}
common_log(LOG_INFO, "Mail from $from to $to with ".count($attachments) .' attachment(s): ' .substr($msg, 0, 20));
$user = $this->user_from_header($from);
if (!$user) {
+ // TRANS: Error message in incoming mail handler used when an incoming e-mail is not from a registered user.
$this->error($from, _('Not a registered user.'));
return false;
}
if (!$this->user_match_to($user, $to)) {
+ // TRANS: Error message in incoming mail handler used when an incoming e-mail is not from a user's incoming e-mail address.
$this->error($from, _('Sorry, that is not your incoming email address.'));
return false;
}
if (!$user->emailpost) {
+ // TRANS: Error message in incoming mail handler used when no incoming e-mail is allowed.
$this->error($from, _('Sorry, no incoming email allowed.'));
return false;
}
$msg = $this->cleanup_msg($msg);
$msg = $user->shortenLinks($msg);
if (Notice::contentTooLong($msg)) {
- $this->error($from, sprintf(_('That\'s too long. Maximum notice size is %d character.',
+ // TRANS: Error message in incoming mail handler used when an incoming e-mail contains too many characters.
+ $this->error($from, sprintf(_m('That\'s too long. Maximum notice size is %d character.',
'That\'s too long. Maximum notice size is %d characters.',
Notice::maxContent()),
Notice::maxContent()));
$mediafiles = array();
foreach($attachments as $attachment){
-
$mf = null;
try {
function respond($from, $to, $response)
{
-
$headers['From'] = $to;
$headers['To'] = $from;
+ // TRANS: E-mail subject for reply to an e-mail command.
$headers['Subject'] = _('Command complete');
return mail_send(array($from), $headers, $response);
function unsupported_type($type)
{
- $this->error(null, sprintf(_('Unsupported message type: %s'), $type));
+ // TRANS: Error message in incoming mail handler used when an incoming e-mail is of an unsupported type.
+ // TRANS: %s is the unsupported type.
+ $this->error(null, sprintf(_('Unsupported message type: %s.'), $type));
}
function cleanup_msg($msg)
*
* @see HTMLOutputter
*/
-
class MessageForm extends Form
{
/**
* User to send a direct message to
*/
-
var $to = null;
/**
* Pre-filled content of the form
*/
-
var $content = null;
/**
* @param User $to user to send a message to
* @param string $content content to pre-fill
*/
-
function __construct($out=null, $to=null, $content=null)
{
parent::__construct($out);
*
* @return string ID of the form
*/
-
function id()
{
return 'form_notice-direct';
*
* @return string class of the form
*/
-
function formClass()
{
return 'form_notice ajax-notice';
*
* @return string URL of the action
*/
-
function action()
{
return common_local_url('newmessage');
*/
function formLegend()
{
+ // TRANS: Form legend for direct notice.
$this->out->element('legend', null, _('Send a direct notice'));
}
*
* @return void
*/
-
function formData()
{
$user = common_current_user();
$mutual_users = $user->mutuallySubscribedUsers();
$mutual = array();
- // TRANS Label entry in drop-down selection box in direct-message inbox/outbox. This is the default entry in the drop-down box, doubling as instructions and a brake against accidental submissions with the first user in the list.
+ // TRANS: Label entry in drop-down selection box in direct-message inbox/outbox.
+ // TRANS: This is the default entry in the drop-down box, doubling as instructions
+ // TRANS: and a brake against accidental submissions with the first user in the list.
$mutual[0] = _('Select recipient:');
while ($mutual_users->fetch()) {
$mutual[0] = _('No mutual subscribers.');
}
+ // TRANS: Dropdown label in direct notice form.
$this->out->dropdown('to', _('To'), $mutual, null, false,
($this->to) ? $this->to->id : null);
*
* @return void
*/
-
function formActions()
{
$this->out->element('input', array('id' => 'notice_action-submit',
'class' => 'submit',
'name' => 'message_send',
'type' => 'submit',
+ // TRANS: Button text for sending a direct notice.
'value' => _m('Send button for sending notice', 'Send')));
}
}
* Copyright (C) 2011, StatusNet, Inc.
*
* The message list widget
- *
+ *
* PHP version 5
*
* This program is free software: you can redistribute it and/or modify
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/
*/
-
abstract class MessageList extends Widget
{
var $message;
parent::__construct($out);
$this->message = $message;
}
-
+
/**
* Show the widget
- *
+ *
* Uses newItem() to create each new item.
*
* @return integer count of messages seen.
$this->out->elementStart('div', array('id' =>'notices_primary'));
+ // TRANS: Header in message list.
$this->out->element('h2', null, _('Messages'));
$this->out->elementStart('ul', 'notices messages');
if ($cnt > MESSAGES_PER_PAGE) {
break;
}
-
+
$mli = $this->newItem($this->message);
$mli->show();
* Copyright (C) 2011, StatusNet, Inc.
*
* A single list item for showing in a message list
- *
+ *
* PHP version 5
*
* This program is free software: you can redistribute it and/or modify
*
* @return void
*/
-
function show()
{
$this->out->elementStart('li', array('class' => 'hentry notice',
if ($this->message->source) {
$this->out->elementStart('span', 'source');
// FIXME: bad i18n. Device should be a parameter (from %s).
+ // TRANS: Followed by notice source (usually the client used to send the notice).
$this->out->text(_('from'));
$this->showSource($this->message->source);
$this->out->elementEnd('span');
$this->out->elementEnd('li');
}
+ /**
+ * Dummy method. Serves no other purpose than to make strings available used
+ * in self::showSource() through xgettext.
+ *
+ * @return void
+ */
+ function messageListItemDummyMessages()
+ {
+ // A dummy array with messages. These will get extracted by xgettext and
+ // are used in self::showSource().
+ $dummy_messages = array(
+ // TRANS: A possible notice source (web interface).
+ _m('SOURCE','web'),
+ // TRANS: A possible notice source (XMPP).
+ _m('SOURCE','xmpp'),
+ // TRANS: A possible notice source (e-mail).
+ _m('SOURCE','mail'),
+ // TRANS: A possible notice source (OpenMicroBlogging).
+ _m('SOURCE','omb'),
+ // TRANS: A possible notice source (Application Programming Interface).
+ _m('SOURCE','api'),
+ );
+ }
/**
* Show the source of the message
*/
function showSource($source)
{
- $source_name = _($source);
+ $source_name = _m('SOURCE',$source);
switch ($source) {
case 'web':
case 'xmpp':
* Copyright (C) 2011, StatusNet, Inc.
*
* Superclass for microapp plugin
- *
+ *
* PHP version 5
*
* This program is free software: you can redistribute it and/or modify
*
* This class lets you define micro-applications with different kinds of activities.
*
- * The applications work more-or-less like other
- *
+ * The applications work more-or-less like other
+ *
* @category Microapp
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/
*/
-
abstract class MicroAppPlugin extends Plugin
{
/**
* by calling the overridable $this->deleteRelated().
*
* @param Notice $notice Notice being deleted
- *
+ *
* @return boolean hook value
*/
-
function onNoticeDeleteRelated($notice)
{
if ($this->isMyNotice($notice)) {
*
* @fixme WARNING WARNING WARNING this closes a 'div' that is implicitly opened in BookmarkPlugin's showNotice implementation
*/
-
function onStartShowNoticeItem($nli)
{
if (!$this->isMyNotice($nli->notice)) {
$nli->showNoticeLocation();
$nli->showContext();
$nli->showRepeat();
-
+
$out->elementEnd('div');
-
+
$nli->showNoticeOptions();
return false;
*
* @return boolean hook value
*/
-
function onStartActivityObjectFromNotice($notice, &$object)
{
if ($this->isMyNotice($notice)) {
*
* @return boolean hook value
*/
-
function onStartHandleFeedEntryWithProfile($activity, $oprofile)
{
if ($this->isMyActivity($activity)) {
$actor = $oprofile->checkAuthorship($activity);
if (empty($actor)) {
- throw new ClientException(_('Can\'t get author for activity.'));
+ // TRANS: Client exception thrown when no author for an activity was found.
+ throw new ClientException(_('Cannot get author for activity.'));
}
$object = $activity->objects[0];
function onStartHandleSalmonTarget($activity, $target)
{
if ($this->isMyActivity($activity)) {
-
$this->log(LOG_INFO, "Checking {$activity->id} as a valid Salmon slap.");
if ($target instanceof User_group) {
$uri = $target->getUri();
if (!in_array($uri, $activity->context->attention)) {
- throw new ClientException(_("Bookmark not posted ".
- "to this group."));
+ // @todo FIXME: please document (i18n).
+ // TRANS: Client exception.
+ throw new ClientException(_('Bookmark not posted to this group.'));
}
} else if ($target instanceof User) {
$uri = $target->uri;
$original = null;
if (!empty($activity->context->replyToID)) {
- $original = Notice::staticGet('uri',
- $activity->context->replyToID);
+ $original = Notice::staticGet('uri',
+ $activity->context->replyToID);
}
if (!in_array($uri, $activity->context->attention) &&
(empty($original) ||
$original->profile_id != $target->id)) {
- throw new ClientException(_("Object not posted ".
- "to this user."));
+ // @todo FIXME: Please document (i18n).
+ // TRANS: Client exception.
+ throw new ClientException(_('Object not posted to this user.'));
}
} else {
- throw new ServerException(_("Don't know how to handle ".
- "this kind of target."));
+ // TRANS: Server exception thrown when a micro app plugin uses a target that cannot be handled.
+ throw new ServerException(_('Do not know how to handle this kind of target.'));
}
$actor = Ostatus_profile::ensureActivityObjectProfile($activity->actor);
*
* @return boolean hook value
*/
-
function onStartAtomPubNewActivity(&$activity, $user, &$notice)
{
if ($this->isMyActivity($activity)) {
*
* @return boolean hook value
*/
-
function onStartImportActivity($user, $author, $activity, $trusted, &$done)
{
if ($this->isMyActivity($activity)) {
* Copyright (C) 2010, StatusNet, Inc.
*
* An item in a notice list
- *
+ *
* PHP version 5
*
* This program is free software: you can redistribute it and/or modify
if (empty($name)) {
$latdms = $this->decimalDegreesToDMS(abs($lat));
$londms = $this->decimalDegreesToDMS(abs($lon));
- // TRANS: Used in coordinates as abbreviation of north
+ // TRANS: Used in coordinates as abbreviation of north.
$north = _('N');
- // TRANS: Used in coordinates as abbreviation of south
+ // TRANS: Used in coordinates as abbreviation of south.
$south = _('S');
- // TRANS: Used in coordinates as abbreviation of east
+ // TRANS: Used in coordinates as abbreviation of east.
$east = _('E');
- // TRANS: Used in coordinates as abbreviation of west
+ // TRANS: Used in coordinates as abbreviation of west.
$west = _('W');
$name = sprintf(
+ // TRANS: Coordinates message.
+ // TRANS: %1$s is lattitude degrees, %2$s is lattitude minutes,
+ // TRANS: %3$s is lattitude seconds, %4$s is N (north) or S (south) depending on lattitude,
+ // TRANS: %5$s is longitude degrees, %6$s is longitude minutes,
+ // TRANS: %7$s is longitude seconds, %8$s is E (east) or W (west) depending on longitude,
_('%1$u°%2$u\'%3$u"%4$s %5$u°%6$u\'%7$u"%8$s'),
$latdms['deg'],$latdms['min'], $latdms['sec'],($lat>0? $north:$south),
$londms['deg'],$londms['min'], $londms['sec'],($lon>0? $east:$west));
$this->out->text(' ');
$this->out->elementStart('span', array('class' => 'location'));
+ // TRANS: Followed by geo location.
$this->out->text(_('at'));
$this->out->text(' ');
if (empty($url)) {
$ns = $this->notice->getSource();
if ($ns) {
- $source_name = (empty($ns->name)) ? ($ns->code ? _($ns->code) : _('web')) : _($ns->name);
+ $source_name = (empty($ns->name)) ? ($ns->code ? _($ns->code) : _m('SOURCE','web')) : _($ns->name);
$this->out->text(' ');
$this->out->elementStart('span', 'source');
// FIXME: probably i18n issue. If "from" is followed by text, that should be a parameter to "from" (from %s).
+ // TRANS: Followed by notice source.
$this->out->text(_('from'));
$this->out->text(' ');
// if $ns->name and $ns->url are populated we have
// configured a source attr somewhere
if (!empty($name) && !empty($url)) {
-
$this->out->elementStart('span', 'device');
$attrs = array(
array(
'href' => $convurl.'#notice-'.$this->notice->id,
'class' => 'response'),
+ // TRANS: Addition in notice list item if notice is part of a conversation.
_('in context')
);
} else {
$this->out->elementStart('span', 'repeat vcard');
+ // TRANS: Addition in notice list item if notice was repeated. Followed by a span with a nickname.
$this->out->raw(_('Repeated by'));
$this->out->elementStart('a', $attrs);
array('replyto' => $this->profile->nickname, 'inreplyto' => $this->notice->id));
$this->out->elementStart('a', array('href' => $reply_url,
'class' => 'notice_reply',
+ // TRANS: Link title in notice list item to reply to a notice.
'title' => _('Reply to this notice')));
+ // TRANS: Link text in notice list item to reply to a notice.
$this->out->text(_('Reply'));
$this->out->text(' ');
$this->out->element('span', 'notice_id', $this->notice->id);
array('notice' => $todel->id));
$this->out->element('a', array('href' => $deleteurl,
'class' => 'notice_delete',
- 'title' => _('Delete this notice')), _('Delete'));
+ // TRANS: Link title in notice list item to delete a notice.
+ 'title' => _('Delete this notice')),
+ // TRANS: Link text in notice list item to delete a notice.
+ _('Delete'));
}
}