Update translator documentation.

i18n/L10n fixes.
Whitespace updates.
This commit is contained in:
Siebrand Mazeland 2011-06-05 20:15:01 +02:00
parent 8ce0acca33
commit 4110266b68
5 changed files with 42 additions and 48 deletions

View File

@ -44,7 +44,7 @@ if (!defined('STATUSNET')) {
* @author Zach Copley <zach@status.net> * @author Zach Copley <zach@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/ * @link http://status.net/
**/ */
class LoggingAggregatorAction extends Action class LoggingAggregatorAction extends Action
{ {
var $challenge = null; var $challenge = null;
@ -82,25 +82,25 @@ class LoggingAggregatorAction extends Action
parent::handle($args); parent::handle($args);
if (empty($this->url)) { if (empty($this->url)) {
// TRANS: Form validation error displayed when a URL parameter is missing.
$this->showError(_m('A URL parameter is required.')); $this->showError(_m('A URL parameter is required.'));
return; return;
} }
if (!empty($this->challenge)) { if (!empty($this->challenge)) {
// must be a GET // must be a GET
if ($_SERVER['REQUEST_METHOD'] != 'GET') { if ($_SERVER['REQUEST_METHOD'] != 'GET') {
// TRANS: Form validation error displayed when HTTP GET is not used.
$this->showError(_m('This resource requires an HTTP GET.')); $this->showError(_m('This resource requires an HTTP GET.'));
return; return;
} }
header('Content-Type: text/xml'); header('Content-Type: text/xml');
echo $this->challenge; echo $this->challenge;
} else { } else {
// must be a POST // must be a POST
if ($_SERVER['REQUEST_METHOD'] != 'POST') { if ($_SERVER['REQUEST_METHOD'] != 'POST') {
// TRANS: Form validation error displayed when HTTP POST is not used.
$this->showError(_m('This resource requires an HTTP POST.')); $this->showError(_m('This resource requires an HTTP POST.'));
return; return;
} }

View File

@ -1,11 +1,10 @@
This plugin enables RSSCloud (http://rsscloud.org/) publishing and This plugin enables RSSCloud (http://rsscloud.org/) publishing and subscription
subscription handling for RSS 2.0 profile feeds (i.e: handling for RSS 2.0 profile feeds (i.e:
http://SITE/PATH/api/statuses/user_timeline/USERNAME.rss). When the http://SITE/PATH/api/statuses/user_timeline/USERNAME.rss). When the plugin is
plugin is enabled, StatusNet acts as both the publisher and hub ('writer' and enabled, StatusNet acts as both the publisher and hub ('writer' and 'cloud' in
'cloud' in RSSCloud parlance), but only for local StatusNet feeds. It's RSSCloud parlance), but only for local StatusNet feeds. It's not possible to use
not possible to use it as a general purpose hub -- for instance you can't it as a general purpose hub -- for instance you can't subscribe and get updates
subscribe and get updates to a Wordpress feed from StatusNet using this to a Wordpress feed from StatusNet using this plugin.
plugin.
To use the plugin, add the following to your config.php: To use the plugin, add the following to your config.php:
@ -17,29 +16,28 @@ that looks like this:
<cloud domain="SITE" port="80" path="/main/rsscloud/request_notify" <cloud domain="SITE" port="80" path="/main/rsscloud/request_notify"
registerProcedure="" protocol="http-post"/> registerProcedure="" protocol="http-post"/>
Aggregators may subscribe by sending a proper REST RSSCloud subscription Aggregators may subscribe by sending a proper REST RSSCloud subscription request
request (the optional 'domain' parameter with challenge is supported). (the optional 'domain' parameter with challenge is supported). Subscribing
Subscribing aggregators will be notified ('pinged') when users they have aggregators will be notified ('pinged') when users they have subscribed to post
subscribed to post new notices. Currently, REST is the only protocol new notices. Currently, REST is the only protocol supported for notifications.
supported for notifications.
Deamon Deamon
------ ------
There's also a daemon for offline processing of queued notices with There's also a daemon for offline processing of queued notices with RSSCloud
RSSCloud destinations, which will start automatically if/when you run destinations, which will start automatically if/when you run
scripts/startdaemons.sh. scripts/startdaemons.sh.
Notes Notes
----- -----
- Again, only RSS 2.0 profile feeds may be subscribed to, and they have - Again, only RSS 2.0 profile feeds may be subscribed to, and they have to be
to be the ones with user names in them, like: the ones with user names in them, like:
http://SITE/PATH/api/statuses/user_timeline/USERNAME.rss http://SITE/PATH/api/statuses/user_timeline/USERNAME.rss
- Subscriptions are deleted after three notification failures in a row - Subscriptions are deleted after three notification failures in a row (not sure
(not sure this is optimal). this is optimal).
- The plugin includes a dummy LoggingAggregator class that can be used - The plugin includes a dummy LoggingAggregator class that can be used for
for end-to-end testing. You probably don't want to mess with it. end-to-end testing. You probably don't want to mess with it.
TODO TODO
---- ----

View File

@ -40,7 +40,7 @@ if (!defined('STATUSNET')) {
* @author Zach Copley <zach@status.net> * @author Zach Copley <zach@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/ * @link http://status.net/
**/ */
class RSSCloudNotifier class RSSCloudNotifier
{ {
const MAX_FAILURES = 3; const MAX_FAILURES = 3;
@ -76,7 +76,6 @@ class RSSCloudNotifier
$body = $response->getBody(); $body = $response->getBody();
if ($status >= 200 && $status < 300) { if ($status >= 200 && $status < 300) {
// NOTE: the spec says that the body must contain the string // NOTE: the spec says that the body must contain the string
// challenge. It doesn't say that the body must contain the // challenge. It doesn't say that the body must contain the
// challenge string ONLY, although that seems to be the way // challenge string ONLY, although that seems to be the way
@ -113,7 +112,6 @@ class RSSCloudNotifier
*/ */
function postUpdate($endpoint, $feed) function postUpdate($endpoint, $feed)
{ {
$headers = array(); $headers = array();
$postdata = array('url' => $feed); $postdata = array('url' => $feed);
@ -210,9 +208,7 @@ class RSSCloudNotifier
common_log_db_error($cloudSub, 'DELETE', __FILE__); common_log_db_error($cloudSub, 'DELETE', __FILE__);
common_log(LOG_ERR, 'Could not delete RSSCloud subscription.'); common_log(LOG_ERR, 'Could not delete RSSCloud subscription.');
} }
} else { } else {
common_debug('Updating failure count on RSSCloud subscription. ' . common_debug('Updating failure count on RSSCloud subscription. ' .
$failCnt); $failCnt);

View File

@ -41,8 +41,7 @@ define('RSSCLOUDPLUGIN_VERSION', '0.1');
* @author Zach Copley <zach@status.net> * @author Zach Copley <zach@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/ * @link http://status.net/
**/ */
class RSSCloudPlugin extends Plugin class RSSCloudPlugin extends Plugin
{ {
/** /**
@ -61,7 +60,6 @@ class RSSCloudPlugin extends Plugin
* *
* @return void * @return void
*/ */
function onInitializePlugin() function onInitializePlugin()
{ {
$this->domain = common_config('rsscloud', 'domain'); $this->domain = common_config('rsscloud', 'domain');
@ -104,7 +102,6 @@ class RSSCloudPlugin extends Plugin
* *
* @return boolean hook return * @return boolean hook return
*/ */
function onRouterInitialized($m) function onRouterInitialized($m)
{ {
$m->connect('/main/rsscloud/request_notify', $m->connect('/main/rsscloud/request_notify',
@ -127,7 +124,6 @@ class RSSCloudPlugin extends Plugin
* @return boolean hook return * @return boolean hook return
* *
*/ */
function onAutoload($cls) function onAutoload($cls)
{ {
switch ($cls) switch ($cls)
@ -159,7 +155,6 @@ class RSSCloudPlugin extends Plugin
* *
* @return void * @return void
*/ */
function onStartApiRss($action) function onStartApiRss($action)
{ {
if (get_class($action) == 'ApiTimelineUserAction') { if (get_class($action) == 'ApiTimelineUserAction') {
@ -242,11 +237,11 @@ class RSSCloudPlugin extends Plugin
'author' => 'Zach Copley', 'author' => 'Zach Copley',
'homepage' => 'http://status.net/wiki/Plugin:RSSCloud', 'homepage' => 'http://status.net/wiki/Plugin:RSSCloud',
'rawdescription' => 'rawdescription' =>
// TRANS: Plugin description.
_m('The RSSCloud plugin enables your StatusNet instance to publish ' . _m('The RSSCloud plugin enables your StatusNet instance to publish ' .
'real-time updates for profile RSS feeds using the ' . 'real-time updates for profile RSS feeds using the ' .
'<a href="http://rsscloud.org/">RSSCloud protocol</a>.')); '<a href="http://rsscloud.org/">RSSCloud protocol</a>.'));
return true; return true;
} }
} }

View File

@ -40,7 +40,7 @@ if (!defined('STATUSNET')) {
* @author Zach Copley <zach@status.net> * @author Zach Copley <zach@status.net>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/ * @link http://status.net/
**/ */
class RSSCloudRequestNotifyAction extends Action class RSSCloudRequestNotifyAction extends Action
{ {
/** /**
@ -87,6 +87,7 @@ class RSSCloudRequestNotifyAction extends Action
parent::handle($args); parent::handle($args);
if ($_SERVER['REQUEST_METHOD'] != 'POST') { if ($_SERVER['REQUEST_METHOD'] != 'POST') {
// TRANS: Form validation error displayed when POST is not used.
$this->showResult(false, _m('Request must be POST.')); $this->showResult(false, _m('Request must be POST.'));
return; return;
} }
@ -104,7 +105,8 @@ class RSSCloudRequestNotifyAction extends Action
if (empty($this->protocol)) { if (empty($this->protocol)) {
$missing[] = 'protocol'; $missing[] = 'protocol';
} else if (strtolower($this->protocol) != 'http-post') { } else if (strtolower($this->protocol) != 'http-post') {
$msg = _m('Only http-post notifications are supported at this time.'); // TRANS: Form validation error displayed when HTTP POST is not used.
$msg = _m('Only HTTP POST notifications are supported at this time.');
$this->showResult(false, $msg); $this->showResult(false, $msg);
return; return;
} }
@ -114,14 +116,18 @@ class RSSCloudRequestNotifyAction extends Action
} }
if (!empty($missing)) { if (!empty($missing)) {
// TRANS: %s is a comma separated list of parameters. // TRANS: List separator.
$msg = sprintf(_m('The following parameters were missing from the request body: %s.'),implode(', ', $missing)); $separator = _m('SEPARATOR',', ');
// TRANS: Form validation error displayed when a request body is missing expected parameters.
// TRANS: %s is a list of parameters separated by a list separator (default: ", ").
$msg = sprintf(_m('The following parameters were missing from the request body: %s.'),implode($separator, $missing));
$this->showResult(false, $msg); $this->showResult(false, $msg);
return; return;
} }
if (empty($this->feeds)) { if (empty($this->feeds)) {
$msg = _m('You must provide at least one valid profile feed url ' . // TRANS: Form validation error displayed when not providing any valid profile feed URLs.
$msg = _m('You must provide at least one valid profile feed URL ' .
'(url1, url2, url3 ... urlN).'); '(url1, url2, url3 ... urlN).');
$this->showResult(false, $msg); $this->showResult(false, $msg);
return; return;
@ -131,21 +137,21 @@ class RSSCloudRequestNotifyAction extends Action
// We only return one success or failure no matter how // We only return one success or failure no matter how
// many feeds the subscriber is trying to subscribe to // many feeds the subscriber is trying to subscribe to
foreach ($this->feeds as $feed) { foreach ($this->feeds as $feed) {
if (!$this->validateFeed($feed)) { if (!$this->validateFeed($feed)) {
$nh = $this->getNotifyUrl(); $nh = $this->getNotifyUrl();
common_log(LOG_WARNING, common_log(LOG_WARNING,
"RSSCloud plugin - $nh tried to subscribe to invalid feed: $feed"); "RSSCloud plugin - $nh tried to subscribe to invalid feed: $feed");
// TRANS: Form validation error displayed when not providing a valid feed URL.
$msg = _m('Feed subscription failed: Not a valid feed.'); $msg = _m('Feed subscription failed: Not a valid feed.');
$this->showResult(false, $msg); $this->showResult(false, $msg);
return; return;
} }
if (!$this->testNotificationHandler($feed)) { if (!$this->testNotificationHandler($feed)) {
$msg = _m('Feed subscription failed - ' . // TRANS: Form validation error displayed when feed subscription failed.
'notification handler doesn\'t respond correctly.'); $msg = _m('Feed subscription failed: ' .
'Notification handler does not respond correctly.');
$this->showResult(false, $msg); $this->showResult(false, $msg);
return; return;
} }
@ -158,6 +164,7 @@ class RSSCloudRequestNotifyAction extends Action
// XXX: What to do about deleting stale subscriptions? // XXX: What to do about deleting stale subscriptions?
// 25 hours seems harsh. WordPress doesn't ever remove // 25 hours seems harsh. WordPress doesn't ever remove
// subscriptions. // subscriptions.
// TRANS: Success message after subscribing to one or more feeds.
$msg = _m('Thanks for the subscription. ' . $msg = _m('Thanks for the subscription. ' .
'When the feed(s) update(s), you will be notified.'); 'When the feed(s) update(s), you will be notified.');
@ -222,7 +229,6 @@ class RSSCloudRequestNotifyAction extends Action
'RSSCloud plugin - Testing notification handler with challenge: ' . 'RSSCloud plugin - Testing notification handler with challenge: ' .
$notifyUrl); $notifyUrl);
return $notifier->challenge($notifyUrl, $feed); return $notifier->challenge($notifyUrl, $feed);
} else { } else {
common_log(LOG_INFO, 'RSSCloud plugin - Testing notification handler: ' . common_log(LOG_INFO, 'RSSCloud plugin - Testing notification handler: ' .
$notifyUrl); $notifyUrl);
@ -291,7 +297,6 @@ class RSSCloudRequestNotifyAction extends Action
common_log(LOG_INFO, "RSSCloud plugin - $notifyUrl refreshed subscription" . common_log(LOG_INFO, "RSSCloud plugin - $notifyUrl refreshed subscription" .
" to user $user->nickname (id: $user->id)."); " to user $user->nickname (id: $user->id).");
} else { } else {
$sub = new RSSCloudSubscription(); $sub = new RSSCloudSubscription();
$sub->subscribed = $user->id; $sub->subscribed = $user->id;