Merge remote branch 'gitorious/1.0.x' into 1.0.x

This commit is contained in:
Evan Prodromou 2011-03-31 09:25:03 -04:00
commit 5afa503364
71 changed files with 297 additions and 262 deletions

View File

@ -704,11 +704,18 @@ class Activity
return ActivityUtils::child($element, $tag, $namespace);
}
/**
* For consistency, we'll always output UTC rather than local time.
* Note that clients *should* accept any timezone we give them as long
* as it's properly formatted.
*
* @param int $tm Unix timestamp
* @return string
*/
static function iso8601Date($tm)
{
$dateStr = date('d F Y H:i:s', $tm);
$d = new DateTime($dateStr, new DateTimeZone('UTC'));
$d->setTimezone(new DateTimeZone(common_timezone()));
return $d->format('c');
}
}

View File

@ -233,6 +233,10 @@ class BitlyAdminPanelForm extends AdminForm
function formActions()
{
$this->out->submit('submit', _('Save'), 'submit', null, _m('Save bit.ly settings'));
$this->out->submit('submit',
_m('BUTTON','Save'),
'submit',
null,
_m('Save bit.ly settings'));
}
}

View File

@ -82,13 +82,13 @@ class BlogspamNetPlugin extends Plugin
} else {
common_debug("Blogspamnet results = " . $response);
if (preg_match('/^ERROR(:(.*))?$/', $response, $match)) {
throw new ServerException(sprintf(_("Error from %s: %s"), $this->baseUrl, $match[2]), 500);
throw new ServerException(sprintf(_m("Error from %1$s: %2$s"), $this->baseUrl, $match[2]), 500);
} else if (preg_match('/^SPAM(:(.*))?$/', $response, $match)) {
throw new ClientException(sprintf(_("Spam checker results: %s"), $match[2]), 400);
throw new ClientException(sprintf(_m("Spam checker results: %s"), $match[2]), 400);
} else if (preg_match('/^OK$/', $response)) {
// don't do anything
} else {
throw new ServerException(sprintf(_("Unexpected response from %s: %s"), $this->baseUrl, $response), 500);
throw new ServerException(sprintf(_m("Unexpected response from %1$s: %2$s"), $this->baseUrl, $response), 500);
}
}
return true;

View File

@ -199,7 +199,7 @@ class Bookmark extends Memcached_DataObject
$nb = self::getByURL($profile, $url);
if (!empty($nb)) {
throw new ClientException(_('Bookmark already exists.'));
throw new ClientException(_m('Bookmark already exists.'));
}
if (empty($options)) {
@ -209,7 +209,7 @@ class Bookmark extends Memcached_DataObject
if (array_key_exists('uri', $options)) {
$other = Bookmark::staticGet('uri', $options['uri']);
if (!empty($other)) {
throw new ClientException(_('Bookmark already exists.'));
throw new ClientException(_m('Bookmark already exists.'));
}
}
@ -288,16 +288,19 @@ class Bookmark extends Memcached_DataObject
$shortUrl = $url;
}
$content = sprintf(_('"%s" %s %s %s'),
// @todo FIXME: i18n documentation.
// TRANS: %1$s is a title, %2$s is a short URL, %3$s is a description,
// TRANS: %4$s is space separated list of hash tags.
$content = sprintf(_m('"%1$s" %2$s %3$s %4$s'),
$title,
$shortUrl,
$description,
implode(' ', $hashtags));
$rendered = sprintf(_('<span class="xfolkentry">'.
'<a class="taggedlink" href="%s">%s</a> '.
'<span class="description">%s</span> '.
'<span class="meta">%s</span>'.
$rendered = sprintf(_m('<span class="xfolkentry">'.
'<a class="taggedlink" href="%1$s">%2$s</a> '.
'<span class="description">%3$s</span> '.
'<span class="meta">%4$s</span>'.
'</span>'),
htmlspecialchars($url),
htmlspecialchars($title),

View File

@ -274,7 +274,7 @@ class BookmarkPlugin extends MicroAppPlugin
$action->elementStart('li');
$action->element('a',
array('href' => common_local_url('importdelicious')),
_('Import del.icio.us bookmarks'));
_m('Import del.icio.us bookmarks'));
$action->elementEnd('li');
}
@ -379,7 +379,7 @@ class BookmarkPlugin extends MicroAppPlugin
$relLinkEls = ActivityUtils::getLinks($bookmark->element, 'related');
if (count($relLinkEls) < 1) {
throw new ClientException(_('Expected exactly 1 link '.
throw new ClientException(_m('Expected exactly 1 link '.
'rel=related in a Bookmark.'));
}
@ -472,7 +472,7 @@ class BookmarkPlugin extends MicroAppPlugin
$attachments = $notice->attachments();
if (count($attachments) != 1) {
throw new ServerException(_('Bookmark notice with the '.
throw new ServerException(_m('Bookmark notice with the '.
'wrong number of attachments.'));
}

View File

@ -121,30 +121,30 @@ class BookmarkForm extends Form
$this->li();
$this->out->input('title',
_('Title'),
_m('LABEL','Title'),
$this->_title,
_('Title of the bookmark'));
_m('Title of the bookmark'));
$this->unli();
$this->li();
$this->out->input('url',
_('URL'),
_m('LABEL','URL'),
$this->_url,
_('URL to bookmark'));
_m('URL to bookmark'));
$this->unli();
$this->li();
$this->out->input('tags',
_('Tags'),
_m('LABEL','Tags'),
$this->_tags,
_('Comma- or space-separated list of tags'));
_m('Comma- or space-separated list of tags'));
$this->unli();
$this->li();
$this->out->input('description',
_('Description'),
_m('LABEL','Description'),
$this->_description,
_('Description of the URL'));
_m('Description of the URL'));
$this->unli();
$this->out->elementEnd('ul');

View File

@ -55,7 +55,7 @@ class BookmarkpopupAction extends NewbookmarkAction
// TRANS: Title for mini-posting window loaded from bookmarklet.
// TRANS: %s is the StatusNet site name.
$this->element('title',
null, sprintf(_('Bookmark on %s'),
null, sprintf(_m('Bookmark on %s'),
common_config('site', 'name')));
}

View File

@ -82,7 +82,7 @@ class DeliciousBackupImporter extends QueueHandler
$dls = $doc->getElementsByTagName('dl');
if ($dls->length != 1) {
throw new ClientException(_("Bad import file."));
throw new ClientException(_m("Bad import file."));
}
$dl = $dls->item(0);
@ -165,7 +165,7 @@ class DeliciousBackupImporter extends QueueHandler
$as = $dt->getElementsByTagName('a');
if ($as->length == 0) {
throw new ClientException(_("No <A> tag in a <DT>."));
throw new ClientException(_m("No <A> tag in a <DT>."));
}
$a = $as->item(0);
@ -173,7 +173,7 @@ class DeliciousBackupImporter extends QueueHandler
$private = $a->getAttribute('private');
if ($private != 0) {
throw new ClientException(_('Skipping private bookmark.'));
throw new ClientException(_m('Skipping private bookmark.'));
}
if (!empty($dd)) {

View File

@ -75,7 +75,7 @@ function getBookmarksFile()
}
// TRANS: %s is the filename that contains a backup for a user.
printfv(_("Getting backup from file '%s'.")."\n", $filename);
printfv(_m("Getting backup from file \"%s\".")."\n", $filename);
$html = file_get_contents($filename);

View File

@ -58,7 +58,7 @@ class ImportdeliciousAction extends Action
function title()
{
return _("Import del.icio.us bookmarks");
return _m("Import del.icio.us bookmarks");
}
/**
@ -76,13 +76,13 @@ class ImportdeliciousAction extends Action
$cur = common_current_user();
if (empty($cur)) {
throw new ClientException(_('Only logged-in users can '.
throw new ClientException(_m('Only logged-in users can '.
'import del.icio.us backups.'),
403);
}
if (!$cur->hasRight(BookmarkPlugin::IMPORTDELICIOUS)) {
throw new ClientException(_('You may not restore your account.'), 403);
throw new ClientException(_m('You may not restore your account.'), 403);
}
return true;
@ -121,7 +121,7 @@ class ImportdeliciousAction extends Action
$this->checkSessionToken();
if (!isset($_FILES[ImportDeliciousForm::FILEINPUT]['error'])) {
throw new ClientException(_('No uploaded file.'));
throw new ClientException(_m('No uploaded file.'));
}
switch ($_FILES[ImportDeliciousForm::FILEINPUT]['error']) {
@ -129,42 +129,42 @@ class ImportdeliciousAction extends Action
break;
case UPLOAD_ERR_INI_SIZE:
// TRANS: Client exception thrown when an uploaded file is too large.
throw new ClientException(_('The uploaded file exceeds the ' .
throw new ClientException(_m('The uploaded file exceeds the ' .
'upload_max_filesize directive in php.ini.'));
return;
case UPLOAD_ERR_FORM_SIZE:
throw new ClientException(
// TRANS: Client exception.
_('The uploaded file exceeds the MAX_FILE_SIZE directive' .
_m('The uploaded file exceeds the MAX_FILE_SIZE directive' .
' that was specified in the HTML form.'));
return;
case UPLOAD_ERR_PARTIAL:
@unlink($_FILES[ImportDeliciousForm::FILEINPUT]['tmp_name']);
// TRANS: Client exception.
throw new ClientException(_('The uploaded file was only' .
throw new ClientException(_m('The uploaded file was only' .
' partially uploaded.'));
return;
case UPLOAD_ERR_NO_FILE:
// No file; probably just a non-AJAX submission.
throw new ClientException(_('No uploaded file.'));
throw new ClientException(_m('No uploaded file.'));
return;
case UPLOAD_ERR_NO_TMP_DIR:
// TRANS: Client exception thrown when a temporary folder is not present
throw new ClientException(_('Missing a temporary folder.'));
throw new ClientException(_m('Missing a temporary folder.'));
return;
case UPLOAD_ERR_CANT_WRITE:
// TRANS: Client exception thrown when writing to disk is not possible
throw new ClientException(_('Failed to write file to disk.'));
throw new ClientException(_m('Failed to write file to disk.'));
return;
case UPLOAD_ERR_EXTENSION:
// TRANS: Client exception thrown when a file upload has been stopped
throw new ClientException(_('File upload stopped by extension.'));
throw new ClientException(_m('File upload stopped by extension.'));
return;
default:
common_log(LOG_ERR, __METHOD__ . ": Unknown upload error " .
$_FILES[ImportDeliciousForm::FILEINPUT]['error']);
// TRANS: Client exception thrown when a file upload operation has failed
throw new ClientException(_('System error uploading file.'));
throw new ClientException(_m('System error uploading file.'));
return;
}
@ -183,7 +183,7 @@ class ImportdeliciousAction extends Action
throw new ServerException("File '$filename' not readable.");
}
common_debug(sprintf(_("Getting backup from file '%s'."), $filename));
common_debug(sprintf(_m("Getting backup from file '%s'."), $filename));
$html = file_get_contents($filename);
@ -219,10 +219,10 @@ class ImportdeliciousAction extends Action
{
if ($this->success) {
$this->element('p', null,
_('Bookmarks have been imported. Your bookmarks should now appear in search and your profile page.'));
_m('Bookmarks have been imported. Your bookmarks should now appear in search and your profile page.'));
} else if ($this->inprogress) {
$this->element('p', null,
_('Bookmarks are being imported. Please wait a few minutes for results.'));
_m('Bookmarks are being imported. Please wait a few minutes for results.'));
} else {
$form = new ImportDeliciousForm($this);
$form->show();
@ -310,7 +310,7 @@ class ImportDeliciousForm extends Form
{
$this->out->elementStart('p', 'instructions');
$this->out->raw(_('You can upload a backed-up '.
$this->out->raw(_m('You can upload a backed-up '.
'delicious.com bookmarks file.'));
$this->out->elementEnd('p');
@ -340,6 +340,6 @@ class ImportDeliciousForm extends Form
_m('BUTTON', 'Upload'),
'submit',
null,
_('Upload the file'));
_m('Upload the file'));
}
}

View File

@ -62,7 +62,7 @@ class NewbookmarkAction extends Action
function title()
{
return _('New bookmark');
return _m('New bookmark');
}
/**
@ -80,7 +80,7 @@ class NewbookmarkAction extends Action
$this->user = common_current_user();
if (empty($this->user)) {
throw new ClientException(_("Must be logged in to post a bookmark."),
throw new ClientException(_m("Must be logged in to post a bookmark."),
403);
}
@ -130,11 +130,11 @@ class NewbookmarkAction extends Action
}
try {
if (empty($this->title)) {
throw new ClientException(_('Bookmark must have a title.'));
throw new ClientException(_m('Bookmark must have a title.'));
}
if (empty($this->url)) {
throw new ClientException(_('Bookmark must have an URL.'));
throw new ClientException(_m('Bookmark must have an URL.'));
}
@ -156,7 +156,7 @@ class NewbookmarkAction extends Action
$this->elementStart('html');
$this->elementStart('head');
// TRANS: Page title after sending a notice.
$this->element('title', null, _('Notice posted'));
$this->element('title', null, _m('Notice posted'));
$this->elementEnd('head');
$this->elementStart('body');
$this->showNotice($saved);

View File

@ -67,7 +67,7 @@ class NoticebyurlAction extends Action
$this->file = File::staticGet('id', $this->trimmed('id'));
if (empty($this->file)) {
throw new ClientException(_('Unknown URL'));
throw new ClientException(_m('Unknown URL'));
}
$pageArg = $this->trimmed('page');
@ -89,9 +89,9 @@ class NoticebyurlAction extends Action
function title()
{
if ($this->page == 1) {
return sprintf(_("Notices linking to %s"), $this->file->url);
return sprintf(_m("Notices linking to %s"), $this->file->url);
} else {
return sprintf(_("Notices linking to %s, page %d"),
return sprintf(_m("Notices linking to %1$s, page %2$d"),
$this->file->url,
$this->page);
}

View File

@ -82,7 +82,7 @@ class ShowbookmarkAction extends ShownoticeAction
{
// TRANS: Title for bookmark.
// TRANS: %1$s is a user nickname, %2$s is a bookmark title.
return sprintf(_('%1$s\'s bookmark for "%2$s"'),
return sprintf(_m('%1$s\'s bookmark for "%2$s"'),
$this->user->nickname,
$this->bookmark->title);
}

View File

@ -165,8 +165,8 @@ class DirectoryPlugin extends Plugin
$nav->out->menuItem(
common_local_url('userdirectory'),
_('Directory'),
_('User Directory'),
_m('Directory'),
_m('User Directory'),
$actionName == 'userdirectory',
'nav_directory'
);

View File

@ -116,7 +116,7 @@ class UserdirectoryAction extends Action
function getInstructions()
{
// TRANS: %%site.name%% is the name of the StatusNet site.
return _(
return _m(
'Search for people on %%site.name%% by their name, '
. 'location, or interests. Separate the terms by spaces; '
. ' they must be 3 characters or more.'
@ -256,11 +256,11 @@ class UserdirectoryAction extends Action
$this->elementStart('fieldset');
$this->element('legend', null, _('Search site'));
$this->element('legend', null, _m('Search site'));
$this->elementStart('ul', 'form_data');
$this->elementStart('li');
$this->input('q', _('Keyword(s)'), $this->q);
$this->input('q', _m('Keyword(s)'), $this->q);
$this->submit('search', _m('BUTTON','Search'));
$this->elementEnd('li');
@ -372,7 +372,7 @@ class UserdirectoryAction extends Action
)
);
} else {
$this->element('p', 'error', _('No results.'));
$this->element('p', 'error', _m('No results.'));
$message = _m(<<<E_O_T
* Make sure all words are spelled correctly.
* Try different keywords.

View File

@ -151,7 +151,7 @@ class EmailSummaryPlugin extends Plugin
$action->elementStart('li');
$action->checkbox('emailsummary',
// TRANS: Checkbox label in e-mail preferences form.
_('Send me a periodic summary of updates from my network.'),
_m('Send me a periodic summary of updates from my network.'),
Email_summary_status::getSendSummary($user->id));
$action->elementEnd('li');
return true;

View File

@ -128,7 +128,7 @@ class UserEmailSummaryHandler extends QueueHandler
'style' => 'background-color: #ffffff; border: 4px solid #4c609a; padding: 10px;'));
$out->elementStart('div', array('style' => 'color: #ffffff; background-color: #4c609a; font-weight: bold; margin-bottom: 10px; padding: 4px;'));
$out->raw(sprintf(_('Recent updates from %1s for %2s:'),
$out->raw(sprintf(_m('Recent updates from %1s for %2s:'),
common_config('site', 'name'),
$profile->getBestName()));
$out->elementEnd('div');
@ -184,7 +184,7 @@ class UserEmailSummaryHandler extends QueueHandler
$out->text(' ');
$out->element('a',
array('href' => $convurl.'#notice-'.$notice->id),
_('in context'));
_m('in context'));
}
}
$out->elementEnd('div');
@ -194,7 +194,7 @@ class UserEmailSummaryHandler extends QueueHandler
$out->elementEnd('table');
$out->raw(sprintf(_('<p><a href="%1s">change your email settings for %2s</a></p>'),
$out->raw(sprintf(_m('<p><a href="%1s">change your email settings for %2s</a></p>'),
common_local_url('emailsettings'),
common_config('site', 'name')));
@ -204,7 +204,7 @@ class UserEmailSummaryHandler extends QueueHandler
// FIXME: do something for people who don't like HTML email
mail_to_user($user, _('Updates from your network'), $body,
mail_to_user($user, _m('Updates from your network'), $body,
array('Content-Type' => 'text/html; charset=UTF-8'));
if (empty($ess)) {

View File

@ -365,7 +365,7 @@ class EventPlugin extends MicroappPlugin
$out->elementStart('div', 'event-times'); // VEVENT/EVENT-TIMES IN
$out->element('strong', null, _('Time:'));
$out->element('strong', null, _m('Time:'));
$out->element('abbr', array('class' => 'dtstart',
'title' => common_date_iso8601($event->start_time)),
@ -385,14 +385,14 @@ class EventPlugin extends MicroappPlugin
if (!empty($event->location)) {
$out->elementStart('div', 'event-location');
$out->element('strong', null, _('Location: '));
$out->element('strong', null, _m('Location:'));
$out->element('span', 'location', $event->location);
$out->elementEnd('div');
}
if (!empty($event->description)) {
$out->elementStart('div', 'event-description');
$out->element('strong', null, _('Description: '));
$out->element('strong', null, _m('Description:'));
$out->element('span', 'description', $event->description);
$out->elementEnd('div');
}
@ -400,9 +400,11 @@ class EventPlugin extends MicroappPlugin
$rsvps = $event->getRSVPs();
$out->elementStart('div', 'event-rsvps');
$out->element('strong', null, _('Attending: '));
$out->element('strong', null, _m('Attending:'));
$out->element('span', 'event-rsvps',
sprintf(_('Yes: %d No: %d Maybe: %d'),
// TRANS: RSVP counts.
// TRANS: %1$d, %2$d and %3$d are numbers of RSVPs.
sprintf(_m('Yes: %1$d No: %2$d Maybe: %3$d'),
count($rsvps[RSVP::POSITIVE]),
count($rsvps[RSVP::NEGATIVE]),
count($rsvps[RSVP::POSSIBLE])));

View File

@ -122,7 +122,7 @@ class Happening extends Managed_DataObject
if (array_key_exists('uri', $options)) {
$other = Happening::staticGet('uri', $options['uri']);
if (!empty($other)) {
throw new ClientException(_('Event already exists.'));
throw new ClientException(_m('Event already exists.'));
}
}
@ -154,25 +154,27 @@ class Happening extends Managed_DataObject
// XXX: does this get truncated?
$content = sprintf(_('"%s" %s - %s (%s): %s'),
// TRANS: Event description. %1$s is a title, %2$s is start time, %3$s is end time,
// TRANS: %4$s is location, %5$s is a description.
$content = sprintf(_m('"%1$s" %2$s - %3$s (%4$s): %5$s'),
$title,
common_exact_date($start_time),
common_exact_date($end_time),
common_exact_date($ev->start_time),
common_exact_date($ev->end_time),
$location,
$description);
$rendered = sprintf(_('<span class="vevent">'.
'<span class="summary">%s</span> '.
'<abbr class="dtstart" title="%s">%s</a> - '.
'<abbr class="dtend" title="%s">%s</a> '.
'(<span class="location">%s</span>): '.
'<span class="description">%s</span> '.
$rendered = sprintf(_m('<span class="vevent">'.
'<span class="summary">%1$s</span> '.
'<abbr class="dtstart" title="%2$s">%3$s</a> - '.
'<abbr class="dtend" title="%4$s">%5$s</a> '.
'(<span class="location">%6$s</span>): '.
'<span class="description">%7$s</span> '.
'</span>'),
htmlspecialchars($title),
htmlspecialchars(common_date_iso8601($start_time)),
htmlspecialchars(common_exact_date($start_time)),
htmlspecialchars(common_date_iso8601($end_time)),
htmlspecialchars(common_exact_date($end_time)),
htmlspecialchars(common_date_iso8601($ev->start_time)),
htmlspecialchars(common_exact_date($ev->start_time)),
htmlspecialchars(common_date_iso8601($ev->end_time)),
htmlspecialchars(common_exact_date($ev->end_time)),
htmlspecialchars($location),
htmlspecialchars($description));

View File

@ -143,7 +143,7 @@ class RSVP extends Managed_DataObject
if (array_key_exists('uri', $options)) {
$other = RSVP::staticGet('uri', $options['uri']);
if (!empty($other)) {
throw new ClientException(_('RSVP already exists.'));
throw new ClientException(_m('RSVP already exists.'));
}
}
@ -151,7 +151,7 @@ class RSVP extends Managed_DataObject
'event_id' => $event->id));
if (!empty($other)) {
throw new ClientException(_('RSVP already exists.'));
throw new ClientException(_m('RSVP already exists.'));
}
$rsvp = new RSVP();
@ -316,13 +316,13 @@ class RSVP extends Managed_DataObject
switch ($response) {
case 'Y':
$fmt = _("<span class='automatic event-rsvp'><a href='%1s'>%2s</a> is attending <a href='%3s'>%4s</a>.</span>");
$fmt = _m("<span class='automatic event-rsvp'><a href='%1s'>%2s</a> is attending <a href='%3s'>%4s</a>.</span>");
break;
case 'N':
$fmt = _("<span class='automatic event-rsvp'><a href='%1s'>%2s</a> is not attending <a href='%3s'>%4s</a>.</span>");
$fmt = _m("<span class='automatic event-rsvp'><a href='%1s'>%2s</a> is not attending <a href='%3s'>%4s</a>.</span>");
break;
case '?':
$fmt = _("<span class='automatic event-rsvp'><a href='%1s'>%2s</a> might attend <a href='%3s'>%4s</a>.</span>");
$fmt = _m("<span class='automatic event-rsvp'><a href='%1s'>%2s</a> might attend <a href='%3s'>%4s</a>.</span>");
break;
default:
throw new Exception("Unknown response code {$response}");
@ -331,7 +331,7 @@ class RSVP extends Managed_DataObject
if (empty($event)) {
$eventUrl = '#';
$eventTitle = _('an unknown event');
$eventTitle = _m('an unknown event');
} else {
$notice = $event->getNotice();
$eventUrl = $notice->bestUrl();
@ -351,13 +351,13 @@ class RSVP extends Managed_DataObject
switch ($response) {
case 'Y':
$fmt = _("%1s is attending %2s.");
$fmt = _m("%1s is attending %2s.");
break;
case 'N':
$fmt = _("%1s is not attending %2s.");
$fmt = _m("%1s is not attending %2s.");
break;
case '?':
$fmt = _("%1s might attend %2s.>");
$fmt = _m("%1s might attend %2s.>");
break;
default:
throw new Exception("Unknown response code {$response}");
@ -365,7 +365,7 @@ class RSVP extends Managed_DataObject
}
if (empty($event)) {
$eventTitle = _('an unknown event');
$eventTitle = _m('an unknown event');
} else {
$notice = $event->getNotice();
$eventTitle = $event->title;

View File

@ -58,7 +58,7 @@ class CancelrsvpAction extends Action
function title()
{
return _('Cancel RSVP');
return _m('Cancel RSVP');
}
/**
@ -79,25 +79,25 @@ class CancelrsvpAction extends Action
$rsvpId = $this->trimmed('rsvp');
if (empty($rsvpId)) {
throw new ClientException(_('No such rsvp.'));
throw new ClientException(_m('No such RSVP.'));
}
$this->rsvp = RSVP::staticGet('id', $rsvpId);
if (empty($this->rsvp)) {
throw new ClientException(_('No such rsvp.'));
throw new ClientException(_m('No such RSVP.'));
}
$this->event = Happening::staticGet('id', $this->rsvp->event_id);
if (empty($this->event)) {
throw new ClientException(_('No such event.'));
throw new ClientException(_m('No such event.'));
}
$this->user = common_current_user();
if (empty($this->user)) {
throw new ClientException(_('You must be logged in to RSVP for an event.'));
throw new ClientException(_m('You must be logged in to RSVP for an event.'));
}
return true;
@ -154,7 +154,7 @@ class CancelrsvpAction extends Action
$this->elementStart('html');
$this->elementStart('head');
// TRANS: Page title after sending a notice.
$this->element('title', null, _('Event saved'));
$this->element('title', null, _m('Event saved'));
$this->elementEnd('head');
$this->elementStart('body');
$this->elementStart('body');

View File

@ -102,13 +102,13 @@ class CancelRSVPForm extends Form
switch (RSVP::verbFor($this->rsvp->response)) {
case RSVP::POSITIVE:
$this->out->text(_('You will attend this event.'));
$this->out->text(_m('You will attend this event.'));
break;
case RSVP::NEGATIVE:
$this->out->text(_('You will not attend this event.'));
$this->out->text(_m('You will not attend this event.'));
break;
case RSVP::POSSIBLE:
$this->out->text(_('You might attend this event.'));
$this->out->text(_m('You might attend this event.'));
break;
}

View File

@ -93,58 +93,58 @@ class EventForm extends Form
$this->li();
$this->out->input('title',
_('Title'),
_m('LABEL','Title'),
null,
_('Title of the event'));
_m('Title of the event'));
$this->unli();
$this->li();
$this->out->input('startdate',
_('Start date'),
_m('LABEL','Start date'),
null,
_('Date the event starts'));
_m('Date the event starts'));
$this->unli();
$this->li();
$this->out->input('starttime',
_('Start time'),
_m('LABEL','Start time'),
null,
_('Time the event starts'));
_m('Time the event starts'));
$this->unli();
$this->li();
$this->out->input('enddate',
_('End date'),
_m('LABEL','End date'),
null,
_('Date the event ends'));
_m('Date the event ends'));
$this->unli();
$this->li();
$this->out->input('endtime',
_('End time'),
_m('LABEL','End time'),
null,
_('Time the event ends'));
_m('Time the event ends'));
$this->unli();
$this->li();
$this->out->input('location',
_('Location'),
_m('LABEL','Location'),
null,
_('Event location'));
_m('Event location'));
$this->unli();
$this->li();
$this->out->input('url',
_('URL'),
_m('LABEL','URL'),
null,
_('URL for more information'));
_m('URL for more information'));
$this->unli();
$this->li();
$this->out->input('description',
_('Description'),
_m('LABEL','Description'),
null,
_('Description of the event'));
_m('Description of the event'));
$this->unli();
$this->out->elementEnd('ul');

View File

@ -63,7 +63,7 @@ class NeweventAction extends Action
function title()
{
return _('New event');
return _m('New event');
}
/**
@ -81,7 +81,7 @@ class NeweventAction extends Action
$this->user = common_current_user();
if (empty($this->user)) {
throw new ClientException(_("Must be logged in to post a event."),
throw new ClientException(_m("Must be logged in to post a event."),
403);
}
@ -92,7 +92,7 @@ class NeweventAction extends Action
$this->title = $this->trimmed('title');
if (empty($this->title)) {
throw new ClientException(_('Title required.'));
throw new ClientException(_m('Title required.'));
}
$this->location = $this->trimmed('location');
@ -102,7 +102,7 @@ class NeweventAction extends Action
$startDate = $this->trimmed('startdate');
if (empty($startDate)) {
throw new ClientException(_('Start date required.'));
throw new ClientException(_m('Start date required.'));
}
$startTime = $this->trimmed('starttime');
@ -114,7 +114,7 @@ class NeweventAction extends Action
$endDate = $this->trimmed('enddate');
if (empty($endDate)) {
throw new ClientException(_('End date required.'));
throw new ClientException(_m('End date required.'));
}
$endTime = $this->trimmed('endtime');
@ -135,13 +135,13 @@ class NeweventAction extends Action
$this->endTime = strtotime($end);
if ($this->startTime == 0) {
throw new Exception(sprintf(_('Could not parse date "%s"'),
throw new Exception(sprintf(_m('Could not parse date "%s"'),
$start));
}
if ($this->endTime == 0) {
throw new Exception(sprintf(_('Could not parse date "%s"'),
throw new Exception(sprintf(_m('Could not parse date "%s"'),
$end));
}
@ -179,15 +179,15 @@ class NeweventAction extends Action
{
try {
if (empty($this->title)) {
throw new ClientException(_('Event must have a title.'));
throw new ClientException(_m('Event must have a title.'));
}
if (empty($this->startTime)) {
throw new ClientException(_('Event must have a start time.'));
throw new ClientException(_m('Event must have a start time.'));
}
if (empty($this->endTime)) {
throw new ClientException(_('Event must have an end time.'));
throw new ClientException(_m('Event must have an end time.'));
}
$profile = $this->user->getProfile();
@ -216,7 +216,7 @@ class NeweventAction extends Action
$this->elementStart('html');
$this->elementStart('head');
// TRANS: Page title after sending a notice.
$this->element('title', null, _('Event saved'));
$this->element('title', null, _m('Event saved'));
$this->elementEnd('head');
$this->elementStart('body');
$this->showNotice($saved);

View File

@ -58,7 +58,7 @@ class NewrsvpAction extends Action
function title()
{
return _('New RSVP');
return _m('New RSVP');
}
/**
@ -79,19 +79,19 @@ class NewrsvpAction extends Action
$eventId = $this->trimmed('event');
if (empty($eventId)) {
throw new ClientException(_('No such event.'));
throw new ClientException(_m('No such event.'));
}
$this->event = Happening::staticGet('id', $eventId);
if (empty($this->event)) {
throw new ClientException(_('No such event.'));
throw new ClientException(_m('No such event.'));
}
$this->user = common_current_user();
if (empty($this->user)) {
throw new ClientException(_('You must be logged in to RSVP for an event.'));
throw new ClientException(_m('You must be logged in to RSVP for an event.'));
}
common_debug(print_r($this->args, true));
@ -159,7 +159,7 @@ class NewrsvpAction extends Action
$this->elementStart('html');
$this->elementStart('head');
// TRANS: Page title after sending a notice.
$this->element('title', null, _('Event saved'));
$this->element('title', null, _m('Event saved'));
$this->elementEnd('head');
$this->elementStart('body');
$this->elementStart('body');

View File

@ -98,7 +98,7 @@ class RSVPForm extends Form
{
$this->out->elementStart('fieldset', array('id' => 'new_rsvp_data'));
$this->out->text(_('RSVP: '));
$this->out->text(_m('RSVP:'));
$this->out->hidden('event', $this->event->id);
$this->out->hidden('submitvalue', '');

View File

@ -91,7 +91,7 @@ class ShowrsvpAction extends ShownoticeAction
{
// TRANS: Title for event.
// TRANS: %1$s is a user nickname, %2$s is an event title.
return sprintf(_('%1$s\'s RSVP for "%2$s"'),
return sprintf(_m('%1$s\'s RSVP for "%2$s"'),
$this->user->nickname,
$this->event->title);
}

View File

@ -618,7 +618,7 @@ class ExtendedProfileWidget extends Form
_m('BUTTON','Save'),
'submit form_action-secondary',
'save',
_('Save details')
_m('Save details')
);
}

View File

@ -526,7 +526,7 @@ ENDOFSCRIPT;
*/
function onEndFavorNotice(Profile $profile, Notice $notice)
{
$client = new Facebookclient($notice);
$client = new Facebookclient($notice, $profile);
$client->like();
return true;
@ -542,7 +542,7 @@ ENDOFSCRIPT;
*/
function onEndDisfavorNotice(Profile $profile, Notice $notice)
{
$client = new Facebookclient($notice);
$client = new Facebookclient($notice, $profile);
$client->unLike();
return true;

View File

@ -111,7 +111,7 @@ class FacebooksettingsAction extends SettingsAction {
* @return instructions for use
*/
function getInstructions() {
return _('Facebook settings');
return _m('Facebook settings');
}
/*

View File

@ -48,7 +48,12 @@ class Facebookclient
protected $notice = null; // The user's notice
protected $user = null; // Sender of the notice
function __construct($notice)
/**
*
* @param Notice $notice the notice to manipulate
* @param Profile $profile local user to act as; if left empty, the notice's poster will be used.
*/
function __construct($notice, $profile=null)
{
$this->facebook = self::getFacebook();
@ -60,8 +65,9 @@ class Facebookclient
$this->notice = $notice;
$profile_id = $profile ? $profile->id : $notice->profile_id;
$this->flink = Foreign_link::getByUserID(
$notice->profile_id,
$profile_id,
FACEBOOK_SERVICE
);

View File

@ -159,7 +159,7 @@ class FollowEveryonePlugin extends Plugin
$action->elementStart('li');
// TRANS: Checkbox label in form for profile settings.
$action->checkbox('followeveryone', _('Follow everyone'),
$action->checkbox('followeveryone', _m('Follow everyone'),
($action->arg('followeveryone')) ?
$action->arg('followeveryone') :
User_followeveryone_prefs::followEveryone($user->id));

View File

@ -255,21 +255,21 @@ class GroupPrivateMessagePlugin extends Plugin
$form->out->elementStart('li');
$form->out->dropdown('allow_privacy',
_('Private messages'),
array(Group_privacy_settings::SOMETIMES => _('Sometimes'),
Group_privacy_settings::ALWAYS => _('Always'),
Group_privacy_settings::NEVER => _('Never')),
_('Whether to allow private messages to this group'),
_m('Private messages'),
array(Group_privacy_settings::SOMETIMES => _m('Sometimes'),
Group_privacy_settings::ALWAYS => _m('Always'),
Group_privacy_settings::NEVER => _m('Never')),
_m('Whether to allow private messages to this group'),
false,
(empty($gps)) ? Group_privacy_settings::SOMETIMES : $gps->allow_privacy);
$form->out->elementEnd('li');
$form->out->elementStart('li');
$form->out->dropdown('allow_sender',
_('Private sender'),
array(Group_privacy_settings::EVERYONE => _('Everyone'),
Group_privacy_settings::MEMBER => _('Member'),
Group_privacy_settings::ADMIN => _('Admin')),
_('Who can send private messages to the group'),
_m('Private sender'),
array(Group_privacy_settings::EVERYONE => _m('Everyone'),
Group_privacy_settings::MEMBER => _m('Member'),
Group_privacy_settings::ADMIN => _m('Admin')),
_m('Who can send private messages to the group'),
false,
(empty($gps)) ? Group_privacy_settings::MEMBER : $gps->allow_sender);
$form->out->elementEnd('li');
@ -370,8 +370,8 @@ class GroupPrivateMessagePlugin extends Plugin
$action->elementStart('li', 'entity_send-a-message');
$action->element('a', array('href' => common_local_url('newgroupmessage', array('nickname' => $group->nickname)),
'title' => _('Send a direct message to this group')),
_('Message'));
'title' => _m('Send a direct message to this group')),
_m('Message'));
// $form = new GroupMessageForm($action, $group);
// $form->hidden = true;
// $form->show();
@ -454,7 +454,7 @@ class GroupPrivateMessagePlugin extends Plugin
// Don't save the notice!
// FIXME: this is probably cheating.
throw new ClientException(sprintf(_('Forced notice to private group message.')),
throw new ClientException(sprintf(_m('Forced notice to private group message.')),
200);
}
}
@ -476,7 +476,7 @@ class GroupPrivateMessagePlugin extends Plugin
$gps = Group_privacy_settings::forGroup($group);
if ($gps->allow_privacy == Group_privacy_settings::ALWAYS) {
$action->element('p', 'privategroupindicator', _('Private'));
$action->element('p', 'privategroupindicator', _m('Private'));
}
return true;

View File

@ -123,7 +123,7 @@ class Group_message extends Memcached_DataObject
{
if (!$user->hasRight(Right::NEWMESSAGE)) {
// XXX: maybe break this out into a separate right
throw new Exception(sprintf(_('User %s not allowed to send private messages.'),
throw new Exception(sprintf(_m('User %s is not allowed to send private messages.'),
$user->nickname));
}
@ -177,7 +177,7 @@ class Group_message extends Memcached_DataObject
{
$group = User_group::staticGet('id', $this->to_group);
if (empty($group)) {
throw new ServerException(_('No group for group message'));
throw new ServerException(_m('No group for group message'));
}
return $group;
}
@ -186,7 +186,7 @@ class Group_message extends Memcached_DataObject
{
$sender = Profile::staticGet('id', $this->from_profile);
if (empty($sender)) {
throw new ServerException(_('No sender for group message'));
throw new ServerException(_m('No sender for group message'));
}
return $sender;
}

View File

@ -156,27 +156,27 @@ class Group_message_profile extends Memcached_DataObject
// TRANS: Subject for direct-message notification email.
// TRANS: %s is the sending user's nickname.
$subject = sprintf(_('New private message from %s to group %s'), $from_profile->nickname, $group->nickname);
$subject = sprintf(_m('New private message from %1$s to group %2$s'), $from_profile->nickname, $group->nickname);
// TRANS: Body for direct-message notification email.
// TRANS: %1$s is the sending user's long name, %2$s is the sending user's nickname,
// TRANS: %3$s is the message content, %4$s a URL to the message,
// TRANS: %5$s is the StatusNet sitename.
$body = sprintf(_("%1\$s (%2\$s) sent a private message to group %3\$s:\n\n".
$body = sprintf(_m("%1\$s (%2\$s) sent a private message to group %3\$s:\n\n".
"------------------------------------------------------\n".
"%4\$s\n".
"------------------------------------------------------\n\n".
"You can reply to their message here:\n\n".
"%5\$s\n\n".
"Don't reply to this email; it won't get to them.\n\n".
"Do not reply to this email; it will not get to them.\n\n".
"With kind regards,\n".
"%6\$s\n"),
"%6\$s"),
$from_profile->getBestName(),
$from_profile->nickname,
$group->nickname,
$gm->content,
common_local_url('newmessage', array('to' => $from_profile->id)),
common_config('site', 'name'));
common_config('site', 'name')) . "\n";
$headers = _mail_prepare_headers('message', $to->nickname, $from_profile->nickname);

View File

@ -164,7 +164,7 @@ class Group_privacy_settings extends Memcached_DataObject
$gps = self::forGroup($group);
if ($gps->allow_privacy == Group_privacy_settings::NEVER) {
throw new Exception(sprintf(_('Group %s does not allow private messages.'),
throw new Exception(sprintf(_m('Group %s does not allow private messages.'),
$group->nickname));
}
@ -172,27 +172,27 @@ class Group_privacy_settings extends Memcached_DataObject
case Group_privacy_settings::EVERYONE:
$profile = $user->getProfile();
if (Group_block::isBlocked($group, $profile)) {
throw new Exception(sprintf(_('User %s is blocked from group %s.'),
throw new Exception(sprintf(_m('User %1$s is blocked from group %2$s.'),
$user->nickname,
$group->nickname));
}
break;
case Group_privacy_settings::MEMBER:
if (!$user->isMember($group)) {
throw new Exception(sprintf(_('User %s is not a member of group %s.'),
throw new Exception(sprintf(_m('User %1$s is not a member of group %2$s.'),
$user->nickname,
$group->nickname));
}
break;
case Group_privacy_settings::ADMIN:
if (!$user->isAdmin($group)) {
throw new Exception(sprintf(_('User %s is not an administrator of group %s.'),
throw new Exception(sprintf(_m('User %1$s is not an administrator of group %2$s.'),
$user->nickname,
$group->nickname));
}
break;
default:
throw new Exception(sprintf(_('Unknown privacy settings for group %s.'),
throw new Exception(sprintf(_m('Unknown privacy settings for group %s.'),
$group->nickname));
}

View File

@ -63,7 +63,7 @@ class GroupinboxAction extends GroupDesignAction
$cur = common_current_user();
if (empty($cur)) {
throw new ClientException(_('Only for logged-in users'), 403);
throw new ClientException(_m('Only for logged-in users.'), 403);
}
$nicknameArg = $this->trimmed('nickname');
@ -79,17 +79,17 @@ class GroupinboxAction extends GroupDesignAction
$localGroup = Local_group::staticGet('nickname', $nickname);
if (empty($localGroup)) {
throw new ClientException(_('No such group'), 404);
throw new ClientException(_m('No such group.'), 404);
}
$this->group = User_group::staticGet('id', $localGroup->group_id);
if (empty($this->group)) {
throw new ClientException(_('No such group'), 404);
throw new ClientException(_m('No such group.'), 404);
}
if (!$cur->isMember($this->group)) {
throw new ClientException(_('Only for members'), 403);
throw new ClientException(_m('Only for members.'), 403);
}
$this->page = $this->trimmed('page');
@ -167,11 +167,11 @@ class GroupinboxAction extends GroupDesignAction
$base = $this->group->getFancyName();
if ($this->page == 1) {
return sprintf(_('%s group inbox'), $base);
return sprintf(_m('%s group inbox'), $base);
} else {
// TRANS: Page title for any but first group page.
// TRANS: %1$s is a group name, $2$s is a page number.
return sprintf(_('%1$s group inbox, page %2$d'),
return sprintf(_m('%1$s group inbox, page %2$d'),
$base,
$this->page);
}

View File

@ -77,7 +77,7 @@ class GroupMessageCommand extends Command
$gm = Group_message::send($this->user, $group, $this->text);
$channel->output($this->user,
sprintf(_('Direct message to group %s sent.'),
sprintf(_m('Direct message to group %s sent.'),
$group->nickname));
return true;

View File

@ -87,7 +87,7 @@ class GroupMessageForm extends Form
{
$this->out->element('legend',
null,
sprintf(_('Message to %s'), $this->group->nickname));
sprintf(_m('Message to %s'), $this->group->nickname));
}
/**
@ -128,7 +128,7 @@ class GroupMessageForm extends Form
{
$this->out->element('label', array('for' => 'notice_data-text',
'id' => 'notice_data-text-label'),
sprintf(_('Direct message to %s'), $this->group->nickname));
sprintf(_m('Direct message to %s'), $this->group->nickname));
$this->out->element('textarea', array('id' => 'notice_data-text',
'cols' => 35,
@ -140,7 +140,7 @@ class GroupMessageForm extends Form
if ($contentLimit > 0) {
$this->out->elementStart('dl', 'form_note');
$this->out->element('dt', null, _('Available characters'));
$this->out->element('dt', null, _m('Available characters'));
$this->out->element('dd', array('class' => 'count'),
$contentLimit);
$this->out->elementEnd('dl');

View File

@ -66,11 +66,11 @@ class NewgroupmessageAction extends Action
$this->user = common_current_user();
if (empty($this->user)) {
throw new ClientException(_('Must be logged in.'), 403);
throw new ClientException(_m('Must be logged in.'), 403);
}
if (!$this->user->hasRight(Right::NEWMESSAGE)) {
throw new Exception(sprintf(_('User %s not allowed to send private messages.'),
throw new Exception(sprintf(_m('User %s not allowed to send private messages.'),
$this->user->nickname));
}
@ -87,13 +87,13 @@ class NewgroupmessageAction extends Action
$localGroup = Local_group::staticGet('nickname', $nickname);
if (empty($localGroup)) {
throw new ClientException(_('No such group'), 404);
throw new ClientException(_m('No such group.'), 404);
}
$this->group = User_group::staticGet('id', $localGroup->group_id);
if (empty($this->group)) {
throw new ClientException(_('No such group'), 404);
throw new ClientException(_m('No such group.'), 404);
}
// This throws an exception on error
@ -140,12 +140,12 @@ class NewgroupmessageAction extends Action
if ($this->boolean('ajax')) {
$this->startHTML('text/xml;charset=utf-8');
$this->elementStart('head');
$this->element('title', null, _('Message sent'));
$this->element('title', null, _m('Message sent'));
$this->elementEnd('head');
$this->elementStart('body');
$this->element('p',
array('id' => 'command_result'),
sprintf(_('Direct message to %s sent.'),
sprintf(_m('Direct message to %s sent.'),
$this->group->nickname));
$this->elementEnd('body');
$this->elementEnd('html');
@ -156,6 +156,6 @@ class NewgroupmessageAction extends Action
function title()
{
return sprintf(_('New message to group %s'), $this->group->nickname);
return sprintf(_m('New message to group %s'), $this->group->nickname);
}
}

View File

@ -67,7 +67,7 @@ class ShowgroupmessageAction extends Action
$this->user = common_current_user();
if (empty($this->user)) {
throw new ClientException(_('Only logged-in users can view private messages.'),
throw new ClientException(_m('Only logged-in users can view private messages.'),
403);
}
@ -76,23 +76,23 @@ class ShowgroupmessageAction extends Action
$this->gm = Group_message::staticGet('id', $id);
if (empty($this->gm)) {
throw new ClientException(_('No such message'), 404);
throw new ClientException(_m('No such message.'), 404);
}
$this->group = User_group::staticGet('id', $this->gm->to_group);
if (empty($this->group)) {
throw new ServerException(_('Group not found.'));
throw new ServerException(_m('Group not found.'));
}
if (!$this->user->isMember($this->group)) {
throw new ClientException(_('Cannot read message.'), 403);
throw new ClientException(_m('Cannot read message.'), 403);
}
$this->sender = Profile::staticGet('id', $this->gm->from_profile);
if (empty($this->sender)) {
throw new ServerException(_('No sender found.'));
throw new ServerException(_m('No sender found.'));
}
return true;
@ -117,7 +117,7 @@ class ShowgroupmessageAction extends Action
function title()
{
return sprintf(_('Message from %1$s to group %2$s on %3$s'),
return sprintf(_m('Message from %1$s to group %2$s on %3$s'),
$this->sender->nickname,
$this->group->nickname,
common_exact_date($this->gm->created));

View File

@ -290,12 +290,12 @@ class IrcPlugin extends ImPlugin {
* @return boolean success value
*/
public function sendConfirmationCode($screenname, $code, $user, $checked = false) {
$body = sprintf(_('User "%s" on %s has said that your %s screenname belongs to them. ' .
$body = sprintf(_m('User "%1$s" on %2$s has said that your %3$s screenname belongs to them. ' .
'If that\'s true, you can confirm by clicking on this URL: ' .
'%s' .
'%4$s' .
' . (If you cannot click it, copy-and-paste it into the ' .
'address bar of your browser). If that user isn\'t you, ' .
'or if you didn\'t request this confirmation, just ignore this message.'),
'address bar of your browser). If that user is not you, ' .
'or if you did not request this confirmation, just ignore this message.'),
$user->nickname, common_config('site', 'name'), $this->getDisplayName(), common_local_url('confirmaddress', array('code' => $code)));
if ($this->regcheck && !$checked) {

View File

@ -244,7 +244,7 @@ class IrcManager extends ImManager {
if (!$result) {
common_log_db_error($confirm, 'DELETE', __FILE__);
// TRANS: Server error thrown on database error canceling IM address confirmation.
$this->serverError(_('Couldn\'t delete confirmation.'));
$this->serverError(_m('Could not delete confirmation.'));
return;
}
}

View File

@ -165,7 +165,7 @@ class LdapCommon
function changePassword($username,$oldpassword,$newpassword)
{
if(! isset($this->attributes['password']) || !isset($this->password_encoding)){
//throw new Exception(_('Sorry, changing LDAP passwords is not supported at this time'));
//throw new Exception(_m('Sorry, changing LDAP passwords is not supported at this time.'));
return false;
}
$entry = $this->get_user($username,array('dn' => 'dn'));

View File

@ -56,7 +56,7 @@ class OembedproxyAction extends OembedAction
// We're not a general oEmbed proxy service; limit to valid sessions.
$token = $this->trimmed('token');
if (!$token || $token != common_session_token()) {
$this->clientError(_('There was a problem with your session token. '.
$this->clientError(_m('There was a problem with your session token. '.
'Try again, please.'));
}

View File

@ -201,7 +201,7 @@ class LinkbackPlugin extends Plugin
{
$profile = $this->notice->getProfile();
$args = array('title' => sprintf(_('%1$s\'s status on %2$s'),
$args = array('title' => sprintf(_m('%1$s\'s status on %2$s'),
$profile->nickname,
common_exact_date($this->notice->created)),
'excerpt' => $this->notice->content,

View File

@ -15,7 +15,7 @@ class RemoteProfileAction extends ShowstreamAction
$this->profile = Profile::staticGet('id', $id);
if (!$this->profile) {
$this->serverError(_('User has no profile.'));
$this->serverError(_m('User has no profile.'));
return false;
}

View File

@ -86,7 +86,7 @@ class MollomPlugin extends Plugin
);
$response = $this->mollom('mollom.checkContent', $data);
if ($response['spam'] == MOLLOM_ANALYSIS_SPAM) {
throw new ClientException(_("Spam Detected"), 400);
throw new ClientException(_m("Spam Detected."), 400);
}
if ($response['spam'] == MOLLOM_ANALYSIS_UNSURE) {
//if unsure, let through

View File

@ -157,7 +157,7 @@ class UsersalmonAction extends SalmonAction
if (!empty($old)) {
// TRANS: Client exception.
throw new ClientException(_('This is already a favorite.'));
throw new ClientException(_m('This is already a favorite.'));
}
if (!Fave::addNew($profile, $notice)) {
@ -179,7 +179,7 @@ class UsersalmonAction extends SalmonAction
'notice_id' => $notice->id));
if (empty($fave)) {
// TRANS: Client exception.
throw new ClientException(_('Notice wasn\'t favorited!'));
throw new ClientException(_m('Notice was not favorited!'));
}
$fave->delete();

View File

@ -125,12 +125,12 @@ class FinishopenidloginAction extends Action
$this->elementStart('li');
$this->input('newname', _m('New nickname'),
($this->username) ? $this->username : '',
_m('1-64 lowercase letters or numbers, no punctuation or spaces'));
_m('1-64 lowercase letters or numbers, no punctuation or spaces.'));
$this->elementEnd('li');
$this->elementStart('li');
$this->input('email', _('Email'), $this->getEmail(),
_('Used only for updates, announcements, '.
'and password recovery'));
$this->input('email', _m('Email'), $this->getEmail(),
_m('Used only for updates, announcements, '.
'and password recovery.'));
$this->elementEnd('li');
// Hook point for captcha etc
@ -146,7 +146,7 @@ class FinishopenidloginAction extends Action
'class' => 'checkbox'));
// TRANS: OpenID plugin link text.
// TRANS: %s is a link to a licese with the license name as link text.
$message = _('My text and files are available under %s ' .
$message = _m('My text and files are available under %s ' .
'except this private data: password, ' .
'email address, IM address, and phone number.');
$link = '<a href="' .

View File

@ -275,6 +275,6 @@ class OpenIDAdminPanelForm extends AdminForm
function formActions()
{
$this->out->submit('submit', _('Save'), 'submit', null, _m('Save OpenID settings'));
$this->out->submit('submit', _m('Save'), 'submit', null, _m('Save OpenID settings.'));
}
}

View File

@ -444,7 +444,7 @@ class PollPlugin extends MicroAppPlugin
$form->show();
}
} else {
$out->text(_('Poll data is missing'));
$out->text(_m('Poll data is missing'));
}
$out->elementEnd('div');

View File

@ -82,7 +82,7 @@ class LoggingAggregatorAction extends Action
parent::handle($args);
if (empty($this->url)) {
$this->showError(_('A URL parameter is required.'));
$this->showError(_m('A URL parameter is required.'));
return;
}

View File

@ -93,7 +93,7 @@ class RecaptchaPlugin extends Plugin
if (!$resp->is_valid) {
if($this->display_errors) {
$action->showForm(sprintf(_("(reCAPTCHA error: %s)", $resp->error)));
$action->showForm(sprintf(_m("(reCAPTCHA error: %s)", $resp->error)));
}
$action->showForm(_m("Captcha does not match!"));
return false;

View File

@ -66,7 +66,7 @@ class ConfirmfirstemailAction extends Action
$user = common_current_user();
if (!empty($user)) {
throw new ClientException(_('You are already logged in.'));
throw new ClientException(_m('You are already logged in.'));
}
$this->code = $this->trimmed('code');
@ -74,25 +74,25 @@ class ConfirmfirstemailAction extends Action
$this->confirm = Confirm_address::staticGet('code', $this->code);
if (empty($this->confirm)) {
throw new ClientException(_('Confirmation code not found.'));
throw new ClientException(_m('Confirmation code not found.'));
return;
}
$this->user = User::staticGet('id', $this->confirm->user_id);
if (empty($this->user)) {
throw new ServerException(_('No user for that confirmation code.'));
throw new ServerException(_m('No user for that confirmation code.'));
}
$type = $this->confirm->address_type;
if ($type != 'email') {
throw new ServerException(sprintf(_('Unrecognized address type %s.'), $type));
throw new ServerException(sprintf(_m('Unrecognized address type %s.'), $type));
}
if (!empty($this->user->email) && $this->user->email == $confirm->address) {
// TRANS: Client error for an already confirmed email/jabber/sms address.
throw new ClientException(_('That address has already been confirmed.'));
throw new ClientException(_m('That address has already been confirmed.'));
}
if ($this->isPost()) {
@ -103,10 +103,10 @@ class ConfirmfirstemailAction extends Action
$confirm = $this->trimmed('confirm');
if (strlen($password) < 6) {
throw new ClientException(_('Password too short.'));
throw new ClientException(_m('Password too short.'));
return;
} else if (0 != strcmp($password, $confirm)) {
throw new ClientException(_("Passwords don't match."));
throw new ClientException(_m("Passwords do not match."));
return;
}
@ -162,7 +162,7 @@ class ConfirmfirstemailAction extends Action
function showContent()
{
$this->element('p', 'instructions',
sprintf(_('You have confirmed the email address for your new user account %s. '.
sprintf(_m('You have confirmed the email address for your new user account %s. '.
'Use the form below to set your new password.'),
$this->user->nickname));
@ -172,7 +172,7 @@ class ConfirmfirstemailAction extends Action
function title()
{
return _('Set a password');
return _m('Set a password');
}
}
@ -188,7 +188,7 @@ class ConfirmFirstEmailForm extends Form
function formLegend()
{
return _('Confirm email');
return _m('Confirm email');
}
function action()
@ -206,18 +206,18 @@ class ConfirmFirstEmailForm extends Form
{
$this->out->elementStart('ul', 'form_data');
$this->out->elementStart('li');
$this->out->password('password', _('New password'),
_('6 or more characters.'));
$this->out->password('password', _m('New password'),
_m('6 or more characters.'));
$this->out->elementEnd('li');
$this->out->elementStart('li');
$this->out->password('confirm', _('Confirm'),
_('Same as password above.'));
$this->out->password('confirm', _m('Confirm'),
_m('Same as password above.'));
$this->out->elementEnd('li');
$this->out->elementEnd('ul');
}
function formActions()
{
$this->out->submit('save', _('Save'));
$this->out->submit('save', _m('Save'));
}
}

View File

@ -75,7 +75,7 @@ class SearchsubAction extends Action
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
// TRANS: Client error displayed trying to perform any request method other than POST.
// TRANS: Do not translate POST.
$this->clientError(_('This action only accepts POST requests.'));
$this->clientError(_m('This action only accepts POST requests.'));
return false;
}
@ -85,7 +85,7 @@ class SearchsubAction extends Action
if (!$token || $token != common_session_token()) {
// TRANS: Client error displayed when the session token is not okay.
$this->clientError(_('There was a problem with your session token.'.
$this->clientError(_m('There was a problem with your session token.'.
' Try again, please.'));
return false;
}
@ -96,7 +96,7 @@ class SearchsubAction extends Action
if (empty($this->user)) {
// TRANS: Client error displayed trying to subscribe when not logged in.
$this->clientError(_('Not logged in.'));
$this->clientError(_m('Not logged in.'));
return false;
}
@ -106,7 +106,7 @@ class SearchsubAction extends Action
if (empty($this->search)) {
// TRANS: Client error displayed trying to subscribe to a non-existing profile.
$this->clientError(_('No such profile.'));
$this->clientError(_m('No such profile.'));
return false;
}

View File

@ -137,6 +137,6 @@ class SearchSubForm extends Form
function formActions()
{
$this->out->submit('submit', _('Subscribe'), 'submit', null, _m('Subscribe to this search'));
$this->out->submit('submit', _m('BUTTON','Subscribe'), 'submit', null, _m('Subscribe to this search'));
}
}

View File

@ -104,6 +104,6 @@ class SearchUnsubForm extends SearchSubForm
function formActions()
{
$this->out->submit('submit', _('Unsubscribe'), 'submit', null, _m('Unsubscribe from this search'));
$this->out->submit('submit', _m('BUTTON','Unsubscribe'), 'submit', null, _m('Unsubscribe from this search'));
}
}

View File

@ -129,7 +129,7 @@ class MirrorSettingsAction extends SettingsAction
header('Content-Type: text/html;charset=utf-8');
$this->elementStart('html');
$this->elementStart('head');
$this->element('title', null, _('Provider add'));
$this->element('title', null, _m('Provider add'));
$this->elementEnd('head');
$this->elementStart('body');

View File

@ -71,7 +71,7 @@ class SubscriptionThrottlePlugin extends Plugin
$subtime = strtotime($sub->created);
$now = time();
if ($now - $subtime < $seconds) {
throw new Exception(_("Too many subscriptions. Take a break and try again later."));
throw new Exception(_m("Too many subscriptions. Take a break and try again later."));
}
}
}
@ -97,7 +97,7 @@ class SubscriptionThrottlePlugin extends Plugin
$jointime = strtotime($mem->created);
$now = time();
if ($now - $jointime < $seconds) {
throw new Exception(_("Too many memberships. Take a break and try again later."));
throw new Exception(_m("Too many memberships. Take a break and try again later."));
}
}
}

View File

@ -75,7 +75,7 @@ class TagsubAction extends Action
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
// TRANS: Client error displayed trying to perform any request method other than POST.
// TRANS: Do not translate POST.
$this->clientError(_('This action only accepts POST requests.'));
$this->clientError(_m('This action only accepts POST requests.'));
return false;
}
@ -85,7 +85,7 @@ class TagsubAction extends Action
if (!$token || $token != common_session_token()) {
// TRANS: Client error displayed when the session token is not okay.
$this->clientError(_('There was a problem with your session token.'.
$this->clientError(_m('There was a problem with your session token.'.
' Try again, please.'));
return false;
}
@ -96,7 +96,7 @@ class TagsubAction extends Action
if (empty($this->user)) {
// TRANS: Client error displayed trying to subscribe when not logged in.
$this->clientError(_('Not logged in.'));
$this->clientError(_m('Not logged in.'));
return false;
}
@ -106,7 +106,7 @@ class TagsubAction extends Action
if (empty($this->tag)) {
// TRANS: Client error displayed trying to subscribe to a non-existing profile.
$this->clientError(_('No such profile.'));
$this->clientError(_m('No such profile.'));
return false;
}

View File

@ -137,6 +137,6 @@ class TagSubForm extends Form
function formActions()
{
$this->out->submit('submit', _('Subscribe'), 'submit', null, _m('Subscribe to this tag'));
$this->out->submit('submit', _m('BUTTON','Subscribe'), 'submit', null, _m('Subscribe to this tag'));
}
}

View File

@ -115,13 +115,13 @@ class TagSubsAction extends GalleryAction
$current_user = common_current_user();
if ($this->user->id === $current_user->id) {
// TRANS: Tag subscription list text when the logged in user has no tag subscriptions.
$message = _('You\'re not listening to any hash tags right now. You can push the "Subscribe" button ' .
$message = _m('You are not listening to any hash tags right now. You can push the "Subscribe" button ' .
'on any hashtag page to automatically receive any public messages on this site that use that ' .
'tag, even if you\'re not subscribed to the poster.');
'tag, even if you are not subscribed to the poster.');
} else {
// TRANS: Tag subscription list text when looking at the subscriptions for a of a user other
// TRANS: than the logged in user that has no tag subscriptions. %s is the user nickname.
$message = sprintf(_('%s is not listening to any tags.'), $this->user->nickname);
$message = sprintf(_m('%s is not listening to any tags.'), $this->user->nickname);
}
}
else {

View File

@ -104,6 +104,6 @@ class TagUnsubForm extends TagSubForm
function formActions()
{
$this->out->submit('submit', _('Unsubscribe'), 'submit', null, _m('Unsubscribe from this tag'));
$this->out->submit('submit', _m('BUTTON','Unsubscribe'), 'submit', null, _m('Unsubscribe from this tag'));
}
}

View File

@ -285,7 +285,7 @@ class TemplateAction extends Action
header('WWW-Authenticate: Basic realm="StatusNet API"');
// cancelled the browser login form
$this->clientError(_('Authentication error!'), $code = 401);
$this->clientError(_m('Authentication error!'), $code = 401);
} else {
@ -299,7 +299,7 @@ class TemplateAction extends Action
// verify that user is admin
if (!($user->id == 1))
$this->clientError(_('Only User #1 can update the template.'), $code = 401);
$this->clientError(_m('Only User #1 can update the template.'), $code = 401);
// open the old template
$tpl_file = $this->templateFolder() . '/index.html';
@ -316,7 +316,7 @@ class TemplateAction extends Action
} else {
// bad username and password
$this->clientError(_('Authentication error!'), $code = 401);
$this->clientError(_m('Authentication error!'), $code = 401);
}

View File

@ -530,4 +530,13 @@ class TwitterBridgePlugin extends Plugin
return true;
}
function onStartGetProfileUri($profile, &$uri)
{
if (preg_match('!^https?://twitter.com/!', $profile->profileurl)) {
$uri = $profile->profileurl;
return false;
}
return true;
}
}

View File

@ -392,8 +392,8 @@ class TwitterauthorizationAction extends Action
_m('1-64 lowercase letters or numbers, no punctuation or spaces'));
$this->elementEnd('li');
$this->elementStart('li');
$this->input('email', _('Email'), $this->getEmail(),
_('Used only for updates, announcements, '.
$this->input('email', _m('LABEL','Email'), $this->getEmail(),
_m('Used only for updates, announcements, '.
'and password recovery'));
$this->elementEnd('li');

View File

@ -61,7 +61,7 @@ class AdminprofileflagAction extends Action
// User must be logged in.
if (!common_logged_in()) {
$this->clientError(_('Not logged in.'));
$this->clientError(_m('Not logged in.'));
return;
}
@ -85,7 +85,7 @@ class AdminprofileflagAction extends Action
// User must have the right to review flags
if (!$user->hasRight(UserFlagPlugin::REVIEWFLAGS)) {
$this->clientError(_('You cannot review profile flags.'));
$this->clientError(_m('You cannot review profile flags.'));
return false;
}

View File

@ -71,7 +71,8 @@ class UserLimitPlugin extends Plugin
$cnt = $cls->count();
if ($cnt >= $this->maxUsers) {
$msg = sprintf(_('Cannot register; maximum number of users (%d) reached.'),
// @todo FIXME: i18n issue. Needs plural.
$msg = sprintf(_m('Cannot register; maximum number of users (%d) reached.'),
$this->maxUsers);
throw new ClientException($msg);

View File

@ -81,16 +81,16 @@ class WikiHashtagsPlugin extends Plugin
$action->raw($html);
$action->elementStart('p');
$action->element('a', array('href' => $editurl,
'title' => sprintf(_('Edit the article for #%s on WikiHashtags'), $tag)),
_('Edit'));
'title' => sprintf(_m('Edit the article for #%s on WikiHashtags'), $tag)),
_m('Edit'));
$action->element('a', array('href' => 'http://www.gnu.org/copyleft/fdl.html',
'title' => _('Shared under the terms of the GNU Free Documentation License'),
'title' => _m('Shared under the terms of the GNU Free Documentation License'),
'rel' => 'license'),
'GNU FDL');
$action->elementEnd('p');
} else {
$action->element('a', array('href' => $editurl),
sprintf(_('Start the article for #%s on WikiHashtags'), $tag));
sprintf(_m('Start the article for #%s on WikiHashtags'), $tag));
}
$action->elementEnd('div');

View File

@ -354,8 +354,9 @@ class XmppPlugin extends ImPlugin
$xs->text(" ");
$xs->element('a', array(
'href'=>common_local_url('conversation',
array('id' => $notice->conversation)).'#notice-'.$notice->id
),sprintf(_('[%s]'),$notice->id));
array('id' => $notice->conversation)).'#notice-'.$notice->id),
// TRANS: %s is a notice ID.
sprintf(_m('[%s]'),$notice->id));
$xs->elementEnd('body');
$xs->elementEnd('html');