From: Siebrand Mazeland Date: Wed, 20 Oct 2010 17:34:27 +0000 (+0200) Subject: * i18n/L10n fixes. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=dc62cf1c0b6f77ebd4e4bf885aa3de7846b3232a;p=quix0rs-gnu-social.git * i18n/L10n fixes. * translator documentation updated/added. * superfluous whitespace removed. --- diff --git a/actions/apioauthaccesstoken.php b/actions/apioauthaccesstoken.php index 21e0049cec..59abcf8120 100644 --- a/actions/apioauthaccesstoken.php +++ b/actions/apioauthaccesstoken.php @@ -44,7 +44,6 @@ require_once INSTALLDIR . '/lib/apioauth.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 ApiOauthAccessTokenAction extends ApiOauthAction { protected $reqToken = null; @@ -73,7 +72,6 @@ class ApiOauthAccessTokenAction extends ApiOauthAction // Spec doesn't say they MUST be. try { - $req = OAuthRequest::from_request(); $this->reqToken = $req->get_parameter('oauth_token'); @@ -100,6 +98,7 @@ class ApiOauthAccessTokenAction extends ApiOauthAction ); common_log(LOG_WARNING, $msg); + // TRANS: Client error given from the OAuth API when the request token or verifier is invalid. $this->clientError(_("Invalid request token or verifier.", 400, 'text')); } else { diff --git a/actions/apioauthauthorize.php b/actions/apioauthauthorize.php index 01cbca18f7..0e61cdf2c9 100644 --- a/actions/apioauthauthorize.php +++ b/actions/apioauthauthorize.php @@ -43,7 +43,6 @@ require_once INSTALLDIR . '/lib/info.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 ApiOauthAuthorizeAction extends Action { var $oauthTokenParam; @@ -106,6 +105,7 @@ class ApiOauthAuthorizeAction extends Action // Make sure a oauth_token parameter was provided if (empty($this->oauthTokenParam)) { + // TRANS: Client error given when no oauth_token was passed to the OAuth API. $this->clientError(_('No oauth_token parameter provided.')); } else { @@ -113,11 +113,13 @@ class ApiOauthAuthorizeAction extends Action $this->reqToken = $this->store->getTokenByKey($this->oauthTokenParam); if (empty($this->reqToken)) { + // TRANS: Client error given when an invalid request token was passed to the OAuth API. $this->clientError(_('Invalid request token.')); } else { // Check to make sure we haven't already authorized the token if ($this->reqToken->state != 0) { + // TRANS: Client error given when an invalid request token was passed to the OAuth API. $this->clientError(_("Invalid request token.")); } } @@ -125,6 +127,7 @@ class ApiOauthAuthorizeAction extends Action // make sure there's an app associated with this token if (empty($this->app)) { + // TRANS: Client error given when an invalid request token was passed to the OAuth API. $this->clientError(_('Invalid request token.')); } @@ -158,6 +161,7 @@ class ApiOauthAuthorizeAction extends Action $user = common_check_user($this->nickname, $this->password); if (empty($user)) { + // TRANS: Form validation error given when an invalid username and/or password was passed to the OAuth API. $this->showForm(_("Invalid nickname / password!")); return; } @@ -198,6 +202,7 @@ class ApiOauthAuthorizeAction extends Action if (!$result) { common_log_db_error($appUser, 'INSERT', __FILE__); + // TRANS: Server error given when a database error occurs inserting an OAuth application user. $this->serverError(_('Database error inserting OAuth application user.')); } @@ -211,7 +216,6 @@ class ApiOauthAuthorizeAction extends Action } if (!empty($this->callback)) { - $targetUrl = $this->getCallback( $this->callback, array( @@ -222,9 +226,7 @@ class ApiOauthAuthorizeAction extends Action // Redirect the user to the provided OAuth callback common_redirect($targetUrl, 303); - } elseif ($this->app->type == 2) { - // Strangely, a web application seems to want to do the OOB // workflow. Because no callback was specified anywhere. common_log( @@ -261,6 +263,7 @@ class ApiOauthAuthorizeAction extends Action } } else { + // TRANS: Client error given on when invalid data was passed through a form in the OAuth API. $this->clientError(_('Unexpected form submission.')); } } @@ -287,6 +290,7 @@ class ApiOauthAuthorizeAction extends Action function title() { + // TRANS: Title for a page where a user can confirm/deny account access by an external application. return _('An application would like to connect to your account'); } @@ -304,6 +308,7 @@ class ApiOauthAuthorizeAction extends Action 'action' => common_local_url('ApiOauthAuthorize'))); $this->elementStart('fieldset'); $this->element('legend', array('id' => 'apioauthauthorize_allowdeny'), + // TRANS: Fieldset legend. _('Allow or deny access')); $this->hidden('token', common_session_token()); @@ -320,6 +325,9 @@ class ApiOauthAuthorizeAction extends Action $access = ($this->app->access_type & Oauth_application::$writeAccess) ? 'access and update' : 'access'; + // TRANS: User notification of external application requesting account access. + // TRANS: %1$s is the application name requesting access, %2$s is the organisation behind the application, + // TRANS: %3$s is the access type requested, %4$s is the StatusNet sitename. $msg = _('The application %1$s by ' . '%2$s would like the ability ' . 'to %3$s your %4$s account data. ' . @@ -336,33 +344,37 @@ class ApiOauthAuthorizeAction extends Action $this->elementEnd('ul'); if (!common_logged_in()) { - $this->elementStart('fieldset'); - $this->element('legend', null, _('Account')); + // TRANS: Fieldset legend. + $this->element('legend', null, _m('LEGEND','Account')); $this->elementStart('ul', 'form_data'); $this->elementStart('li'); + // TRANS: Field label on OAuth API authorisation form. $this->input('nickname', _('Nickname')); $this->elementEnd('li'); $this->elementStart('li'); + // TRANS: Field label on OAuth API authorisation form. $this->password('password', _('Password')); $this->elementEnd('li'); $this->elementEnd('ul'); $this->elementEnd('fieldset'); - } $this->element('input', array('id' => 'cancel_submit', 'class' => 'submit submit form_action-primary', 'name' => 'cancel', 'type' => 'submit', - 'value' => _('Cancel'))); + // TRANS: Button text that when clicked will cancel the process of allowing access to an account + // TRANS: by an external application. + 'value' => _m('BUTTON','Cancel'))); $this->element('input', array('id' => 'allow_submit', 'class' => 'submit submit form_action-secondary', 'name' => 'allow', 'type' => 'submit', - 'value' => _('Allow'))); + // TRANS: Button text that when clicked will allow access to an account by an external application. + 'value' => _m('BUTTON','Allow'))); $this->elementEnd('fieldset'); $this->elementEnd('form'); @@ -376,9 +388,9 @@ class ApiOauthAuthorizeAction extends Action * * @return void */ - function getInstructions() { + // TRANS: Form instructions. return _('Authorize access to your account information.'); } @@ -389,7 +401,6 @@ class ApiOauthAuthorizeAction extends Action * * @return void */ - function showLocalNav() { // NOP @@ -400,7 +411,6 @@ class ApiOauthAuthorizeAction extends Action * * @return nothing */ - function showSiteNotice() { // NOP @@ -413,7 +423,6 @@ class ApiOauthAuthorizeAction extends Action * * @return nothing */ - function showNoticeForm() { // NOP @@ -425,12 +434,14 @@ class ApiOauthAuthorizeAction extends Action * * @return nothing */ - function showCanceled() { $info = new InfoAction( + // TRANS: Header for user notification after revoking OAuth access to an application. _('Authorization canceled.'), sprintf( + // TRANS: User notification after revoking OAuth access to an application. + // TRANS: %s is an OAuth token. _('The request token %s has been revoked.'), $this->oauthTokenParm ) @@ -445,15 +456,18 @@ class ApiOauthAuthorizeAction extends Action * * @return nothing */ - function showAuthorized() { $title = sprintf( + // TRANS: Header of user notification after authorising an application access to a profile. + // TRANS: %s is the authorised application name. _("You have successfully authorized %s."), $this->app->name ); $msg = sprintf( + // TRANS: Uer notification after authorising an application access to a profile. + // TRANS: %s is the authorised application name. _('Please return to %s and enter the following security code to complete the process.'), $this->app->name ); @@ -488,7 +502,6 @@ class ApiOauthAuthorizeAction extends Action * * @return string $url a URL to use for redirecting to */ - function getCallback($url, $params) { foreach ($params as $k => $v) { @@ -512,7 +525,6 @@ class ApiOauthAuthorizeAction extends Action * * @return string $url the new URL with added parameter */ - function appendQueryVar($url, $k, $v) { $url = preg_replace('/(.*)(\?|&)' . $k . '=[^&]+?(&)(.*)/i', '$1$2$4', $url . '&'); $url = substr($url, 0, -1); diff --git a/actions/apistatusesupdate.php b/actions/apistatusesupdate.php index 91dcdd10fc..822ebacbdd 100644 --- a/actions/apistatusesupdate.php +++ b/actions/apistatusesupdate.php @@ -147,7 +147,6 @@ require_once INSTALLDIR . '/lib/mediafile.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 ApiStatusesUpdateAction extends ApiAuthAction { var $status = null; @@ -163,7 +162,6 @@ class ApiStatusesUpdateAction extends ApiAuthAction * @return boolean success flag * */ - function prepare($args) { parent::prepare($args); @@ -187,7 +185,6 @@ class ApiStatusesUpdateAction extends ApiAuthAction * * @return void */ - function handle($args) { parent::handle($args); @@ -209,8 +206,11 @@ class ApiStatusesUpdateAction extends ApiAuthAction && empty($_POST) && ($_SERVER['CONTENT_LENGTH'] > 0) ) { - $msg = _('The server was unable to handle that much POST ' . - 'data (%s bytes) due to its current configuration.'); + // TRANS: Client error displayed when the number of bytes in a POST request exceeds a limit. + // TRANS: %s is the number of bytes of the CONTENT_LENGTH. + $msg = _m('The server was unable to handle that much POST data (%s byte) due to its current configuration.', + 'The server was unable to handle that much POST data (%s bytes) due to its current configuration.', + intval($_SERVER['CONTENT_LENGTH'])); $this->clientError(sprintf($msg, $_SERVER['CONTENT_LENGTH'])); return; @@ -218,6 +218,7 @@ class ApiStatusesUpdateAction extends ApiAuthAction if (empty($this->status)) { $this->clientError( + // TRANS: Client error displayed when the parameter "status" is missing. _('Client must provide a \'status\' parameter with a value.'), 400, $this->format @@ -239,7 +240,11 @@ class ApiStatusesUpdateAction extends ApiAuthAction $this->clientError( sprintf( - _('That\'s too long. Max notice size is %d chars.'), + // TRANS: Client error displayed when the parameter "status" is missing. + // TRANS: %d is the maximum number of character for a notice. + _m('That\'s too long. Maximum notice size is %d character.', + 'That\'s too long. Maximum notice size is %d characters.', + Notice::maxContent()), Notice::maxContent() ), 406, @@ -255,7 +260,6 @@ class ApiStatusesUpdateAction extends ApiAuthAction $cmd = $inter->handle_command($this->auth_user, $status_shortened); if ($cmd) { - if ($this->supported($cmd)) { $cmd->execute(new Channel()); } @@ -265,13 +269,10 @@ class ApiStatusesUpdateAction extends ApiAuthAction // or not! $this->notice = $this->auth_user->getCurrentNotice(); - } else { - $reply_to = null; if (!empty($this->in_reply_to_status_id)) { - // Check whether notice actually exists $reply = Notice::staticGet($this->in_reply_to_status_id); @@ -280,7 +281,8 @@ class ApiStatusesUpdateAction extends ApiAuthAction $reply_to = $this->in_reply_to_status_id; } else { $this->clientError( - _('Not found.'), + // TRANS: Client error displayed when replying to a non-existing notice. + _('Parent notice not found.'), $code = 404, $this->format ); @@ -302,10 +304,9 @@ class ApiStatusesUpdateAction extends ApiAuthAction if (Notice::contentTooLong($status_shortened)) { $upload->delete(); - $msg = _( - 'Max notice size is %d chars, ' . - 'including attachment URL.' - ); + $msg = _m('Maximum notice size is %d character, including attachment URL.', + 'Maximum notice size is %d characters, including attachment URL.', + Notice::maxContent()); $this->clientError( sprintf($msg, Notice::maxContent()), 400, @@ -344,7 +345,6 @@ class ApiStatusesUpdateAction extends ApiAuthAction if (isset($upload)) { $upload->attachToNotice($this->notice); } - } $this->showNotice(); @@ -355,7 +355,6 @@ class ApiStatusesUpdateAction extends ApiAuthAction * * @return void */ - function showNotice() { if (!empty($this->notice)) { @@ -374,7 +373,6 @@ class ApiStatusesUpdateAction extends ApiAuthAction * * @return boolean true or false */ - function supported($cmd) { static $cmdlist = array('MessageCommand', 'SubCommand', 'UnsubCommand', @@ -386,5 +384,4 @@ class ApiStatusesUpdateAction extends ApiAuthAction return false; } - } diff --git a/actions/oauthconnectionssettings.php b/actions/oauthconnectionssettings.php index 0590b729cb..9a7cda924a 100644 --- a/actions/oauthconnectionssettings.php +++ b/actions/oauthconnectionssettings.php @@ -46,10 +46,8 @@ require_once INSTALLDIR . '/lib/apioauthstore.php'; * * @see SettingsAction */ - class OauthconnectionssettingsAction extends ConnectSettingsAction { - var $page = null; var $oauth_token = null; @@ -69,6 +67,7 @@ class OauthconnectionssettingsAction extends ConnectSettingsAction function title() { + // TRANS: Title for OAuth connection settings. return _('Connected applications'); } @@ -80,6 +79,7 @@ class OauthconnectionssettingsAction extends ConnectSettingsAction function getInstructions() { + // TRANS: Instructions for OAuth connection settings. return _('The following connections exist for your account.'); } @@ -129,7 +129,6 @@ class OauthconnectionssettingsAction extends ConnectSettingsAction * * @return void */ - function handlePost() { // CSRF protection @@ -144,6 +143,7 @@ class OauthconnectionssettingsAction extends ConnectSettingsAction if ($this->arg('revoke')) { $this->revokeAccess($this->oauth_token); } else { + // TRANS: Client error when submitting a form with unexpected information. $this->clientError(_('Unexpected form submission.'), 401); return false; } @@ -157,7 +157,6 @@ class OauthconnectionssettingsAction extends ConnectSettingsAction * @param int $appId the ID of the application * */ - function revokeAccess($token) { $cur = common_current_user(); @@ -165,6 +164,7 @@ class OauthconnectionssettingsAction extends ConnectSettingsAction $appUser = Oauth_application_user::getByUserAndToken($cur, $token); if (empty($appUser)) { + // TRANS: Client error when trying to revoke access for an application while not being a user of it. $this->clientError(_('You are not a user of that application.'), 401); return false; } @@ -178,7 +178,9 @@ class OauthconnectionssettingsAction extends ConnectSettingsAction if (!$result) { common_log_db_error($orig, 'DELETE', __FILE__); - $this->clientError(sprintf(_('Unable to revoke access for app: %s.'), $app->id)); + // TRANS: Client error when revoking access has failed for some reason. + // TRANS: %s is the application ID revoking access failed for. + $this->clientError(sprintf(_('Unable to revoke access for application: %s.'), $app->id)); return false; } @@ -195,7 +197,9 @@ class OauthconnectionssettingsAction extends ConnectSettingsAction ); $msg = sprintf( - _('You have successfully revoked access for %s and the access token starting with %s'), + // TRANS: Success message after revoking access for an application. + // TRANS: %1$s is the application name, %2$s is the first part of the user token. + _('You have successfully revoked access for %1$s and the access token starting with %2$s.'), $app->name, substr($appUser->token, 0, 7) ); @@ -205,6 +209,7 @@ class OauthconnectionssettingsAction extends ConnectSettingsAction function showEmptyListMessage() { + // TRANS: Empty list message when no applications have been authorised yet. $message = _('You have not authorized any applications to use your account.'); $this->elementStart('div', 'guide'); @@ -222,6 +227,9 @@ class OauthconnectionssettingsAction extends ConnectSettingsAction $this->elementStart('p'); $devMsg = sprintf( + // TRANS: Note for developers in the OAuth connection settings form. + // TRANS: This message contains a Markdown link. Do not separate "](". + // TRANS: %s is the URL to the OAuth settings. _('Are you a developer? [Register an OAuth client application](%s) to use with this instance of StatusNet.'), common_local_url('oauthappssettings') ); @@ -233,5 +241,4 @@ class OauthconnectionssettingsAction extends ConnectSettingsAction $this->elementEnd('section'); } - } diff --git a/lib/apiauth.php b/lib/apiauth.php index 0ebd7aa105..1dacf1409b 100644 --- a/lib/apiauth.php +++ b/lib/apiauth.php @@ -263,7 +263,7 @@ class ApiAuthAction extends ApiAction // show error if the user clicks 'cancel' // TRANS: Client error thrown when authentication fails becaus a user clicked "Cancel". - $this->clientError(_("Could not authenticate you."), 401, $this->format); + $this->clientError(_('Could not authenticate you.'), 401, $this->format); exit; } else { @@ -290,7 +290,7 @@ class ApiAuthAction extends ApiAction ); $this->logAuthFailure($msg); // TRANS: Client error thrown when authentication fails. - $this->clientError(_("Could not authenticate you."), 401, $this->format); + $this->clientError(_('Could not authenticate you.'), 401, $this->format); exit; } } @@ -342,7 +342,6 @@ class ApiAuthAction extends ApiAction * * @param string $logMsg additional log message */ - function logAuthFailure($logMsg) { list($proxy, $ip) = common_client_ip(); diff --git a/lib/apioauthstore.php b/lib/apioauthstore.php index e30eea129f..76df6c1ed2 100644 --- a/lib/apioauthstore.php +++ b/lib/apioauthstore.php @@ -37,7 +37,8 @@ class ApiStatusNetOAuthDataStore extends StatusNetOAuthDataStore $con->consumer_secret = $consumerKey; $result = $con->insert(); if (!$result) { - $this->serverError(_("Could not create anonymous consumer.")); + // TRANS: Server error displayed when trying to create an anynymous OAuth consumer. + $this->serverError(_('Could not create anonymous consumer.')); } $app = new OAuth_application(); $app->consumer_key = $con->consumer_key; @@ -49,7 +50,8 @@ class ApiStatusNetOAuthDataStore extends StatusNetOAuthDataStore $app->access_type = 3; // read + write $id = $app->insert(); if (!$id) { - $this->serverError(_("Could not create anonymous OAuth application.")); + // TRANS: Server error displayed when trying to create an anynymous OAuth application. + $this->serverError(_('Could not create anonymous OAuth application.')); } } else { return null; @@ -230,7 +232,6 @@ class ApiStatusNetOAuthDataStore extends StatusNetOAuthDataStore * * @return OAuthToken $token a new unauthorized OAuth request token */ - function new_request_token($consumer, $callback) { $t = new Token(); @@ -255,6 +256,4 @@ class ApiStatusNetOAuthDataStore extends StatusNetOAuthDataStore return new OAuthToken($t->tok, $t->secret); } } - - } diff --git a/lib/applicationlist.php b/lib/applicationlist.php index 6801fb6cf1..ff9ac5a20a 100644 --- a/lib/applicationlist.php +++ b/lib/applicationlist.php @@ -142,10 +142,8 @@ class ApplicationList extends Widget { return; } - } - /** * Widget to show a list of connected OAuth clients * @@ -279,7 +277,9 @@ class ConnectedAppsList extends Widget $this->out->element( 'p', array( 'class' => 'access_token'), - _('Access token starting with: ') . substr($this->connection->token, 0, 7) + // TRANS: Access token in the application list. + // TRANS: %s are the first 7 characters of the access token. + sprintf(_('Access token starting with: %s'), substr($this->connection->token, 0, 7)) ); $this->out->elementStart( @@ -295,11 +295,10 @@ class ConnectedAppsList extends Widget $this->out->hidden('oauth_token', $this->connection->token); $this->out->hidden('token', common_session_token()); // TRANS: Button label - $this->out->submit('revoke', _('Revoke')); + $this->out->submit('revoke', _m('BUTTON','Revoke')); $this->out->elementEnd('fieldset'); $this->out->elementEnd('form'); $this->out->elementEnd('li'); - } }