Fix several L10n and i18n issues.

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.
This commit is contained in:
Siebrand Mazeland 2011-04-03 01:09:02 +02:00
parent a466d4573a
commit fec3edee45
8 changed files with 101 additions and 67 deletions

View File

@ -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;
@ -116,6 +116,7 @@ class MailboxAction extends CurrentUserDesignAction
} else {
$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;

View File

@ -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');
}
}

View File

@ -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)

View File

@ -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')));
}
}

View File

@ -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;
@ -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');

View File

@ -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':

View File

@ -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
{
/**
@ -258,7 +257,6 @@ abstract class MicroAppPlugin extends Plugin
*
* @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)) {
@ -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,14 +364,14 @@ 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;
@ -387,12 +383,13 @@ abstract class MicroAppPlugin extends Plugin
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)) {

View File

@ -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'));
}
}