Add translator documentation and number parameters if multiple are used in a message.

This commit is contained in:
Siebrand Mazeland 2010-04-11 23:39:24 +02:00
parent 7ace3156ca
commit 8795b3546d

View File

@ -122,6 +122,8 @@ class Command
} }
Event::handle('EndCommandGetProfile', array($this, $arg, &$profile)); Event::handle('EndCommandGetProfile', array($this, $arg, &$profile));
if (!$profile) { if (!$profile) {
// TRANS: Message given requesting a profile for a non-existing user.
// TRANS: %s is the nickname of the user for which the profile could not be found.
throw new CommandException(sprintf(_('Could not find a user with nickname %s'), $arg)); throw new CommandException(sprintf(_('Could not find a user with nickname %s'), $arg));
} }
return $profile; return $profile;
@ -140,6 +142,8 @@ class Command
} }
Event::handle('EndCommandGetUser', array($this, $arg, &$user)); Event::handle('EndCommandGetUser', array($this, $arg, &$user));
if (!$user){ if (!$user){
// TRANS: Message given getting a non-existing user.
// TRANS: %s is the nickname of the user that could not be found.
throw new CommandException(sprintf(_('Could not find a local user with nickname %s'), throw new CommandException(sprintf(_('Could not find a local user with nickname %s'),
$arg)); $arg));
} }
@ -225,6 +229,8 @@ class NudgeCommand extends Command
} }
// XXX: notify by IM // XXX: notify by IM
// XXX: notify by SMS // XXX: notify by SMS
// TRANS: Message given having nudged another user.
// TRANS: %s is the nickname of the user that was nudged.
$channel->output($this->user, sprintf(_('Nudge sent to %s'), $channel->output($this->user, sprintf(_('Nudge sent to %s'),
$recipient->nickname)); $recipient->nickname));
} }
@ -328,12 +334,16 @@ class JoinCommand extends Command
Event::handle('EndJoinGroup', array($group, $cur)); Event::handle('EndJoinGroup', array($group, $cur));
} }
} catch (Exception $e) { } catch (Exception $e) {
$channel->error($cur, sprintf(_('Could not join user %s to group %s'), // TRANS: Message given having failed to add a user to a group.
// TRANS: %1$s is the nickname of the user, %2$s is the nickname of the group.
$channel->error($cur, sprintf(_('Could not join user %1$s to group %2$s'),
$cur->nickname, $group->nickname)); $cur->nickname, $group->nickname));
return; return;
} }
$channel->output($cur, sprintf(_('%s joined group %s'), // TRANS: Message given having added a user to a group.
// TRANS: %1$s is the nickname of the user, %2$s is the nickname of the group.
$channel->output($cur, sprintf(_('%1$s joined group %2$s'),
$cur->nickname, $cur->nickname,
$group->nickname)); $group->nickname));
} }
@ -370,12 +380,16 @@ class DropCommand extends Command
Event::handle('EndLeaveGroup', array($group, $cur)); Event::handle('EndLeaveGroup', array($group, $cur));
} }
} catch (Exception $e) { } catch (Exception $e) {
$channel->error($cur, sprintf(_('Could not remove user %s to group %s'), // TRANS: Message given having failed to remove a user from a group.
// TRANS: %1$s is the nickname of the user, %2$s is the nickname of the group.
$channel->error($cur, sprintf(_('Could not remove user %s from group %s'),
$cur->nickname, $group->nickname)); $cur->nickname, $group->nickname));
return; return;
} }
$channel->output($cur, sprintf(_('%s left group %s'), // TRANS: Message given having removed a user from a group.
// TRANS: %1$s is the nickname of the user, %2$s is the nickname of the group.
$channel->output($cur, sprintf(_('%1$s left group %2$s'),
$cur->nickname, $cur->nickname,
$group->nickname)); $group->nickname));
} }
@ -395,18 +409,24 @@ class WhoisCommand extends Command
{ {
$recipient = $this->getProfile($this->other); $recipient = $this->getProfile($this->other);
// TRANS: Whois output.
// TRANS: %1$s nickname of the queried user, %2$s is their profile URL.
$whois = sprintf(_("%1\$s (%2\$s)"), $recipient->nickname, $whois = sprintf(_("%1\$s (%2\$s)"), $recipient->nickname,
$recipient->profileurl); $recipient->profileurl);
if ($recipient->fullname) { if ($recipient->fullname) {
// TRANS: Whois output. %s is the full name of the queried user.
$whois .= "\n" . sprintf(_('Fullname: %s'), $recipient->fullname); $whois .= "\n" . sprintf(_('Fullname: %s'), $recipient->fullname);
} }
if ($recipient->location) { if ($recipient->location) {
// TRANS: Whois output. %s is the location of the queried user.
$whois .= "\n" . sprintf(_('Location: %s'), $recipient->location); $whois .= "\n" . sprintf(_('Location: %s'), $recipient->location);
} }
if ($recipient->homepage) { if ($recipient->homepage) {
// TRANS: Whois output. %s is the homepage of the queried user.
$whois .= "\n" . sprintf(_('Homepage: %s'), $recipient->homepage); $whois .= "\n" . sprintf(_('Homepage: %s'), $recipient->homepage);
} }
if ($recipient->bio) { if ($recipient->bio) {
// TRANS: Whois output. %s is the bio information of the queried user.
$whois .= "\n" . sprintf(_('About: %s'), $recipient->bio); $whois .= "\n" . sprintf(_('About: %s'), $recipient->bio);
} }
$channel->output($this->user, $whois); $channel->output($this->user, $whois);
@ -447,7 +467,9 @@ class MessageCommand extends Command
$this->text = common_shorten_links($this->text); $this->text = common_shorten_links($this->text);
if (Message::contentTooLong($this->text)) { if (Message::contentTooLong($this->text)) {
$channel->error($this->user, sprintf(_('Message too long - maximum is %d characters, you sent %d'), // TRANS: Message given if content is too long.
// TRANS: %1$d is the maximum number of characters, %2$d is the number of submitted characters.
$channel->error($this->user, sprintf(_('Message too long - maximum is %1$d characters, you sent %2$d'),
Message::maxContent(), mb_strlen($this->text))); Message::maxContent(), mb_strlen($this->text)));
return; return;
} }
@ -465,6 +487,8 @@ class MessageCommand extends Command
$message = Message::saveNew($this->user->id, $other->id, $this->text, $channel->source()); $message = Message::saveNew($this->user->id, $other->id, $this->text, $channel->source());
if ($message) { if ($message) {
$message->notify(); $message->notify();
// TRANS: Message given have sent a direct message to another user.
// TRANS: %s is the name of the other user.
$channel->output($this->user, sprintf(_('Direct message to %s sent'), $this->other)); $channel->output($this->user, sprintf(_('Direct message to %s sent'), $this->other));
} else { } else {
$channel->error($this->user, _('Error sending direct message.')); $channel->error($this->user, _('Error sending direct message.'));
@ -500,6 +524,8 @@ class RepeatCommand extends Command
if ($repeat) { if ($repeat) {
// TRANS: Message given having repeated a notice from another user.
// TRANS: %s is the name of the user for which the notice was repeated.
$channel->output($this->user, sprintf(_('Notice from %s repeated'), $recipient->nickname)); $channel->output($this->user, sprintf(_('Notice from %s repeated'), $recipient->nickname));
} else { } else {
$channel->error($this->user, _('Error repeating notice.')); $channel->error($this->user, _('Error repeating notice.'));