From 3e8bf13aab25050cce09a3180ea7b56c41ed40e3 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Fri, 8 Apr 2011 10:59:10 +0200 Subject: [PATCH] Update translator documentation. L10n/i18n updates. --- .../FacebookBridge/FacebookBridgePlugin.php | 24 +++--- .../actions/facebookadminpanel.php | 18 ++++- .../actions/facebookdeauthorize.php | 3 +- .../actions/facebookfinishlogin.php | 33 +++++--- .../FacebookBridge/actions/facebooklogin.php | 12 +-- .../actions/facebooksettings.php | 26 ++++--- .../FacebookBridge/classes/Notice_to_item.php | 7 -- plugins/FacebookBridge/lib/facebookclient.php | 77 +++++++------------ 8 files changed, 98 insertions(+), 102 deletions(-) diff --git a/plugins/FacebookBridge/FacebookBridgePlugin.php b/plugins/FacebookBridge/FacebookBridgePlugin.php index 68e931e387..d893baf62d 100644 --- a/plugins/FacebookBridge/FacebookBridgePlugin.php +++ b/plugins/FacebookBridge/FacebookBridgePlugin.php @@ -101,7 +101,6 @@ class FacebookBridgePlugin extends Plugin */ function onAutoload($cls) { - $dir = dirname(__FILE__); //common_debug("class = " . $cls); @@ -128,7 +127,6 @@ class FacebookBridgePlugin extends Plugin default: return true; } - } /** @@ -214,10 +212,11 @@ class FacebookBridgePlugin extends Plugin if ($this->hasApplication()) { $action->menuItem( + // TRANS: Menu item for "Facebook" login. common_local_url('facebooklogin'), _m('MENU', 'Facebook'), - // TRANS: Tooltip for menu item "Facebook". - _m('Login or register using Facebook'), + // TRANS: Menu title for "Facebook" login. + _m('Login or register using Facebook.'), 'facebooklogin' === $action_name ); } @@ -253,10 +252,10 @@ class FacebookBridgePlugin extends Plugin $nav->out->menuItem( common_local_url('facebookadminpanel'), - // TRANS: Menu item. + // TRANS: Menu item for "Facebook" in administration panel. _m('MENU','Facebook'), - // TRANS: Tooltip for menu item "Facebook". - _m('Facebook integration configuration'), + // TRANS: Menu title for "Facebook" in administration panel. + _m('Facebook integration configuration.'), $action_name == 'facebookadminpanel', 'nav_facebook_admin_panel' ); @@ -294,16 +293,14 @@ class FacebookBridgePlugin extends Plugin $action->menuItem( common_local_url('facebooksettings'), - // TRANS: Menu item tab. + // TRANS: Menu item for "Facebook" in user settings. _m('MENU','Facebook'), - // TRANS: Tooltip for menu item "Facebook". - _m('Facebook settings'), + // TRANS: Menu title for "Facebook" in user settings. + _m('Facebook settings.'), $action_name === 'facebooksettings' ); - } } - } /* @@ -324,7 +321,6 @@ class FacebookBridgePlugin extends Plugin if (!empty($appId) && !empty($secret)) { return true; } - } return false; @@ -420,7 +416,6 @@ ENDOFSCRIPT; common_debug("LOGOUT URL = $logoutUrl"); common_redirect($logoutUrl, 303); } - } } @@ -561,6 +556,7 @@ ENDOFSCRIPT; 'author' => 'Craig Andrews, Zach Copley', 'homepage' => 'http://status.net/wiki/Plugin:FacebookBridge', 'rawdescription' => + // TRANS: Plugin description. _m('A plugin for integrating StatusNet with Facebook.') ); diff --git a/plugins/FacebookBridge/actions/facebookadminpanel.php b/plugins/FacebookBridge/actions/facebookadminpanel.php index 034b58b2fa..21c3589008 100644 --- a/plugins/FacebookBridge/actions/facebookadminpanel.php +++ b/plugins/FacebookBridge/actions/facebookadminpanel.php @@ -49,7 +49,8 @@ class FacebookadminpanelAction extends AdminPanelAction */ function title() { - return _m('Facebook'); + // TRANS: Title for Facebook administration panel. + return _m('TITLE','Facebook integration settings'); } /** @@ -59,6 +60,7 @@ class FacebookadminpanelAction extends AdminPanelAction */ function getInstructions() { + // TRANS: Instruction for Facebook administration panel. return _m('Facebook integration settings'); } @@ -120,12 +122,14 @@ class FacebookadminpanelAction extends AdminPanelAction if (mb_strlen($values['facebook']['appid']) > 255) { $this->clientError( + // TRANS: Client error displayed when providing too long a Facebook application ID. _m("Invalid Facebook ID. Maximum length is 255 characters.") ); } if (mb_strlen($values['facebook']['secret']) > 255) { $this->clientError( + // TRANS: Client error displayed when providing too long a Facebook secret key. _m("Invalid Facebook secret. Maximum length is 255 characters.") ); } @@ -175,13 +179,16 @@ class FacebookAdminPanelForm extends AdminForm 'fieldset', array('id' => 'settings_facebook-application') ); + // TRANS: Fieldset legend. $this->out->element('legend', null, _m('Facebook application settings')); $this->out->elementStart('ul', 'form_data'); $this->li(); $this->input( 'appid', + // TRANS: Field label for Facebook application ID. _m('Application ID'), + // TRANS: Field title for Facebook application ID. _m('ID of your Facebook application.'), 'facebook' ); @@ -190,7 +197,9 @@ class FacebookAdminPanelForm extends AdminForm $this->li(); $this->input( 'secret', - _m('Secret'), + // TRANS: Field label for Facebook secret key. + _m('Secret'), + // TRANS: Field title for Facebook secret key. _m('Application secret.'), 'facebook' ); @@ -207,6 +216,9 @@ class FacebookAdminPanelForm extends AdminForm */ function formActions() { - $this->out->submit('submit', _m('BUTTON','Save'), 'submit', null, _m('Save Facebook settings.')); + // TRANS: Button text to save Facebook integration settings. + $this->out->submit('submit', _m('BUTTON','Save'), + // TRANS: Button title to save Facebook integration settings. + 'submit', null, _m('Save Facebook settings.')); } } diff --git a/plugins/FacebookBridge/actions/facebookdeauthorize.php b/plugins/FacebookBridge/actions/facebookdeauthorize.php index 6813ccf1d2..1a83c3a003 100644 --- a/plugins/FacebookBridge/actions/facebookdeauthorize.php +++ b/plugins/FacebookBridge/actions/facebookdeauthorize.php @@ -140,5 +140,4 @@ class FacebookdeauthorizeAction extends Action } } } - -} \ No newline at end of file +} diff --git a/plugins/FacebookBridge/actions/facebookfinishlogin.php b/plugins/FacebookBridge/actions/facebookfinishlogin.php index f952ad2e2b..3d2fb571d7 100644 --- a/plugins/FacebookBridge/actions/facebookfinishlogin.php +++ b/plugins/FacebookBridge/actions/facebookfinishlogin.php @@ -38,7 +38,6 @@ class FacebookfinishloginAction extends Action private $fbuser = null; // Facebook user object (JSON) function prepare($args) { - parent::prepare($args); $this->facebook = new Facebook( @@ -64,7 +63,6 @@ class FacebookfinishloginAction extends Action } if (!empty($this->fbuser)) { - // OKAY, all is well... proceed to register common_debug("Found a valid Facebook user.", __FILE__); @@ -85,6 +83,7 @@ class FacebookfinishloginAction extends Action ); $this->clientError( + // TRANS: Client error displayed when trying to connect to Facebook while not logged in. _m('You must be logged into Facebook to register a local account using Facebook.') ); } @@ -115,6 +114,8 @@ class FacebookfinishloginAction extends Action ); $this->clientError( + // TRANS: Client error displayed when trying to connect to a Facebook account that is already linked + // TRANS: in the same StatusNet site. _m('There is already a local account linked with that Facebook account.') ); @@ -138,6 +139,7 @@ class FacebookfinishloginAction extends Action if (!$token || $token != common_session_token()) { $this->showForm( + // TRANS: Client error displayed when the session token does not match or is not given. _m('There was a problem with your session token. Try again, please.') ); return; @@ -147,6 +149,7 @@ class FacebookfinishloginAction extends Action if (!$this->boolean('license')) { $this->showForm( + // TRANS: Form validation error displayed when user has not agreed to the license. _m('You cannot register if you do not agree to the license.'), $this->trimmed('newname') ); @@ -164,6 +167,7 @@ class FacebookfinishloginAction extends Action } else { $this->showForm( + // TRANS: Form validation error displayed when an unhandled error occurs. _m('An unknown error has occured.'), $this->trimmed('newname') ); @@ -180,8 +184,9 @@ class FacebookfinishloginAction extends Action $this->element( 'div', 'instructions', - // TRANS: %s is the site name. sprintf( + // TRANS: Form instructions for connecting to Facebook. + // TRANS: %s is the site name. _m('This is the first time you have logged into %s so we must connect your Facebook to a local account. You can either create a new local account, or connect with an existing local account.'), common_config('site', 'name') ) @@ -209,7 +214,7 @@ class FacebookfinishloginAction extends Action } /** - * @fixme much of this duplicates core code, which is very fragile. + * @todo FIXME: Much of this duplicates core code, which is very fragile. * Should probably be replaced with an extensible mini version of * the core registration form. */ @@ -225,7 +230,7 @@ class FacebookfinishloginAction extends Action 'class' => 'form_settings', 'action' => common_local_url('facebookfinishlogin'))); $this->elementStart('fieldset', array('id' => 'settings_facebook_connect_options')); - // TRANS: Legend. + // TRANS: Fieldset legend. $this->element('legend', null, _m('Connection options')); $this->elementStart('ul', 'form_data'); $this->elementStart('li'); @@ -252,9 +257,10 @@ class FacebookfinishloginAction extends Action $this->elementStart('fieldset'); $this->hidden('token', common_session_token()); $this->element('legend', null, - // TRANS: Legend. + // TRANS: Fieldset legend. _m('Create new account')); $this->element('p', null, + // TRANS: Form instructions. _m('Create a new user with this nickname.')); $this->elementStart('ul', 'form_data'); @@ -265,6 +271,7 @@ class FacebookfinishloginAction extends Action // TRANS: Field label. $this->input('newname', _m('New nickname'), ($this->username) ? $this->username : '', + // TRANS: Field title. _m('1-64 lowercase letters or numbers, no punctuation or spaces.')); $this->elementEnd('li'); @@ -272,15 +279,16 @@ class FacebookfinishloginAction extends Action Event::handle('EndRegistrationFormData', array($this)); $this->elementEnd('ul'); - // TRANS: Submit button. + // TRANS: Submit button to create a new account. $this->submit('create', _m('BUTTON','Create')); $this->elementEnd('fieldset'); $this->elementStart('fieldset'); - // TRANS: Legend. $this->element('legend', null, + // TRANS: Fieldset legend. _m('Connect existing account')); $this->element('p', null, + // TRANS: Form instructions. _m('If you already have an account, login with your username and password to connect it to your Facebook.')); $this->elementStart('ul', 'form_data'); $this->elementStart('li'); @@ -288,10 +296,11 @@ class FacebookfinishloginAction extends Action $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'); - // TRANS: Submit button. + // TRANS: Submit button to connect a Facebook account to an existing StatusNet account. $this->submit('connect', _m('BUTTON','Connect')); $this->elementEnd('fieldset'); @@ -344,11 +353,13 @@ class FacebookfinishloginAction extends Action } if (!User::allowed_nickname($nickname)) { + // TRANS: Form validation error displayed when picking a nickname that is not allowed. $this->showForm(_m('Nickname not allowed.')); return; } if (User::staticGet('nickname', $nickname)) { + // TRANS: Form validation error displayed when picking a nickname that is already in use. $this->showForm(_m('Nickname already in use. Try another one.')); return; } @@ -377,6 +388,7 @@ class FacebookfinishloginAction extends Action $result = $this->flinkUser($user->id, $this->fbuid); if (!$result) { + // TRANS: Server error displayed when connecting to Facebook fails. $this->serverError(_m('Error connecting user to Facebook.')); return; } @@ -479,6 +491,7 @@ class FacebookfinishloginAction extends Action $password = $this->trimmed('password'); if (!common_check_user($nickname, $password)) { + // TRANS: Form validation error displayed when username/password combination is incorrect. $this->showForm(_m('Invalid username or password.')); return; } @@ -516,6 +529,7 @@ class FacebookfinishloginAction extends Action $result = $this->flinkUser($user->id, $this->fbuid); if (empty($result)) { + // TRANS: Server error displayed when connecting to Facebook fails. $this->serverError(_m('Error connecting user to Facebook.')); return; } @@ -687,5 +701,4 @@ class FacebookfinishloginAction extends Action return false; } - } diff --git a/plugins/FacebookBridge/actions/facebooklogin.php b/plugins/FacebookBridge/actions/facebooklogin.php index 924dd46565..fa3cc7a6f2 100644 --- a/plugins/FacebookBridge/actions/facebooklogin.php +++ b/plugins/FacebookBridge/actions/facebooklogin.php @@ -34,12 +34,12 @@ if (!defined('STATUSNET')) { class FacebookloginAction extends Action { - function handle($args) { parent::handle($args); if (common_is_real_login()) { + // TRANS: Client error displayed when trying to login while already logged in. $this->clientError(_m('Already logged in.')); } else { $this->showPage(); @@ -48,7 +48,7 @@ class FacebookloginAction extends Action function getInstructions() { - // TRANS: Instructions. + // TRANS: Form instructions. return _m('Login with your Facebook Account'); } @@ -68,7 +68,6 @@ class FacebookloginAction extends Action } function showContent() { - $this->elementStart('fieldset'); $facebook = Facebookclient::getFacebook(); @@ -90,8 +89,10 @@ class FacebookloginAction extends Action $attrs = array( 'src' => Plugin::staticPath('FacebookBridge', 'images/login-button.png'), - 'alt' => 'Login with Facebook', - 'title' => 'Login with Facebook' + // TRANS: Alt text for "Login with Facebook" image. + 'alt' => _m('Login with Facebook'), + // TRANS: Title for "Login with Facebook" image. + 'title' => _m('Login with Facebook.') ); $this->element('img', $attrs); @@ -117,4 +118,3 @@ class FacebookloginAction extends Action $nav->show(); } } - diff --git a/plugins/FacebookBridge/actions/facebooksettings.php b/plugins/FacebookBridge/actions/facebooksettings.php index 7d45cc03e6..aaa2204035 100644 --- a/plugins/FacebookBridge/actions/facebooksettings.php +++ b/plugins/FacebookBridge/actions/facebooksettings.php @@ -83,6 +83,7 @@ class FacebooksettingsAction extends SettingsAction { $token = $this->trimmed('token'); if (!$token || $token != common_session_token()) { $this->showForm( + // TRANS: Client error displayed when the session token does not match or is not given. _m('There was a problem with your session token. Try again, please.') ); return; @@ -102,7 +103,7 @@ class FacebooksettingsAction extends SettingsAction { */ function title() { // TRANS: Page title for Facebook settings. - return _m('Facebook settings'); + return _m('TITLE','Facebook settings'); } /** @@ -111,6 +112,7 @@ class FacebooksettingsAction extends SettingsAction { * @return instructions for use */ function getInstructions() { + // TRANS: Instructions for Facebook settings. return _m('Facebook settings'); } @@ -134,6 +136,7 @@ class FacebooksettingsAction extends SettingsAction { $this->hidden('token', common_session_token()); + // TRANS: Form note. User is connected to facebook. $this->element('p', 'form_note', _m('Connected Facebook user')); $this->elementStart('p', array('class' => 'facebook-user-display')); @@ -161,6 +164,7 @@ class FacebooksettingsAction extends SettingsAction { $this->checkbox( 'noticesync', + // TRANS: Checkbox label in Facebook settings. _m('Publish my notices to Facebook.'), ($this->flink) ? ($this->flink->noticesync & FOREIGN_NOTICE_SEND) : true ); @@ -171,6 +175,7 @@ class FacebooksettingsAction extends SettingsAction { $this->checkbox( 'replysync', + // TRANS: Checkbox label in Facebook settings. _m('Send "@" replies to Facebook.'), ($this->flink) ? ($this->flink->noticesync & FOREIGN_NOTICE_SEND_REPLY) : true ); @@ -188,13 +193,14 @@ class FacebooksettingsAction extends SettingsAction { $this->elementStart('fieldset'); - // TRANS: Legend. + // TRANS: Fieldset legend for form to disconnect from Facebook. $this->element('legend', null, _m('Disconnect my account from Facebook')); if (empty($this->user->password)) { $this->elementStart('p', array('class' => 'form_guide')); $msg = sprintf( + // TRANS: Notice in disconnect from Facebook form if user has no local StatusNet password. _m( 'Disconnecting your Faceboook would make it impossible to ' . 'log in! Please [set a password](%s) first.' @@ -206,14 +212,11 @@ class FacebooksettingsAction extends SettingsAction { $this->elementEnd('p'); } else { // @todo FIXME: i18n: This message is not being used. - $msg = sprintf( - // TRANS: Message displayed when initiating disconnect of a StatusNet user - // TRANS: from a Facebook account. %1$s is the StatusNet site name. - _m( - 'Keep your %1$s account but disconnect from Facebook. ' . - 'You\'ll use your %1$s password to log in.' - ), - common_config('site', 'name') + // TRANS: Message displayed when initiating disconnect of a StatusNet user + // TRANS: from a Facebook account. %1$s is the StatusNet site name. + $msg = sprintf(_m('Keep your %1$s account but disconnect from Facebook. ' . + 'You\'ll use your %1$s password to log in.'), + common_config('site', 'name') ); // TRANS: Submit button. @@ -240,6 +243,7 @@ class FacebooksettingsAction extends SettingsAction { $result = $this->flink->update($original); if ($result === false) { + // TRANS: Notice in case saving of synchronisation preferences fail. $this->showForm(_m('There was a problem saving your sync preferences.')); } else { // TRANS: Confirmation that synchronisation settings have been saved into the system. @@ -257,10 +261,12 @@ class FacebooksettingsAction extends SettingsAction { if ($result === false) { common_log_db_error($user, 'DELETE', __FILE__); + // TRANS: Server error displayed when deleting the link to a Facebook account fails. $this->serverError(_m('Could not delete link to Facebook.')); return; } + // TRANS: Confirmation message. StatusNet account was unlinked from Facebook. $this->showForm(_m('You have disconnected from Facebook.'), true); } } diff --git a/plugins/FacebookBridge/classes/Notice_to_item.php b/plugins/FacebookBridge/classes/Notice_to_item.php index a6a8030342..d37c95ffc1 100644 --- a/plugins/FacebookBridge/classes/Notice_to_item.php +++ b/plugins/FacebookBridge/classes/Notice_to_item.php @@ -48,7 +48,6 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php'; * * @see DB_DataObject */ - class Notice_to_item extends Memcached_DataObject { public $__table = 'notice_to_item'; // table name @@ -67,7 +66,6 @@ class Notice_to_item extends Memcached_DataObject * @return Notice_to_item object found, or null for no hits * */ - function staticGet($k, $v=null) { return Memcached_DataObject::staticGet('Notice_to_item', $k, $v); @@ -81,7 +79,6 @@ class Notice_to_item extends Memcached_DataObject * * @return array array of column definitions */ - function table() { return array( @@ -109,7 +106,6 @@ class Notice_to_item extends Memcached_DataObject * * @return array list of key field names */ - function keys() { return array_keys($this->keyTypes()); @@ -127,7 +123,6 @@ class Notice_to_item 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', 'item_id' => 'U'); @@ -143,7 +138,6 @@ class Notice_to_item extends Memcached_DataObject * * @return array magic three-false array that stops auto-incrementing. */ - function sequenceKey() { return array(false, false, false); @@ -157,7 +151,6 @@ class Notice_to_item extends Memcached_DataObject * * @return Notice_to_item new object for this value */ - static function saveNew($notice_id, $item_id) { $n2i = Notice_to_item::staticGet('notice_id', $notice_id); diff --git a/plugins/FacebookBridge/lib/facebookclient.php b/plugins/FacebookBridge/lib/facebookclient.php index 37d6a0a7a0..ec1331b2a0 100644 --- a/plugins/FacebookBridge/lib/facebookclient.php +++ b/plugins/FacebookBridge/lib/facebookclient.php @@ -340,7 +340,8 @@ class Facebookclient function checkPermission($permission) { if (!in_array($permission, array('publish_stream', 'status_update'))) { - throw new ServerException("No such permission!"); + // TRANS: Server exception thrown when permission check fails. + throw new ServerException(_('No such permission!')); } $fbuid = $this->flink->foreign_id; @@ -397,7 +398,6 @@ class Facebookclient ); return false; - } } @@ -461,7 +461,7 @@ class Facebookclient ), __FILE__ ); - // @fixme: We want to rety at a later time when the throttling has expired + // @todo FIXME: We want to rety at a later time when the throttling has expired // instead of just giving up. return true; break; @@ -582,7 +582,6 @@ class Facebookclient ); if (!empty($result)) { // result will contain the item ID - // Save a mapping Notice_to_item::saveNew($this->notice->id, $result); @@ -598,7 +597,6 @@ class Facebookclient ), __FILE__ ); - } else { $msg = sprintf( @@ -740,7 +738,6 @@ class Facebookclient $result = $this->mailFacebookDisconnect(); if (!$result) { - $msg = 'Unable to send email to notify %s (%d), fbuid %d ' . 'about his/her Facebook link being removed.'; @@ -755,9 +752,7 @@ class Facebookclient __FILE__ ); } - } else { - $msg = 'Unable to send email to notify %s (%d), fbuid %d ' . 'about his/her Facebook link being removed because the ' . 'user has not set an email address.'; @@ -789,26 +784,23 @@ class Facebookclient common_switch_locale($this->user->language); + // TRANS: E-mail subject. $subject = _m('Your Facebook connection has been removed'); - $msg = <<user->nickname, $siteName ); @@ -848,22 +840,21 @@ BODY; common_switch_locale($user->language); + // TRANS: E-mail subject. %s is the StatusNet sitename. $subject = _m('Contact the %s administrator to retrieve your account'); - $msg = <<nickname, $siteName, $siteEmail @@ -990,9 +981,7 @@ BODY; $n2i = Notice_to_item::staticGet('notice_id', $this->notice->id); if (!empty($this->flink) && !empty($n2i)) { - try { - $result = $this->facebook->api( array( 'method' => 'stream.remove', @@ -1002,7 +991,6 @@ BODY; ); if (!empty($result) && result == true) { - common_log( LOG_INFO, sprintf( @@ -1020,7 +1008,6 @@ BODY; } else { throw new FaceboookApiException(var_export($result, true)); } - } catch (FacebookApiException $e) { common_log( LOG_WARNING, @@ -1049,9 +1036,7 @@ BODY; $n2i = Notice_to_item::staticGet('notice_id', $this->notice->id); if (!empty($this->flink) && !empty($n2i)) { - try { - $result = $this->facebook->api( array( 'method' => 'stream.addlike', @@ -1061,7 +1046,6 @@ BODY; ); if (!empty($result) && result == true) { - common_log( LOG_INFO, sprintf( @@ -1073,11 +1057,9 @@ BODY; ), __FILE__ ); - } else { throw new FacebookApiException(var_export($result, true)); } - } catch (FacebookApiException $e) { common_log( LOG_WARNING, @@ -1105,9 +1087,7 @@ BODY; $n2i = Notice_to_item::staticGet('notice_id', $this->notice->id); if (!empty($this->flink) && !empty($n2i)) { - try { - $result = $this->facebook->api( array( 'method' => 'stream.removeLike', @@ -1117,7 +1097,6 @@ BODY; ); if (!empty($result) && result == true) { - common_log( LOG_INFO, sprintf( @@ -1133,7 +1112,6 @@ BODY; } else { throw new FacebookApiException(var_export($result, true)); } - } catch (FacebookApiException $e) { common_log( LOG_WARNING, @@ -1151,5 +1129,4 @@ BODY; } } } - }