Update translator documentation.

Update whitespace.
i18n/L10n fixes.
This commit is contained in:
Siebrand Mazeland 2011-06-18 17:20:36 +02:00
parent 3891697222
commit 199404c74a
10 changed files with 105 additions and 42 deletions

View File

@ -71,7 +71,6 @@ class Notice_to_status extends Memcached_DataObject
* @return Notice_to_status object found, or null for no hits
*
*/
function staticGet($k, $v=null)
{
return Memcached_DataObject::staticGet('Notice_to_status', $k, $v);
@ -85,7 +84,6 @@ class Notice_to_status extends Memcached_DataObject
*
* @return array array of column definitions
*/
function table()
{
return array('notice_id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL,
@ -102,7 +100,6 @@ class Notice_to_status extends Memcached_DataObject
*
* @return array list of key field names
*/
function keys()
{
return array_keys($this->keyTypes());
@ -120,7 +117,6 @@ class Notice_to_status extends Memcached_DataObject
* 'K' for primary key: for compound keys, add an entry for each component;
* 'U' for unique keys: compound keys are not well supported here.
*/
function keyTypes()
{
return array('notice_id' => 'K', 'status_id' => 'U');
@ -136,7 +132,6 @@ class Notice_to_status extends Memcached_DataObject
*
* @return array magic three-false array that stops auto-incrementing.
*/
function sequenceKey()
{
return array(false, false, false);
@ -151,7 +146,6 @@ class Notice_to_status extends Memcached_DataObject
*
* @return Notice_to_status new object for this value
*/
static function saveNew($notice_id, $status_id)
{
if (empty($notice_id)) {

View File

@ -148,8 +148,10 @@ class TwitterBridgePlugin extends Plugin
if (self::hasKeys() && common_config('twitter', 'signin')) {
$action->menuItem(
common_local_url('twitterlogin'),
_m('Twitter'),
_m('Login or register using Twitter'),
// TRANS: Menu item in login navigation.
_m('MENU','Twitter'),
// TRANS: Title for menu item in login navigation.
_m('Login or register using Twitter.'),
'twitterlogin' === $action_name
);
}
@ -171,7 +173,9 @@ class TwitterBridgePlugin extends Plugin
$action->menuItem(
common_local_url('twittersettings'),
_m('Twitter'),
// TRANS: Menu item in connection settings navigation.
_m('MENU','Twitter'),
// TRANS: Title for menu item in connection settings navigation.
_m('Twitter integration options'),
$action_name === 'twittersettings'
);
@ -323,8 +327,8 @@ class TwitterBridgePlugin extends Plugin
'version' => self::VERSION,
'author' => 'Zach Copley, Julien C',
'homepage' => 'http://status.net/wiki/Plugin:TwitterBridge',
'rawdescription' => _m(
'The Twitter "bridge" plugin allows integration ' .
// TRANS: Plugin description.
'rawdescription' => _m('The Twitter "bridge" plugin allows integration ' .
'of a StatusNet instance with ' .
'<a href="http://twitter.com/">Twitter</a>.'
)

View File

@ -64,7 +64,6 @@ class Twitter_synch_status extends Memcached_DataObject
* @param mixed $v Value to lookup
*
* @return Twitter_synch_status object found, or null for no hits
*
*/
function staticGet($k, $v=null)
{

View File

@ -63,7 +63,8 @@ abstract class JsonStreamReader
} else if ($scheme == 'https') {
$rawScheme = 'ssl';
} else {
throw new ServerException('Invalid URL scheme for HTTP stream reader');
// TRANS: Server exception thrown when an invalid URL scheme is detected.
throw new ServerException(_m('Invalid URL scheme for HTTP stream reader.'));
}
$host = parse_url($url, PHP_URL_HOST);
@ -180,7 +181,8 @@ abstract class JsonStreamReader
public function handleInput($socket)
{
if ($this->socket !== $socket) {
throw new Exception('Got input from unexpected socket!');
// TRANS: Exception thrown when input from an inexpected socket is encountered.
throw new Exception(_m('Got input from unexpected socket!'));
}
try {
@ -210,7 +212,9 @@ abstract class JsonStreamReader
$this->handleLineActive($line);
break;
default:
throw new Exception('Invalid state in handleLine: ' . $this->state);
// TRANS: Exception thrown when an invalid state is encountered in handleLine.
// TRANS: %s is the invalid state.
throw new Exception(sprintf(_m('Invalid state in handleLine: %s.'),$this->state));
}
}
@ -222,15 +226,21 @@ abstract class JsonStreamReader
{
$bits = explode(' ', $line, 3);
if (count($bits) != 3) {
throw new Exception("Invalid HTTP response line: $line");
// TRANS: Exception thrown when an invalid response line is encountered.
// TRANS: %s is the invalid line.
throw new Exception(sprintf(_m('Invalid HTTP response line: %s.'),$line));
}
list($http, $status, $text) = $bits;
if (substr($http, 0, 5) != 'HTTP/') {
throw new Exception("Invalid HTTP response line chunk '$http': $line");
// TRANS: Exception thrown when an invalid response line part is encountered.
// TRANS: %1$s is the chunk, %2$s is the line.
throw new Exception(sprintf(_m('Invalid HTTP response line chunk "%1$s": %2$s.'),$http, $line));
}
if ($status != '200') {
throw new Exception("Bad HTTP response code $status: $line");
// TRANS: Exception thrown when an invalid response code is encountered.
// TRANS: %1$s is the response code, %2$s is the line.
throw new Exception(sprintf(_m('Bad HTTP response code %1$s: %2$s.'),$status,$line));
}
common_log(LOG_DEBUG, "$this->id $line");
$this->state = 'headers';

View File

@ -71,7 +71,6 @@ function save_twitter_user($twitter_id, $screen_name)
$fuser = Foreign_user::getForeignUser($twitter_id, TWITTER_SERVICE);
if (!empty($fuser)) {
// Delete old record if Twitter user changed screen name
if ($fuser->nickname != $screen_name) {

View File

@ -49,7 +49,8 @@ class TwitteradminpanelAction extends AdminPanelAction
*/
function title()
{
return _m('Twitter');
// TRANS: Page title for Twitter administration panel.
return _m('TITLE','Twitter');
}
/**
@ -59,6 +60,7 @@ class TwitteradminpanelAction extends AdminPanelAction
*/
function getInstructions()
{
// TRANS: Instructions for Twitter bridge administration page.
return _m('Twitter bridge settings');
}
@ -147,13 +149,15 @@ class TwitteradminpanelAction extends AdminPanelAction
if (mb_strlen($values['twitter']['consumer_key']) > 255) {
$this->clientError(
_m("Invalid consumer key. Max length is 255 characters.")
// TRANS: Client error displayed when a consumer key is invalid because it is too long.
_m('Invalid consumer key. Maximum length is 255 characters.')
);
}
if (mb_strlen($values['twitter']['consumer_secret']) > 255) {
$this->clientError(
_m("Invalid consumer secret. Max length is 255 characters.")
// TRANS: Client error displayed when a consumer secret is invalid because it is too long.
_m('Invalid consumer secret. Maximum length is 255 characters.')
);
}
}
@ -209,14 +213,17 @@ class TwitterAdminPanelForm extends AdminForm
'fieldset',
array('id' => 'settings_twitter-application')
);
// TRANS: Fieldset legend for Twitter application settings.
$this->out->element('legend', null, _m('Twitter application settings'));
$this->out->elementStart('ul', 'form_data');
$this->li();
$this->input(
'consumer_key',
// TRANS: Field label for Twitter assigned consumer key.
_m('Consumer key'),
_m('Consumer key assigned by Twitter'),
// TRANS: Field title for Twitter assigned consumer key.
_m('The consumer key assigned by Twitter.'),
'twitter'
);
$this->unli();
@ -224,8 +231,10 @@ class TwitterAdminPanelForm extends AdminForm
$this->li();
$this->input(
'consumer_secret',
_m('Consumer secret'),
_m('Consumer secret assigned by Twitter'),
// TRANS: Field label for Twitter assigned consumer secret.
_m('Consumer secret'),
// TRANS: Field title for Twitter assigned consumer secret.
_m('The consumer secret assigned by Twitter.'),
'twitter'
);
$this->unli();
@ -235,15 +244,18 @@ class TwitterAdminPanelForm extends AdminForm
if (!empty($globalConsumerKey) && !empty($globalConsumerSec)) {
$this->li();
$this->out->element('p', 'form_guide', _m('Note: a global consumer key and secret are set.'));
// TRANS: Form guide displayed when two required fields have already been provided.
$this->out->element('p', 'form_guide', _m('Note: A global consumer key and secret are set.'));
$this->unli();
}
$this->li();
$this->input(
'source',
_m('Integration source'),
_m('Name of your Twitter application'),
// TRANS: Field label for Twitter application name.
_m('Integration source'),
// TRANS: Field title for Twitter application name.
_m('The name of your Twitter application.'),
'integration'
);
$this->unli();
@ -255,6 +267,7 @@ class TwitterAdminPanelForm extends AdminForm
'fieldset',
array('id' => 'settings_twitter-options')
);
// TRANS: Fieldset legend for Twitter integration options.
$this->out->element('legend', null, _m('Options'));
$this->out->elementStart('ul', 'form_data');
@ -262,17 +275,21 @@ class TwitterAdminPanelForm extends AdminForm
$this->li();
$this->out->checkbox(
// TRANS: Checkbox label for global setting.
'signin', _m('Enable "Sign-in with Twitter"'),
(bool) $this->value('signin', 'twitter'),
_m('Allow users to login with their Twitter credentials')
// TRANS: Checkbox title.
_m('This allow users to login with their Twitter credentials.')
);
$this->unli();
if (Event::handle('TwitterBridgeAdminImportControl')) {
$this->li();
$this->out->checkbox(
// TRANS: Checkbox label for global setting.
'enabled', _m('Enable Twitter import'),
(bool) $this->value('enabled', 'twitterimport'),
// TRANS: Checkbox title for global setting.
_m('Allow users to import their Twitter friends\' timelines. Requires daemons to be manually configured.')
);
$this->unli();
@ -290,6 +307,9 @@ class TwitterAdminPanelForm extends AdminForm
*/
function formActions()
{
$this->out->submit('submit', _m('Save'), 'submit', null, _m('Save Twitter settings'));
// TRANS: Button text for saving the administrative Twitter bridge settings.
$this->out->submit('submit', _m('BUTTON','Save'), 'submit', null,
// TRANS: Button title for saving the administrative Twitter bridge settings.
_m('Save the Twitter bridge settings.'));
}
}

View File

@ -117,12 +117,14 @@ class TwitterauthorizationAction extends Action
$token = $this->trimmed('token');
if (!$token || $token != common_session_token()) {
// TRANS: Client error displayed when the session token does not match or is not given.
$this->showForm(_m('There was a problem with your session token. Try again, please.'));
return;
}
if ($this->arg('create')) {
if (!$this->boolean('license')) {
// TRANS: Form validation error displayed when the checkbox to agree to the license has not been checked.
$this->showForm(_m('You cannot register if you do not agree to the license.'),
$this->trimmed('newname'));
return;
@ -132,6 +134,7 @@ class TwitterauthorizationAction extends Action
$this->connectNewUser();
} else {
common_debug('Twitter bridge - ' . print_r($this->args, true));
// TRANS: Form validation error displayed when an unhandled error occurs.
$this->showForm(_m('Something weird happened.'),
$this->trimmed('newname'));
}
@ -157,7 +160,6 @@ class TwitterauthorizationAction extends Action
function authorizeRequestToken()
{
try {
// Get a new request token and authorize it
$client = new TwitterOAuthClient();
@ -169,7 +171,6 @@ class TwitterauthorizationAction extends Action
$_SESSION['twitter_request_token_secret'] = $req_tok->secret;
$auth_link = $client->getAuthorizeLink($req_tok, $this->signin);
} catch (OAuthClientException $e) {
$msg = sprintf(
'OAuth client error - code: %1s, msg: %2s',
@ -178,6 +179,7 @@ class TwitterauthorizationAction extends Action
);
common_log(LOG_INFO, 'Twitter bridge - ' . $msg);
$this->serverError(
// TRANS: Server error displayed when linking to a Twitter account fails.
_m('Could not link your Twitter account.')
);
}
@ -198,7 +200,8 @@ class TwitterauthorizationAction extends Action
if ($_SESSION['twitter_request_token'] != $this->oauth_token) {
$this->serverError(
_m('Couldn\'t link your Twitter account: oauth_token mismatch.')
// TRANS: Server error displayed when linking to a Twitter account fails because of an incorrect oauth_token.
_m('Could not link your Twitter account: oauth_token mismatch.')
);
}
@ -226,7 +229,8 @@ class TwitterauthorizationAction extends Action
);
common_log(LOG_INFO, 'Twitter bridge - ' . $msg);
$this->serverError(
_m('Couldn\'t link your Twitter account.')
// TRANS: Server error displayed when linking to a Twitter account fails.
_m('Could not link your Twitter account.')
);
}
@ -297,7 +301,8 @@ class TwitterauthorizationAction extends Action
if (empty($flink_id)) {
common_log_db_error($flink, 'INSERT', __FILE__);
$this->serverError(_m('Couldn\'t link your Twitter account.'));
// TRANS: Server error displayed when linking to a Twitter account fails.
$this->serverError(_m('Could not link your Twitter account.'));
}
return $flink_id;
@ -309,12 +314,14 @@ class TwitterauthorizationAction extends Action
$this->element('div', array('class' => 'error'), $this->error);
} else {
$this->element('div', 'instructions',
sprintf(_m('This is the first time you\'ve logged into %s so we must connect your Twitter account to a local account. You can either create a new account, or connect with your existing account, if you have one.'), common_config('site', 'name')));
// TRANS: Page instruction. %s is the StatusNet sitename.
sprintf(_m('This is the first time you have logged into %s so we must connect your Twitter account to a local account. You can either create a new account, or connect with your existing account, if you have one.'), common_config('site', 'name')));
}
}
function title()
{
// TRANS: Page title.
return _m('Twitter Account Setup');
}
@ -348,6 +355,7 @@ class TwitterauthorizationAction extends Action
'class' => 'form_settings',
'action' => common_local_url('twitterauthorization')));
$this->elementStart('fieldset', array('id' => 'settings_twitter_connect_options'));
// TRANS: Fieldset legend.
$this->element('legend', null, _m('Connection options'));
$this->elementStart('ul', 'form_data');
$this->elementStart('li');
@ -357,6 +365,8 @@ class TwitterauthorizationAction extends Action
'name' => 'license',
'value' => 'true'));
$this->elementStart('label', array('class' => 'checkbox', 'for' => 'license'));
// TRANS: Text for license agreement checkbox.
// TRANS: %s is the license as configured for the StatusNet site.
$message = _m('My text and files are available under %s ' .
'except this private data: password, ' .
'email address, IM address, and phone number.');
@ -378,8 +388,10 @@ class TwitterauthorizationAction extends Action
$this->elementStart('fieldset');
$this->hidden('token', common_session_token());
$this->element('legend', null,
// TRANS: Fieldset legend.
_m('Create new account'));
$this->element('p', null,
// TRANS: Sub form introduction text.
_m('Create a new user with this nickname.'));
$this->elementStart('ul', 'form_data');
@ -387,12 +399,16 @@ class TwitterauthorizationAction extends Action
Event::handle('StartRegistrationFormData', array($this));
$this->elementStart('li');
// TRANS: Field label.
$this->input('newname', _m('New nickname'),
($this->username) ? $this->username : '',
// TRANS: Field title for nickname field.
_m('1-64 lowercase letters or numbers, no punctuation or spaces.'));
$this->elementEnd('li');
$this->elementStart('li');
// TRANS: Field label.
$this->input('email', _m('LABEL','Email'), $this->getEmail(),
// TRANS: Field title for e-mail address field.
_m('Used only for updates, announcements, '.
'and password recovery'));
$this->elementEnd('li');
@ -401,23 +417,29 @@ class TwitterauthorizationAction extends Action
Event::handle('EndRegistrationFormData', array($this));
$this->elementEnd('ul');
$this->submit('create', _m('Create'));
// TRANS: Button text for creating a new StatusNet account in the Twitter connect page.
$this->submit('create', _m('BUTTON','Create'));
$this->elementEnd('fieldset');
$this->elementStart('fieldset');
$this->element('legend', null,
// TRANS: Fieldset legend.
_m('Connect existing account'));
$this->element('p', null,
// TRANS: Sub form introduction text.
_m('If you already have an account, login with your username and password to connect it to your Twitter account.'));
$this->elementStart('ul', 'form_data');
$this->elementStart('li');
// TRANS: Field label.
$this->input('nickname', _m('Existing nickname'));
$this->elementEnd('li');
$this->elementStart('li');
// TRANS: Field label.
$this->password('password', _m('Password'));
$this->elementEnd('li');
$this->elementEnd('ul');
$this->submit('connect', _m('Connect'));
// TRANS: Button text for connecting an existing StatusNet account in the Twitter connect page..
$this->submit('connect', _m('BUTTON','Connect'));
$this->elementEnd('fieldset');
$this->elementEnd('fieldset');
@ -463,6 +485,7 @@ class TwitterauthorizationAction extends Action
}
if (common_config('site', 'closed')) {
// TRANS: Client error displayed when trying to create a new user while creating new users is not allowed.
$this->clientError(_m('Registration not allowed.'));
return;
}
@ -472,6 +495,7 @@ class TwitterauthorizationAction extends Action
if (common_config('site', 'inviteonly')) {
$code = $_SESSION['invitecode'];
if (empty($code)) {
// TRANS: Client error displayed when trying to create a new user while creating new users is not allowed.
$this->clientError(_m('Registration not allowed.'));
return;
}
@ -479,6 +503,7 @@ class TwitterauthorizationAction extends Action
$invite = Invitation::staticGet($code);
if (empty($invite)) {
// TRANS: Client error displayed when trying to create a new user with an invalid invitation code.
$this->clientError(_m('Not a valid invitation code.'));
return;
}
@ -492,11 +517,13 @@ class TwitterauthorizationAction extends Action
}
if (!User::allowed_nickname($nickname)) {
// TRANS: Client error displayed when trying to create a new user with an invalid username.
$this->showForm(_m('Nickname not allowed.'));
return;
}
if (User::staticGet('nickname', $nickname)) {
// TRANS: Client error displayed when trying to create a new user with a username that is already in use.
$this->showForm(_m('Nickname already in use. Try another one.'));
return;
}
@ -517,6 +544,7 @@ class TwitterauthorizationAction extends Action
$user = User::register($args);
if (empty($user)) {
// TRANS: Server error displayed when creating a new user has failed.
$this->serverError(_m('Error registering user.'));
return;
}
@ -528,6 +556,7 @@ class TwitterauthorizationAction extends Action
save_twitter_user($this->twuid, $this->tw_fields['screen_name']);
if (!$result) {
// TRANS: Server error displayed when connecting a user to a Twitter user has failed.
$this->serverError(_m('Error connecting user to Twitter.'));
return;
}
@ -550,6 +579,8 @@ class TwitterauthorizationAction extends Action
$password = $this->trimmed('password');
if (!common_check_user($nickname, $password)) {
// TRANS: Form validation error displayed when connecting an existing user to a Twitter user fails because
// TRANS: the provided username and/or password are incorrect.
$this->showForm(_m('Invalid username or password.'));
return;
}
@ -568,6 +599,7 @@ class TwitterauthorizationAction extends Action
save_twitter_user($this->twuid, $this->tw_fields['screen_name']);
if (!$result) {
// TRANS: Server error displayed connecting a user to a Twitter user has failed.
$this->serverError(_m('Error connecting user to Twitter.'));
return;
}
@ -588,6 +620,7 @@ class TwitterauthorizationAction extends Action
$result = $this->flinkUser($user->id, $this->twuid);
if (empty($result)) {
// TRANS: Server error displayed connecting a user to a Twitter user has failed.
$this->serverError(_m('Error connecting user to Twitter.'));
return;
}

View File

@ -700,4 +700,4 @@ class TwitterImport
}
}
}
}
}

View File

@ -53,6 +53,7 @@ class TwitterloginAction extends Action
parent::handle($args);
if (common_is_real_login()) {
// TRANS: Client error displayed when trying to log in using Twitter while already logged in to StatusNet.
$this->clientError(_m('Already logged in.'));
}
@ -61,11 +62,13 @@ class TwitterloginAction extends Action
function title()
{
return _m('Twitter Login');
// TRANS: Title for login using Twitter page.
return _m('TITLE','Twitter Login');
}
function getInstructions()
{
// TRANS: Instructions for login using Twitter page.
return _m('Login with your Twitter account');
}
@ -84,6 +87,7 @@ class TwitterloginAction extends Action
null,
array('signin' => true))));
$this->element('img', array('src' => Plugin::staticPath('TwitterBridge', 'Sign-in-with-Twitter-lighter.png'),
// TRANS: Alternative text for "sign in with Twitter" image.
'alt' => _m('Sign in with Twitter')));
$this->elementEnd('a');
}

View File

@ -54,7 +54,7 @@ abstract class TwitterStreamReader extends JsonStreamReader
*
* @param string $url
* @param array $params
* @return string
* @return string
*/
protected function oAuthUrl($url, $params=array())
{
@ -136,7 +136,7 @@ abstract class TwitterStreamReader extends JsonStreamReader
/**
* Call event handler callbacks for the given event.
*
*
* @param string $event
* @param mixed $arg1 ... one or more params to pass on
*/