* update/add translator documentation.

* fix L10n issues.
* update comments and tag missing documentation on some classes.
* remove superfluous whitespace
*
This commit is contained in:
Siebrand Mazeland 2011-01-31 16:39:54 +01:00
parent 3fc323f8f9
commit 8f776ec12d
10 changed files with 63 additions and 58 deletions

View File

@ -48,7 +48,6 @@ require_once INSTALLDIR.'/lib/omb.php';
*/
class FinishremotesubscribeAction extends Action
{
/**
* Class handler.
*
@ -56,7 +55,7 @@ class FinishremotesubscribeAction extends Action
*
* @return nothing
*
**/
*/
function handle($args)
{
parent::handle($args);
@ -66,6 +65,7 @@ class FinishremotesubscribeAction extends Action
$service = unserialize($_SESSION['oauth_authorization_request']);
if (!$service) {
// TRANS: Client error displayed when subscribing to a remote profile and an unexpected response is received.
$this->clientError(_('Not expecting this response!'));
return;
}
@ -77,6 +77,7 @@ class FinishremotesubscribeAction extends Action
$user = User::staticGet('uri', $service->getListeneeURI());
if (!$user) {
// TRANS: Client error displayed when subscribing to a remote profile that does not exist.
$this->clientError(_('User being listened to does not exist.'));
return;
}
@ -84,6 +85,7 @@ class FinishremotesubscribeAction extends Action
$other = User::staticGet('uri', $service->getListenerURI());
if ($other) {
// TRANS: Client error displayed when subscribing to a remote profile that is a local profile.
$this->clientError(_('You can use the local subscription!'));
return;
}
@ -96,6 +98,7 @@ class FinishremotesubscribeAction extends Action
$profile = Profile::staticGet($remote->id);
if ($user->hasBlocked($profile)) {
// TRANS: Client error displayed when subscribing to a remote profile that is blocked form subscribing to.
$this->clientError(_('That user has blocked you from subscribing.'));
return;
}
@ -107,14 +110,17 @@ class FinishremotesubscribeAction extends Action
} catch (OAuthException $e) {
if ($e->getMessage() == 'The authorized token does not equal the ' .
'submitted token.') {
// TRANS: Client error displayed when subscribing to a remote profile without providing an authorised token.
$this->clientError(_('You are not authorized.'));
return;
} else {
// TRANS: Client error displayed when subscribing to a remote profile and conversion of the request token to access token fails.
$this->clientError(_('Could not convert request token to ' .
'access token.'));
return;
}
} catch (OMB_RemoteServiceException $e) {
// TRANS: Client error displayed when subscribing to a remote profile fails because of an unsupported version of the OMB protocol.
$this->clientError(_('Remote service uses unknown version of ' .
'OMB protocol.'));
return;
@ -135,6 +141,7 @@ class FinishremotesubscribeAction extends Action
$service->getServiceURI(OMB_ENDPOINT_UPDATEPROFILE);
if (!$remote->update($orig_remote)) {
// TRANS: Server error displayed when subscribing to a remote profile fails because the remote profile could not be updated.
$this->serverError(_('Error updating remote profile.'));
return;
}

View File

@ -23,6 +23,7 @@ define('LISTENER', 1);
define('LISTENEE', -1);
define('BOTH', 0);
// @todo XXX: Documentation missing.
class FoafAction extends Action
{
function isReadOnly($args)
@ -37,6 +38,7 @@ class FoafAction extends Action
$nickname_arg = $this->arg('nickname');
if (empty($nickname_arg)) {
// TRANS: Client error displayed when requesting Friends of a Friend feed without providing a user nickname.
$this->clientError(_('No such user.'), 404);
return false;
}
@ -55,6 +57,7 @@ class FoafAction extends Action
$this->user = User::staticGet('nickname', $this->nickname);
if (!$this->user) {
// TRANS: Client error displayed when requesting Friends of a Friend feed for an object that is not a user.
$this->clientError(_('No such user.'), 404);
return false;
}
@ -62,6 +65,7 @@ class FoafAction extends Action
$this->profile = $this->user->getProfile();
if (!$this->profile) {
// TRANS: Server error displayed when requesting Friends of a Friend feed for a user for which the profile could not be found.
$this->serverError(_('User has no profile.'), 500);
return false;
}
@ -110,7 +114,7 @@ class FoafAction extends Action
if ($this->profile->bio) {
$this->element('bio:olb', null, $this->profile->bio);
}
$location = $this->profile->getLocation();
if ($location) {
$attr = array();
@ -118,7 +122,7 @@ class FoafAction extends Action
$attr['rdf:about'] = $location->getRdfURL();
}
$location_name = $location->getName();
$this->elementStart('based_near');
$this->elementStart('geo:SpatialThing', $attr);
if ($location_name) {
@ -193,7 +197,7 @@ class FoafAction extends Action
$this->element('knows', array('rdf:resource' => $uri));
}
}
$this->elementEnd('Agent');
@ -239,18 +243,17 @@ class FoafAction extends Action
/**
* Output FOAF <account> bit for the given profile.
*
*
* @param Profile $profile
* @param mixed $service Root URL of this StatusNet instance for a local
* user, otherwise null.
* @param mixed $useruri URI string for the referenced profile..
* @param boolean $fetchSubscriptions Should we load and list all their subscriptions?
* @param boolean $isSubscriber if not fetching subs, we can still mark the user as following the current page.
*
*
* @return array if $fetchSubscribers is set, return a list of info on those
* subscriptions.
*/
function showMicrobloggingAccount($profile, $service=null, $useruri=null, $fetchSubscriptions=false, $isSubscriber=false)
{
$attr = array();

View File

@ -27,6 +27,7 @@
if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
// @todo XXX: Documentation missing.
class FoafGroupAction extends Action
{
function isReadOnly($args)
@ -41,6 +42,7 @@ class FoafGroupAction extends Action
$nickname_arg = $this->arg('nickname');
if (empty($nickname_arg)) {
// TRANS: Client error displayed when requesting Friends of a Friend feed without providing a group nickname.
$this->clientError(_('No such group.'), 404);
return false;
}
@ -59,6 +61,7 @@ class FoafGroupAction extends Action
$local = Local_group::staticGet('nickname', $this->nickname);
if (!$local) {
// TRANS: Client error displayed when requesting Friends of a Friend feed for a non-local group.
$this->clientError(_('No such group.'), 404);
return false;
}
@ -66,6 +69,7 @@ class FoafGroupAction extends Action
$this->group = User_group::staticGet('id', $local->group_id);
if (!$this->group) {
// TRANS: Client error displayed when requesting Friends of a Friend feed for a nickname that is not a group.
$this->clientError(_('No such group.'), 404);
return false;
}

View File

@ -68,7 +68,7 @@ class GeocodeAction extends Action
*
* @return nothing
*
**/
*/
function handle($args)
{
header('Content-Type: application/json; charset=utf-8');
@ -89,7 +89,6 @@ class GeocodeAction extends Action
*
* @return boolean true
*/
function isReadOnly($args)
{
return true;

View File

@ -47,13 +47,11 @@ require_once 'MIME/Type.php';
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/
*/
class GetfileAction extends Action
{
/**
* Path of file to return
*/
var $path = null;
/**
@ -63,7 +61,6 @@ class GetfileAction extends Action
*
* @return success flag
*/
function prepare($args)
{
parent::prepare($args);
@ -76,10 +73,12 @@ class GetfileAction extends Action
}
if (empty($path) or !file_exists($path)) {
// TRANS: Client error displayed when requesting a non-existent file.
$this->clientError(_('No such file.'), 404);
return false;
}
if (!is_readable($path)) {
// TRANS: Client error displayed when requesting a file without having read access to it.
$this->clientError(_('Cannot read file.'), 403);
return false;
}
@ -93,7 +92,6 @@ class GetfileAction extends Action
*
* @return boolean true
*/
function isReadOnly($args)
{
return true;
@ -104,7 +102,6 @@ class GetfileAction extends Action
*
* @return int last-modified date as unix timestamp
*/
function lastModified()
{
if (common_config('site', 'use_x_sendfile')) {
@ -122,7 +119,6 @@ class GetfileAction extends Action
*
* @return string etag http header
*/
function etag()
{
if (common_config('site', 'use_x_sendfile')) {
@ -151,7 +147,6 @@ class GetfileAction extends Action
*
* @return void
*/
function handle($args)
{
// undo headers set by PHP sessions

View File

@ -2,7 +2,7 @@
/**
* StatusNet, the distributed open-source microblogging tool
*
* Action class to sandbox an abusive user
* Action class to grant user roles.
*
* PHP version 5
*
@ -32,7 +32,7 @@ if (!defined('STATUSNET')) {
}
/**
* Sandbox a user.
* Assign role to user.
*
* @category Action
* @package StatusNet
@ -40,7 +40,6 @@ if (!defined('STATUSNET')) {
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
* @link http://status.net/
*/
class GrantRoleAction extends ProfileFormAction
{
/**
@ -50,19 +49,20 @@ class GrantRoleAction extends ProfileFormAction
*
* @return boolean success flag
*/
function prepare($args)
{
if (!parent::prepare($args)) {
return false;
}
$this->role = $this->arg('role');
if (!Profile_role::isValid($this->role)) {
// TRANS: Client error displayed when trying to assign an invalid role to a user.
$this->clientError(_('Invalid role.'));
return false;
}
if (!Profile_role::isSettable($this->role)) {
// TRANS: Client error displayed when trying to assign an reserved role to a user.
$this->clientError(_('This role is reserved and cannot be set.'));
return false;
}
@ -72,6 +72,7 @@ class GrantRoleAction extends ProfileFormAction
assert(!empty($cur)); // checked by parent
if (!$cur->hasRight(Right::GRANTROLE)) {
// TRANS: Client error displayed when trying to assign a role to a user while not being allowed to set roles.
$this->clientError(_('You cannot grant user roles on this site.'));
return false;
}
@ -79,6 +80,7 @@ class GrantRoleAction extends ProfileFormAction
assert(!empty($this->profile)); // checked by parent
if ($this->profile->hasRole($this->role)) {
// TRANS: Client error displayed when trying to assign a role to a user that already has that role.
$this->clientError(_('User already has this role.'));
return false;
}
@ -91,7 +93,6 @@ class GrantRoleAction extends ProfileFormAction
*
* @return void
*/
function handlePost()
{
$this->profile->grantRole($this->role);

View File

@ -40,7 +40,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
* @link http://status.net/
*/
class GroupblockAction extends RedirectingAction
{
var $profile = null;
@ -53,11 +52,11 @@ class GroupblockAction extends RedirectingAction
*
* @return boolean success flag
*/
function prepare($args)
{
parent::prepare($args);
if (!common_logged_in()) {
// TRANS: Client error displayed trying to block a user from a group while not logged in.
$this->clientError(_('Not logged in.'));
return false;
}
@ -68,35 +67,42 @@ class GroupblockAction extends RedirectingAction
}
$id = $this->trimmed('blockto');
if (empty($id)) {
// TRANS: Client error displayed trying to block a user from a group while not specifying a to be blocked user profile.
$this->clientError(_('No profile specified.'));
return false;
}
$this->profile = Profile::staticGet('id', $id);
if (empty($this->profile)) {
// TRANS: Client error displayed trying to block a user from a group while specifying a non-existing profile.
$this->clientError(_('No profile with that ID.'));
return false;
}
$group_id = $this->trimmed('blockgroup');
if (empty($group_id)) {
// TRANS: Client error displayed trying to block a user from a group while not specifying a group to block a profile from.
$this->clientError(_('No group specified.'));
return false;
}
$this->group = User_group::staticGet('id', $group_id);
if (empty($this->group)) {
// TRANS: Client error displayed trying to block a user from a group while specifying a non-existing group.
$this->clientError(_('No such group.'));
return false;
}
$user = common_current_user();
if (!$user->isAdmin($this->group)) {
// TRANS: Client error displayed trying to block a user from a group while not being an admin user.
$this->clientError(_('Only an admin can block group members.'), 401);
return false;
}
if (Group_block::isBlocked($this->group, $this->profile)) {
// TRANS: Client error displayed trying to block a user from a group while user is already blocked from the given group.
$this->clientError(_('User is already blocked from group.'));
return false;
}
// XXX: could have proactive blocks, but we don't have UI for it.
if (!$this->profile->isMember($this->group)) {
// TRANS: Client error displayed trying to block a user from a group while user is not a member of given group.
$this->clientError(_('User is not a member of group.'));
return false;
}
@ -131,6 +137,7 @@ class GroupblockAction extends RedirectingAction
}
function title() {
// TRANS: Title for block user from group page.
return _('Block user from group');
}
@ -145,7 +152,6 @@ class GroupblockAction extends RedirectingAction
*
* @return void
*/
function areYouSureForm()
{
$id = $this->profile->id;
@ -155,8 +161,11 @@ class GroupblockAction extends RedirectingAction
'action' => common_local_url('groupblock')));
$this->elementStart('fieldset');
$this->hidden('token', common_session_token());
// TRANS: Fieldset legend for block user from group form.
$this->element('legend', _('Block user'));
$this->element('p', null,
// TRANS: Explanatory text for block user from group form before setting the block.
// TRANS: %1$s is that to be blocked user, %2$s is the group the user will be blocked from.
sprintf(_('Are you sure you want to block user "%1$s" from the group "%2$s"? '.
'They will be removed from the group, unable to post, and '.
'unable to subscribe to the group in the future.'),
@ -196,24 +205,24 @@ class GroupblockAction extends RedirectingAction
*
* @return void
*/
function blockProfile()
{
$block = Group_block::blockProfile($this->group, $this->profile,
common_current_user());
if (empty($block)) {
// TRANS: Server error displayed when trying to block a user from a group fails because of an application error.
$this->serverError(_("Database error blocking user from group."));
return false;
}
$this->returnToPrevious();
}
/**
* If we reached this form without returnto arguments, default to
* the top of the group's member list.
*
*
* @return string URL
*/
function defaultReturnTo()
@ -227,6 +236,4 @@ class GroupblockAction extends RedirectingAction
parent::showScripts();
$this->autofocus('form_action-yes');
}
}

View File

@ -47,7 +47,6 @@ require_once INSTALLDIR.'/lib/feedlist.php';
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class GroupbyidAction extends Action
{
/** group we're viewing. */
@ -58,7 +57,6 @@ class GroupbyidAction extends Action
*
* @return boolean true
*/
function isReadOnly($args)
{
return true;
@ -71,6 +69,7 @@ class GroupbyidAction extends Action
$id = $this->arg('id');
if (!$id) {
// TRANS: Client error displayed referring to a group's permalink without providing a group ID.
$this->clientError(_('No ID.'));
return false;
}
@ -80,6 +79,7 @@ class GroupbyidAction extends Action
$this->group = User_group::staticGet('id', $id);
if (!$this->group) {
// TRANS: Client error displayed referring to a group's permalink for a non-existing group ID.
$this->clientError(_('No such group.'), 404);
return false;
}
@ -95,9 +95,8 @@ class GroupbyidAction extends Action
*
* @return void
*/
function handle($args)
{
common_redirect($this->group->homeUrl(), 303);
}
}
}

View File

@ -2,7 +2,7 @@
/**
* StatusNet, the distributed open-source microblogging tool
*
* Change user password
* Saves a design for a given group.
*
* PHP version 5
*
@ -46,7 +46,6 @@ require_once INSTALLDIR . '/lib/designsettings.php';
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class GroupDesignSettingsAction extends DesignSettingsAction
{
var $group = null;
@ -59,12 +58,12 @@ class GroupDesignSettingsAction extends DesignSettingsAction
*
* @return boolean true
*/
function prepare($args)
{
parent::prepare($args);
if (!common_logged_in()) {
// TRANS: Client error displayed trying to change group design settings while not logged in.
$this->clientError(_('You must be logged in to edit a group.'));
return false;
}
@ -81,6 +80,7 @@ class GroupDesignSettingsAction extends DesignSettingsAction
}
if (!$nickname) {
// TRANS: Client error displayed trying to change group design settings without providing a group nickname.
$this->clientError(_('No nickname.'), 404);
return false;
}
@ -97,6 +97,7 @@ class GroupDesignSettingsAction extends DesignSettingsAction
}
if (!$this->group) {
// TRANS: Client error displayed trying to change group design settings while providing a nickname for a non-existing group.
$this->clientError(_('No such group.'), 404);
return false;
}
@ -104,6 +105,7 @@ class GroupDesignSettingsAction extends DesignSettingsAction
$cur = common_current_user();
if (!$cur->isAdmin($this->group)) {
// TRANS: Client error displayed trying to change group design settings without being a (group) admin.
$this->clientError(_('You must be an admin to edit the group.'), 403);
return false;
}
@ -122,7 +124,6 @@ class GroupDesignSettingsAction extends DesignSettingsAction
*
* @return Design a design object to use
*/
function getDesign()
{
@ -141,6 +142,7 @@ class GroupDesignSettingsAction extends DesignSettingsAction
function title()
{
// TRANS: Title group design settings page.
return _('Group design');
}
@ -149,9 +151,9 @@ class GroupDesignSettingsAction extends DesignSettingsAction
*
* @return instructions for use
*/
function getInstructions()
{
// TRANS: Instructions for group design settings page.
return _('Customize the way your group looks ' .
'with a background image and a colour palette of your choice.');
}
@ -161,7 +163,6 @@ class GroupDesignSettingsAction extends DesignSettingsAction
*
* @return nothing
*/
function showLocalNav()
{
$nav = new GroupNav($this, $this->group);
@ -173,7 +174,6 @@ class GroupDesignSettingsAction extends DesignSettingsAction
*
* @return Design
*/
function getWorkingDesign()
{
$design = null;
@ -192,7 +192,6 @@ class GroupDesignSettingsAction extends DesignSettingsAction
*
* @return void
*/
function showContent()
{
$design = $this->getWorkingDesign();
@ -209,17 +208,14 @@ class GroupDesignSettingsAction extends DesignSettingsAction
*
* @return void
*/
function saveDesign()
{
try {
$bgcolor = new WebColor($this->trimmed('design_background'));
$ccolor = new WebColor($this->trimmed('design_content'));
$sbcolor = new WebColor($this->trimmed('design_sidebar'));
$tcolor = new WebColor($this->trimmed('design_text'));
$lcolor = new WebColor($this->trimmed('design_links'));
} catch (WebColorException $e) {
$this->showForm($e->getMessage());
return;
@ -246,7 +242,6 @@ class GroupDesignSettingsAction extends DesignSettingsAction
$design = $this->group->getDesign();
if (!empty($design)) {
// update design
$original = clone($design);
@ -263,12 +258,11 @@ class GroupDesignSettingsAction extends DesignSettingsAction
if ($result === false) {
common_log_db_error($design, 'UPDATE', __FILE__);
$this->showForm(_('Could not update your design.'));
// TRANS: Form validation error displayed when group design settings could not be updated because of an application issue.
$this->showForm(_('Unable to update your design settings.'));
return;
}
} else {
$this->group->query('BEGIN');
// save new design
@ -287,6 +281,7 @@ class GroupDesignSettingsAction extends DesignSettingsAction
if (empty($id)) {
common_log_db_error($id, 'INSERT', __FILE__);
// TRANS: Form validation error displayed when group design settings could not be saved because of an application issue.
$this->showForm(_('Unable to save your design settings.'));
return;
}
@ -297,18 +292,18 @@ class GroupDesignSettingsAction extends DesignSettingsAction
if (empty($result)) {
common_log_db_error($original, 'UPDATE', __FILE__);
// TRANS: Form validation error displayed when group design settings could not be saved because of an application issue.
$this->showForm(_('Unable to save your design settings.'));
$this->group->query('ROLLBACK');
return;
}
$this->group->query('COMMIT');
}
$this->saveBackgroundImage($design);
// TRANS: Form text to confirm saved group design settings.
$this->showForm(_('Design preferences saved.'), true);
}
}

View File

@ -60,7 +60,6 @@ class GrouplogoAction extends GroupDesignAction
/**
* Prepare to run
*/
function prepare($args)
{
parent::prepare($args);
@ -83,7 +82,7 @@ class GrouplogoAction extends GroupDesignAction
}
if (!$nickname) {
// TRANS: Client error displayed when trying to change group logo settings without having a nickname.
// TRANS: Client error displayed when trying to change group logo settings without providing a nickname.
$this->clientError(_('No nickname.'), 404);
return false;
}
@ -247,7 +246,6 @@ class GrouplogoAction extends GroupDesignAction
$this->elementEnd('fieldset');
$this->elementEnd('form');
}
function showCropForm()
@ -304,7 +302,6 @@ class GrouplogoAction extends GroupDesignAction
$this->elementEnd('ul');
$this->elementEnd('fieldset');
$this->elementEnd('form');
}
/**
@ -438,7 +435,6 @@ class GrouplogoAction extends GroupDesignAction
*
* @return void
*/
function showStylesheets()
{
parent::showStylesheets();
@ -450,7 +446,6 @@ class GrouplogoAction extends GroupDesignAction
*
* @return void
*/
function showScripts()
{
parent::showScripts();