diff --git a/lib/mailbox.php b/lib/mailbox.php index e9e4f78c6b..7c6567c6c1 100644 --- a/lib/mailbox.php +++ b/lib/mailbox.php @@ -42,7 +42,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { * @see InboxAction * @see OutboxAction */ - class MailboxAction extends CurrentUserDesignAction { var $page = null; @@ -71,12 +70,12 @@ class MailboxAction extends CurrentUserDesignAction * * @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; } @@ -84,6 +83,7 @@ class MailboxAction extends CurrentUserDesignAction $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; @@ -114,8 +114,9 @@ class MailboxAction extends CurrentUserDesignAction $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.')); @@ -139,7 +140,6 @@ class MailboxAction extends CurrentUserDesignAction * * @return void */ - function showPageNotice() { $instr = $this->getInstructions(); @@ -157,7 +157,6 @@ class MailboxAction extends CurrentUserDesignAction * * @return boolean */ - function isReadOnly($args) { return true; diff --git a/lib/mailboxmenu.php b/lib/mailboxmenu.php index d2d3607dce..49e7dce21a 100644 --- a/lib/mailboxmenu.php +++ b/lib/mailboxmenu.php @@ -4,7 +4,7 @@ * Copyright (C) 2011, StatusNet, Inc. * * Private mailboxes menu - * + * * PHP version 5 * * This program is free software: you can redistribute it and/or modify @@ -44,7 +44,6 @@ if (!defined('STATUSNET')) { * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * @link http://status.net/ */ - class MailboxMenu extends Menu { function show() @@ -56,15 +55,18 @@ class MailboxMenu extends Menu $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'); } - } diff --git a/lib/mailhandler.php b/lib/mailhandler.php index bbeb69a8f9..65c5622de3 100644 --- a/lib/mailhandler.php +++ b/lib/mailhandler.php @@ -21,7 +21,7 @@ require_once(INSTALLDIR . '/lib/mail.php'); 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 @@ -34,19 +34,23 @@ 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; } @@ -57,7 +61,8 @@ class MailHandler $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())); @@ -66,7 +71,6 @@ class MailHandler $mediafiles = array(); foreach($attachments as $attachment){ - $mf = null; try { @@ -137,9 +141,9 @@ class MailHandler 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); @@ -226,7 +230,9 @@ class MailHandler 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) diff --git a/lib/messageform.php b/lib/messageform.php index 733e83cd15..bd46d7389d 100644 --- a/lib/messageform.php +++ b/lib/messageform.php @@ -46,19 +46,16 @@ require_once INSTALLDIR.'/lib/form.php'; * * @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; /** @@ -68,7 +65,6 @@ class MessageForm extends Form * @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); @@ -82,7 +78,6 @@ class MessageForm extends Form * * @return string ID of the form */ - function id() { return 'form_notice-direct'; @@ -93,7 +88,6 @@ class MessageForm extends Form * * @return string class of the form */ - function formClass() { return 'form_notice ajax-notice'; @@ -104,7 +98,6 @@ class MessageForm extends Form * * @return string URL of the action */ - function action() { return common_local_url('newmessage'); @@ -117,6 +110,7 @@ class MessageForm extends Form */ function formLegend() { + // TRANS: Form legend for direct notice. $this->out->element('legend', null, _('Send a direct notice')); } @@ -125,7 +119,6 @@ class MessageForm extends Form * * @return void */ - function formData() { $user = common_current_user(); @@ -133,7 +126,9 @@ class MessageForm extends Form $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()) { @@ -150,6 +145,7 @@ class MessageForm extends Form $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); @@ -173,13 +169,13 @@ class MessageForm extends Form * * @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'))); } } diff --git a/lib/messagelist.php b/lib/messagelist.php index da7e9a6c27..0185977285 100644 --- a/lib/messagelist.php +++ b/lib/messagelist.php @@ -4,7 +4,7 @@ * Copyright (C) 2011, StatusNet, Inc. * * The message list widget - * + * * PHP version 5 * * This program is free software: you can redistribute it and/or modify @@ -44,7 +44,6 @@ if (!defined('STATUSNET')) { * @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; @@ -60,10 +59,10 @@ abstract class MessageList extends Widget parent::__construct($out); $this->message = $message; } - + /** * Show the widget - * + * * Uses newItem() to create each new item. * * @return integer count of messages seen. @@ -74,6 +73,7 @@ abstract class MessageList extends Widget $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'); @@ -85,7 +85,7 @@ abstract class MessageList extends Widget if ($cnt > MESSAGES_PER_PAGE) { break; } - + $mli = $this->newItem($this->message); $mli->show(); diff --git a/lib/messagelistitem.php b/lib/messagelistitem.php index 44e6976454..ba8cf834af 100644 --- a/lib/messagelistitem.php +++ b/lib/messagelistitem.php @@ -4,7 +4,7 @@ * 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 @@ -65,7 +65,6 @@ abstract class MessageListItem extends Widget * * @return void */ - function show() { $this->out->elementStart('li', array('class' => 'hentry notice', @@ -120,6 +119,7 @@ abstract class MessageListItem extends Widget 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'); @@ -129,6 +129,29 @@ abstract class MessageListItem extends Widget $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 @@ -142,7 +165,7 @@ abstract class MessageListItem extends Widget */ function showSource($source) { - $source_name = _($source); + $source_name = _m('SOURCE',$source); switch ($source) { case 'web': case 'xmpp': diff --git a/lib/microappplugin.php b/lib/microappplugin.php index 0266f5184c..cd325560d3 100644 --- a/lib/microappplugin.php +++ b/lib/microappplugin.php @@ -4,7 +4,7 @@ * Copyright (C) 2011, StatusNet, Inc. * * Superclass for microapp plugin - * + * * PHP version 5 * * This program is free software: you can redistribute it and/or modify @@ -39,8 +39,8 @@ if (!defined('STATUSNET')) { * * 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 @@ -48,7 +48,6 @@ if (!defined('STATUSNET')) { * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * @link http://status.net/ */ - abstract class MicroAppPlugin extends Plugin { /** @@ -255,10 +254,9 @@ 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)) { @@ -277,7 +275,6 @@ abstract class MicroAppPlugin extends Plugin * * @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)) { @@ -294,9 +291,9 @@ abstract class MicroAppPlugin extends Plugin $nli->showNoticeLocation(); $nli->showContext(); $nli->showRepeat(); - + $out->elementEnd('div'); - + $nli->showNoticeOptions(); return false; @@ -310,7 +307,6 @@ abstract class MicroAppPlugin extends Plugin * * @return boolean hook value */ - function onStartActivityObjectFromNotice($notice, &$object) { if ($this->isMyNotice($notice)) { @@ -329,7 +325,6 @@ abstract class MicroAppPlugin extends Plugin * * @return boolean hook value */ - function onStartHandleFeedEntryWithProfile($activity, $oprofile) { if ($this->isMyActivity($activity)) { @@ -337,7 +332,8 @@ abstract class MicroAppPlugin extends Plugin $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]; @@ -368,31 +364,32 @@ abstract class MicroAppPlugin extends Plugin 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); @@ -422,7 +419,6 @@ abstract class MicroAppPlugin extends Plugin * * @return boolean hook value */ - function onStartAtomPubNewActivity(&$activity, $user, &$notice) { if ($this->isMyActivity($activity)) { @@ -451,7 +447,6 @@ abstract class MicroAppPlugin extends Plugin * * @return boolean hook value */ - function onStartImportActivity($user, $author, $activity, $trusted, &$done) { if ($this->isMyActivity($activity)) { diff --git a/lib/noticelistitem.php b/lib/noticelistitem.php index 5942415c51..aafa935140 100644 --- a/lib/noticelistitem.php +++ b/lib/noticelistitem.php @@ -4,7 +4,7 @@ * 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 @@ -348,15 +348,20 @@ class NoticeListItem extends Widget 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)); @@ -366,6 +371,7 @@ class NoticeListItem extends Widget $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)) { @@ -414,10 +420,11 @@ class NoticeListItem extends Widget $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(' '); @@ -434,7 +441,6 @@ class NoticeListItem extends Widget // 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( @@ -479,6 +485,7 @@ class NoticeListItem extends Widget 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 { @@ -513,6 +520,7 @@ class NoticeListItem extends Widget $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); @@ -539,7 +547,9 @@ class NoticeListItem extends Widget 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); @@ -565,7 +575,10 @@ class NoticeListItem extends Widget 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')); } }