From: Siebrand Mazeland Date: Sun, 19 Jun 2011 13:02:31 +0000 (+0200) Subject: Add translator documentation. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=0155198ffaaa06f17eeb974fe7712aa62b86bed6;p=quix0rs-gnu-social.git Add translator documentation. Broke a few long lines. i18n/L10n updates. Whitespace updates. --- diff --git a/plugins/YammerImport/README b/plugins/YammerImport/README index 975faa2132..db16744dce 100644 --- a/plugins/YammerImport/README +++ b/plugins/YammerImport/README @@ -139,8 +139,6 @@ File type and size limitations on attachments will be applied, so beware some attachments may not make it through. - - Code structure ============== @@ -179,4 +177,3 @@ Yammer_notice_stub: data object for temporary storage of fetched Yammer messages Yammer_user, Yammer_group, Yammer_notice: data objects mapping original Yammer item IDs to their local copies. - diff --git a/plugins/YammerImport/actions/yammeradminpanel.php b/plugins/YammerImport/actions/yammeradminpanel.php index 4714154290..493762e2cd 100644 --- a/plugins/YammerImport/actions/yammeradminpanel.php +++ b/plugins/YammerImport/actions/yammeradminpanel.php @@ -42,6 +42,7 @@ class YammeradminpanelAction extends AdminPanelAction */ function title() { + // TRANS: Page title for Yammer import administration panel. return _m('Yammer Import'); } @@ -52,6 +53,7 @@ class YammeradminpanelAction extends AdminPanelAction */ function getInstructions() { + // TRANS: Instructions for Yammer import administration panel. return _m('This Yammer import tool is still undergoing testing, ' . 'and is incomplete in some areas. ' . 'Currently user subscriptions and group memberships are not ' . @@ -111,7 +113,8 @@ class YammeradminpanelAction extends AdminPanelAction } else if ($this->subaction == 'progress') { $form = $this->statusForm(); } else { - throw new ClientException('Invalid POST'); + // TRANS: Client exception thrown when encountering an unhandled sub action. + throw new ClientException(_m('Invalid POST')); } return $this->showAjaxForm($form); } @@ -132,6 +135,7 @@ class YammeradminpanelAction extends AdminPanelAction { $this->startHTML('text/xml;charset=utf-8'); $this->elementStart('head'); + // TRANS: Page title for Yammer import administration panel. $this->element('title', null, _m('Yammer import')); $this->elementEnd('head'); $this->elementStart('body'); diff --git a/plugins/YammerImport/actions/yammerauth.php b/plugins/YammerImport/actions/yammerauth.php index d0d4b40c71..d25be91440 100644 --- a/plugins/YammerImport/actions/yammerauth.php +++ b/plugins/YammerImport/actions/yammerauth.php @@ -33,7 +33,6 @@ if (!defined('STATUSNET')) { class YammerauthAction extends AdminPanelAction { - /** * Show the Yammer admin panel form * @@ -42,7 +41,7 @@ class YammerauthAction extends AdminPanelAction function prepare($args) { parent::prepare($args); - + $this->verify_token = $this->trim('verify_token'); } @@ -55,7 +54,6 @@ class YammerauthAction extends AdminPanelAction * * @return void */ - function handle($args) { if ($this->verify_token) { @@ -68,6 +66,7 @@ class YammerauthAction extends AdminPanelAction $this->startHTML('text/xml;charset=utf-8'); $this->elementStart('head'); + // TRANS: Page title for Yammer administration panel. $this->element('title', null, _m('Connect to Yammer')); $this->elementEnd('head'); $this->elementStart('body'); @@ -76,4 +75,3 @@ class YammerauthAction extends AdminPanelAction $this->elementEnd('html'); } } - diff --git a/plugins/YammerImport/classes/Yammer_common.php b/plugins/YammerImport/classes/Yammer_common.php index 6ec6fc9041..e262623263 100644 --- a/plugins/YammerImport/classes/Yammer_common.php +++ b/plugins/YammerImport/classes/Yammer_common.php @@ -40,7 +40,6 @@ if (!defined('STATUSNET')) { * - schemaDef (call self::doSchemaDef) * - record (call self::doRecord) */ - class Yammer_common extends Memcached_DataObject { public $__table = 'yammer_XXXX'; // table name @@ -50,7 +49,7 @@ class Yammer_common extends Memcached_DataObject public $created; // datetime /** - * @fixme add a 'references' thing for the foreign key when we support that + * @todo FIXME: Add a 'references' thing for the foreign key when we support that */ protected static function doSchemaDef($field) { @@ -87,7 +86,6 @@ class Yammer_common extends Memcached_DataObject * * @return array list of key field names */ - function keys() { return array_keys($this->keyTypes()); @@ -105,7 +103,6 @@ class Yammer_common 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('id' => 'K', $this->__field => 'U'); @@ -121,7 +118,6 @@ class Yammer_common extends Memcached_DataObject * * @return array magic three-false array that stops auto-incrementing. */ - function sequenceKey() { return array(false, false, false); @@ -135,7 +131,6 @@ class Yammer_common extends Memcached_DataObject * * @return Yammer_common new object for this value */ - protected static function doRecord($class, $field, $orig_id, $local_id) { $map = parent::staticGet($class, 'id', $orig_id); diff --git a/plugins/YammerImport/classes/Yammer_group.php b/plugins/YammerImport/classes/Yammer_group.php index 4e7a6ebd03..a52b5119d4 100644 --- a/plugins/YammerImport/classes/Yammer_group.php +++ b/plugins/YammerImport/classes/Yammer_group.php @@ -48,7 +48,6 @@ class Yammer_group extends Yammer_common * @return Yammer_group object found, or null for no hits * */ - function staticGet($k, $v=null) { return Memcached_DataObject::staticGet('Yammer_group', $k, $v); @@ -57,7 +56,6 @@ class Yammer_group extends Yammer_common /** * Return schema definition to set this table up in onCheckSchema */ - static function schemaDef() { return self::doSchemaDef('group_id'); @@ -71,7 +69,6 @@ class Yammer_group extends Yammer_common * * @return Yammer_group new object for this value */ - static function record($orig_id, $group_id) { return self::doRecord('Yammer_group', 'group_id', $orig_id, $group_id); diff --git a/plugins/YammerImport/classes/Yammer_notice.php b/plugins/YammerImport/classes/Yammer_notice.php index 0f63db6303..118266aed0 100644 --- a/plugins/YammerImport/classes/Yammer_notice.php +++ b/plugins/YammerImport/classes/Yammer_notice.php @@ -48,7 +48,6 @@ class Yammer_notice extends Yammer_common * @return Yammer_notice object found, or null for no hits * */ - function staticGet($k, $v=null) { return Memcached_DataObject::staticGet('Yammer_notice', $k, $v); @@ -57,7 +56,6 @@ class Yammer_notice extends Yammer_common /** * Return schema definition to set this table up in onCheckSchema */ - static function schemaDef() { return self::doSchemaDef('notice_id'); @@ -71,7 +69,6 @@ class Yammer_notice extends Yammer_common * * @return Yammer_notice new object for this value */ - static function record($orig_id, $notice_id) { return self::doRecord('Yammer_notice', 'notice_id', $orig_id, $notice_id); diff --git a/plugins/YammerImport/classes/Yammer_notice_stub.php b/plugins/YammerImport/classes/Yammer_notice_stub.php index e10300c4c7..6dd78206d2 100644 --- a/plugins/YammerImport/classes/Yammer_notice_stub.php +++ b/plugins/YammerImport/classes/Yammer_notice_stub.php @@ -40,7 +40,6 @@ if (!defined('STATUSNET')) { * down in reverse chronological order, then go back over them from oldest to * newest and actually save them into our notice table. */ - class Yammer_notice_stub extends Memcached_DataObject { public $__table = 'yammer_notice_stub'; // table name @@ -57,9 +56,7 @@ class Yammer_notice_stub extends Memcached_DataObject * @param mixed $v Value to lookup * * @return Yammer_notice_stub object found, or null for no hits - * */ - function staticGet($k, $v=null) { return Memcached_DataObject::staticGet('Yammer_notice_stub', $k, $v); @@ -86,7 +83,6 @@ class Yammer_notice_stub extends Memcached_DataObject * * @return array array of column definitions */ - function table() { return array('id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL, @@ -121,7 +117,6 @@ class Yammer_notice_stub 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('id' => 'K'); @@ -137,7 +132,6 @@ class Yammer_notice_stub extends Memcached_DataObject * * @return array magic three-false array that stops auto-incrementing. */ - function sequenceKey() { return array(false, false, false); diff --git a/plugins/YammerImport/classes/Yammer_state.php b/plugins/YammerImport/classes/Yammer_state.php index 88bd693bfd..548fbbf024 100644 --- a/plugins/YammerImport/classes/Yammer_state.php +++ b/plugins/YammerImport/classes/Yammer_state.php @@ -55,9 +55,7 @@ class Yammer_state extends Memcached_DataObject * @param mixed $v Value to lookup * * @return Yammer_state object found, or null for no hits - * */ - function staticGet($k, $v=null) { return Memcached_DataObject::staticGet('Yammer_state', $k, $v); @@ -90,7 +88,6 @@ class Yammer_state extends Memcached_DataObject * * @return array array of column definitions */ - function table() { return array('id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL, @@ -114,7 +111,6 @@ class Yammer_state extends Memcached_DataObject * * @return array list of key field names */ - function keys() { return array_keys($this->keyTypes()); @@ -132,7 +128,6 @@ class Yammer_state 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('id' => 'K'); @@ -148,7 +143,6 @@ class Yammer_state extends Memcached_DataObject * * @return array magic three-false array that stops auto-incrementing. */ - function sequenceKey() { return array(false, false, false); diff --git a/plugins/YammerImport/classes/Yammer_user.php b/plugins/YammerImport/classes/Yammer_user.php index f6fcd6c3cb..8139613347 100644 --- a/plugins/YammerImport/classes/Yammer_user.php +++ b/plugins/YammerImport/classes/Yammer_user.php @@ -48,7 +48,6 @@ class Yammer_user extends Yammer_common * @return Yammer_user object found, or null for no hits * */ - function staticGet($k, $v=null) { return Memcached_DataObject::staticGet('Yammer_user', $k, $v); @@ -57,7 +56,6 @@ class Yammer_user extends Yammer_common /** * Return schema definition to set this table up in onCheckSchema */ - static function schemaDef() { return self::doSchemaDef('user_id'); @@ -71,7 +69,6 @@ class Yammer_user extends Yammer_common * * @return Yammer_user new object for this value */ - static function record($orig_id, $user_id) { return self::doRecord('Yammer_user', 'user_id', $orig_id, $user_id); diff --git a/plugins/YammerImport/lib/sn_yammerclient.php b/plugins/YammerImport/lib/sn_yammerclient.php index 5da1cc5e7e..2827bdc53a 100644 --- a/plugins/YammerImport/lib/sn_yammerclient.php +++ b/plugins/YammerImport/lib/sn_yammerclient.php @@ -19,7 +19,7 @@ /** * Basic client class for Yammer's OAuth/JSON API. - * + * * @package YammerImportPlugin * @author Brion Vibber */ @@ -69,7 +69,11 @@ class SN_YammerClient if ($response->isOk()) { return $response->getBody(); } else { - throw new Exception("Yammer API returned HTTP code " . $response->getStatus() . ': ' . $response->getBody()); + // TRANS: Exeption thrown when an external Yammer system gives an error. + // TRANS: %1$s is an HTTP error code, %2$s is the error message body. + throw new Exception(sprintf(_m('Yammer API returned HTTP code %1$s: %2$s'), + $response->getStatus(), + $response->getBody())); } } @@ -106,7 +110,8 @@ class SN_YammerClient $data = json_decode($body, true); if ($data === null) { common_log(LOG_ERR, "Invalid JSON response from Yammer API: " . $body); - throw new Exception("Invalid JSON response from Yammer API"); + // TRANS: Exeption thrown when an external Yammer system an invalid JSON response. + throw new Exception(_m('Invalid JSON response from Yammer API.')); } return $data; } @@ -160,7 +165,8 @@ class SN_YammerClient public function requestToken() { if ($this->token || $this->tokenSecret) { - throw new Exception("Requesting a token, but already set up with a token"); + // TRANS: Exeption thrown when a trust relationship has already been established. + throw new Exception(_m('Requesting a token, but already set up with a token.')); } $data = $this->fetchApi('oauth/request_token'); $arr = array(); diff --git a/plugins/YammerImport/lib/yammerapikeyform.php b/plugins/YammerImport/lib/yammerapikeyform.php index b2acec4ede..72c14c30ce 100644 --- a/plugins/YammerImport/lib/yammerapikeyform.php +++ b/plugins/YammerImport/lib/yammerapikeyform.php @@ -53,6 +53,7 @@ class YammerApikeyForm extends Form */ function formLegend() { + // TRANS: Form legend for adding details to connect to a remote Yammer API. $this->out->element('legend', null, _m('Yammer API registration')); } @@ -69,6 +70,7 @@ class YammerApikeyForm extends Form $this->out->elementStart('fieldset'); $this->out->elementStart('p'); + // TRANS: Explanation of what needs to be done to connect to a Yammer network. $this->out->text(_m('Before we can connect to your Yammer network, ' . 'you will need to register the importer as an ' . 'application authorized to pull data on your behalf. ' . @@ -81,21 +83,28 @@ class YammerApikeyForm extends Form $this->out->element('a', array('href' => 'https://www.yammer.com/client_applications/new', 'target' => '_blank'), + // TRANS: Link description to a Yammer application registration form. _m('Open Yammer application registration form')); $this->out->elementEnd('p'); + // TRANS: Instructions. $this->out->element('p', array(), _m('Copy the consumer key and secret you are given into the form below:')); $this->out->elementStart('ul', array('class' => 'form_data')); $this->out->elementStart('li'); + // TRANS: Field label for a Yammer consumer key. $this->out->input('consumer_key', _m('Consumer key:'), common_config('yammer', 'consumer_key')); $this->out->elementEnd('li'); $this->out->elementStart('li'); + // TRANS: Field label for a Yammer consumer secret. $this->out->input('consumer_secret', _m('Consumer secret:'), common_config('yammer', 'consumer_secret')); $this->out->elementEnd('li'); $this->out->elementEnd('ul'); - $this->out->submit('submit', _m('Save'), 'submit', null, _m('Save these consumer keys')); + // TRANS: Button text for saving a Yammer API registration. + $this->out->submit('submit', _m('BUTTON','Save'), + // TRANS: Button title for saving a Yammer API registration. + 'submit', null, _m('Save the entered consumer key and consumer secret.')); $this->out->elementEnd('fieldset'); } diff --git a/plugins/YammerImport/lib/yammerauthinitform.php b/plugins/YammerImport/lib/yammerauthinitform.php index 9f48fd82a5..c123bbbb9d 100644 --- a/plugins/YammerImport/lib/yammerauthinitform.php +++ b/plugins/YammerImport/lib/yammerauthinitform.php @@ -45,6 +45,7 @@ class YammerAuthInitForm extends Form */ function formLegend() { + // TRANS: Form legend. $this->out->element('legend', null, _m('Connect to Yammer')); } @@ -59,8 +60,12 @@ class YammerAuthInitForm extends Form $this->out->hidden('subaction', 'authinit'); $this->out->elementStart('fieldset'); - $this->out->submit('submit', _m('Start authentication'), 'submit', null, _m('Request authorization to connect to Yammer account')); - $this->out->submit('change-apikey', _m('Change API key')); + // TRANS: Button text for starting Yammer authentication. + $this->out->submit('submit', _m('BUTTON','Start authentication'), + // TRANS: Button title for starting Yammer authentication. + 'submit', null, _m('Request authorization to connect to a Yammer account.')); + // TRANS: Button text for starting changing a Yammer API key. + $this->out->submit('change-apikey', _m('BUTTON','Change API key')); $this->out->elementEnd('fieldset'); } diff --git a/plugins/YammerImport/lib/yammerauthverifyform.php b/plugins/YammerImport/lib/yammerauthverifyform.php index e119be96f7..bb82eba6ae 100644 --- a/plugins/YammerImport/lib/yammerauthverifyform.php +++ b/plugins/YammerImport/lib/yammerauthverifyform.php @@ -53,6 +53,7 @@ class YammerAuthVerifyForm extends Form */ function formLegend() { + // TRANS: Form legend. $this->out->element('legend', null, _m('Connect to Yammer')); } @@ -69,6 +70,7 @@ class YammerAuthVerifyForm extends Form $this->out->elementStart('fieldset'); $this->out->elementStart('p'); + // TRANS: Form instructions. $this->out->text(_m('Follow this link to confirm authorization at Yammer; you will be prompted to log in if necessary:')); $this->out->elementEnd('p'); @@ -84,18 +86,24 @@ class YammerAuthVerifyForm extends Form $this->out->element('a', array('href' => $this->runner->getAuthUrl(), 'target' => '_blank'), + // TRANS: Link description for a link in an external Yammer system. _m('Open Yammer authentication window')); $this->out->elementEnd('p'); - + + // TRANS: Form instructions. $this->out->element('p', array(), _m('Copy the verification code you are given below:')); $this->out->elementStart('ul', array('class' => 'form_data')); $this->out->elementStart('li'); + // TRANS: Field label. $this->out->input('verify_token', _m('Verification code:')); $this->out->elementEnd('li'); $this->out->elementEnd('ul'); - - $this->out->submit('submit', _m('Continue'), 'submit', null, _m('Save code and begin import')); + + // TRANS: Button text for saving Yammer authorisation data and starting Yammer import. + $this->out->submit('submit', _m('BUTTON','Continue'), + // TRANS: Button title for saving Yammer authorisation data and starting Yammer import. + 'submit', null, _m('Save the verification code and begin import.')); $this->out->elementEnd('fieldset'); } diff --git a/plugins/YammerImport/lib/yammerimporter.php b/plugins/YammerImport/lib/yammerimporter.php index 93bc96d529..ffc88ab473 100644 --- a/plugins/YammerImport/lib/yammerimporter.php +++ b/plugins/YammerImport/lib/yammerimporter.php @@ -34,7 +34,7 @@ class YammerImporter /** * Load or create an imported profile from Yammer data. - * + * * @param object $item loaded JSON data for Yammer importer * @return Profile */ @@ -180,7 +180,8 @@ class YammerImporter function prepUser($item) { if ($item['type'] != 'user') { - throw new Exception('Wrong item type sent to Yammer user import processing.'); + // TRANS: Exception thrown when a non-user item type is used, but expected. + throw new Exception(_m('Wrong item type sent to Yammer user import processing.')); } $origId = $item['id']; @@ -227,6 +228,7 @@ class YammerImporter $bio[] = $item['summary']; } if (!empty($item['expertise'])) { + // TRANS: Used as a prefix for the Yammer expertise field contents. $bio[] = _m('Expertise:') . ' ' . $item['expertise']; } $options['bio'] = implode("\n\n", $bio); @@ -262,7 +264,8 @@ class YammerImporter function prepGroup($item) { if ($item['type'] != 'group') { - throw new Exception('Wrong item type sent to Yammer group import processing.'); + // TRANS: Exception thrown when a non-group item type is used, but expected. + throw new Exception(_m('Wrong item type sent to Yammer group import processing.')); } $origId = $item['id']; @@ -277,7 +280,6 @@ class YammerImporter $avatar = $item['mugshot_url']; // as with user profiles... - $options['mainpage'] = common_local_url('showgroup', array('nickname' => $options['nickname'])); @@ -285,7 +287,7 @@ class YammerImporter $options['homepage'] = ''; $options['location'] = ''; $options['aliases'] = array(); - // @fixme what about admin user for the group? + // @todo FIXME: What about admin user for the group? $options['local'] = true; return array('orig_id' => $origId, @@ -303,7 +305,8 @@ class YammerImporter function prepNotice($item) { if (isset($item['type']) && $item['type'] != 'message') { - throw new Exception('Wrong item type sent to Yammer message import processing.'); + // TRANS: Exception thrown when a non-message item type is used, but expected. + throw new Exception(_m('Wrong item type sent to Yammer message import processing.')); } $origId = $item['id']; @@ -430,7 +433,9 @@ class YammerImporter $url = preg_replace('/_small(\..*?)$/', '$1', $url); if (!common_valid_http_url($url)) { - throw new ServerException(sprintf(_m("Invalid avatar URL %s."), $url)); + // TRANS: Server exception thrown when an avatar URL is invalid. + // TRANS: %s is the invalid avatar URL. + throw new ServerException(sprintf(_m('Invalid avatar URL %s.'), $url)); } // @fixme this should be better encapsulated @@ -438,7 +443,9 @@ class YammerImporter $temp_filename = tempnam(sys_get_temp_dir(), 'listener_avatar'); try { if (!copy($url, $temp_filename)) { - throw new ServerException(sprintf(_m("Unable to fetch avatar from %s."), $url)); + // TRANS: Server exception thrown when an avatar could not be fetched. + // TRANS: %s is the failed avatar URL. + throw new ServerException(sprintf(_m('Unable to fetch avatar from %s.'), $url)); } $id = $dest->id; diff --git a/plugins/YammerImport/lib/yammerprogressform.php b/plugins/YammerImport/lib/yammerprogressform.php index 9bf8332261..0b73472a4d 100644 --- a/plugins/YammerImport/lib/yammerprogressform.php +++ b/plugins/YammerImport/lib/yammerprogressform.php @@ -60,39 +60,92 @@ class YammerProgressForm extends Form $labels = array( 'init' => array( - 'label' => _m("Initialize"), + // TRANS: Field label for a Yammer import initialise step. + 'label' => _m('Initialize'), + // TRANS: "In progress" description. 'progress' => _m('No import running'), + // TRANS: "Complete" description for initialize state. 'complete' => _m('Initiated Yammer server connection...'), ), 'requesting-auth' => array( + // TRANS: Field label for a Yammer import connect step. 'label' => _m('Connect to Yammer'), + // TRANS: "In progress" description. 'progress' => _m('Awaiting authorization...'), + // TRANS: "Complete" description for connect state. 'complete' => _m('Connected.'), ), 'import-users' => array( + // TRANS: Field label for a Yammer user import users step. 'label' => _m('Import user accounts'), - 'progress' => sprintf(_m("Importing %d user...", "Importing %d users...", $userCount), $userCount), - 'complete' => sprintf(_m("Imported %d user.", "Imported %d users.", $userCount), $userCount), + // TRANS: "In progress" description. + // TRANS: %d is the number of users to be imported. + 'progress' => sprintf(_m('Importing %d user...', + 'Importing %d users...', + $userCount), + $userCount), + // TRANS: "Complete" description for step. + // TRANS: %d is the number of users imported. + 'complete' => sprintf(_m('Imported %d user.', + 'Imported %d users.', + $userCount), + $userCount), ), 'import-groups' => array( + // TRANS: Field label for a Yammer group import step. 'label' => _m('Import user groups'), - 'progress' => sprintf(_m("Importing %d group...", "Importing %d groups...", $groupCount), $groupCount), - 'complete' => sprintf(_m("Imported %d group.", "Imported %d groups.", $groupCount), $groupCount), + // TRANS: "In progress" description. + // TRANS: %d is the number of groups to be imported. + 'progress' => sprintf(_m('Importing %d group...', + 'Importing %d groups...', + $groupCount), + $groupCount), + // TRANS: "Complete" description for step. + // TRANS: %d is the number of groups imported. + 'complete' => sprintf(_m('Imported %d group.', + 'Imported %d groups.', + $groupCount), + $groupCount), ), 'fetch-messages' => array( + // TRANS: Field label for a Yammer import prepare notices step. 'label' => _m('Prepare public notices for import'), - 'progress' => sprintf(_m("Preparing %d notice...", "Preparing %d notices...", $fetchedCount), $fetchedCount), - 'complete' => sprintf(_m("Prepared %d notice.", "Prepared %d notices.", $fetchedCount), $fetchedCount), + // TRANS: "In progress" description. + // TRANS: %d is the number of notices to be prepared for import. + 'progress' => sprintf(_m('Preparing %d notice...', + 'Preparing %d notices...', + $fetchedCount), + $fetchedCount), + // TRANS: "Complete" description for step. + // TRANS: %d is the number of notices prepared for import. + 'complete' => sprintf(_m('Prepared %d notice.', + 'Prepared %d notices.', + $fetchedCount), + $fetchedCount), ), 'save-messages' => array( + // TRANS: Field label for a Yammer import notices step. 'label' => _m('Import public notices'), - 'progress' => sprintf(_m("Importing %d notice...", "Importing %d notices...", $savedCount), $savedCount), - 'complete' => sprintf(_m("Imported %d notice.", "Imported %d notices.", $savedCount), $savedCount), + // TRANS: "In progress" description. + // TRANS: %d is the number of notices to be imported. + 'progress' => sprintf(_m('Importing %d notice...', + 'Importing %d notices...', + $savedCount), + $savedCount), + // TRANS: "Complete" description for step. + // TRANS: %d is the number of notices imported. + 'complete' => sprintf(_m('Imported %d notice.', + 'Imported %d notices.', + $savedCount), + $savedCount), ), 'done' => array( + // TRANS: Field label for a Yammer import done step. 'label' => _m('Done'), - 'progress' => sprintf(_m("Import is complete!")), - 'complete' => sprintf(_m("Import is complete!")), + // TRANS: "In progress" description for done step. + 'progress' => sprintf(_m('Import is complete!')), + // TRANS: "Complete" description for done step. + 'complete' => sprintf(_m('Import is complete!')), ) ); $steps = array_keys($labels); @@ -105,6 +158,7 @@ class YammerProgressForm extends Form $classes[] = 'yammer-running'; } $this->out->elementStart('fieldset', array('class' => implode(' ', $classes))); + // TRANS: Fieldset legend. $this->out->element('legend', array(), _m('Import status')); foreach ($steps as $step => $state) { if ($state == 'init') { @@ -129,7 +183,8 @@ class YammerProgressForm extends Form $this->progressBar($state, 'waiting', $labels[$state]['label'], - _m("Waiting...")); + // TRANS: Progress bar status. + _m('Waiting...')); } } $this->out->elementEnd('fieldset'); @@ -143,11 +198,13 @@ class YammerProgressForm extends Form $this->out->element('div', array('class' => 'import-status'), $status); if ($class == 'progress') { if ($state == 'done') { + // TRANS: Button text for resetting the import state. $this->out->submit('abort-import', _m('Reset import state')); } else { if ($error) { $this->errorBox($error); } else { + // TRANS: Button text for pausing an import. $this->out->submit('pause-import', _m('Pause import')); } } @@ -157,11 +214,15 @@ class YammerProgressForm extends Form private function errorBox($msg) { - $errline = sprintf(_m('Encountered error "%s"'), $msg); + // TRANS: Error message. %s are the error details. + $errline = sprintf(_m('Encountered error "%s".'), $msg); $this->out->elementStart('fieldset', array('class' => 'import-error')); + // TRANS: Fieldset legend for a paused import. $this->out->element('legend', array(), _m('Paused')); $this->out->element('p', array(), $errline); + // TRANS: Button text for continuing a paused import. $this->out->submit('continue-import', _m('Continue')); + // TRANS: Button text for aborting a paused import. $this->out->submit('abort-import', _m('Abort import')); $this->out->elementEnd('fieldset'); } diff --git a/plugins/YammerImport/lib/yammerrunner.php b/plugins/YammerImport/lib/yammerrunner.php index 3e53f3361b..04cc9c0283 100644 --- a/plugins/YammerImport/lib/yammerrunner.php +++ b/plugins/YammerImport/lib/yammerrunner.php @@ -123,7 +123,8 @@ class YammerRunner public function requestAuth() { if ($this->state->state != 'init') { - throw new ServerException("Cannot request Yammer auth; already there!"); + // TRANS: Server exception thrown if a Yammer authentication request is already present. + throw new ServerException(_m('Cannot request Yammer auth; already there!')); } $data = $this->client->requestToken(); @@ -149,7 +150,8 @@ class YammerRunner if ($this->state() == 'requesting-auth') { return $this->client->authorizeUrl($this->state->oauth_token); } else { - throw new ServerException('Cannot get Yammer auth URL when not in requesting-auth state!'); + // TRANS: Server exception thrown when requesting a Yammer authentication URL while in an incorrect state. + throw new ServerException(_m('Cannot get Yammer auth URL when not in requesting-auth state!')); } } @@ -167,7 +169,9 @@ class YammerRunner public function saveAuthToken($verifier) { if ($this->state->state != 'requesting-auth') { - throw new ServerException("Cannot save auth token in Yammer import state {$this->state->state}"); + // TRANS: Server exception thrown if a Yammer authentication token could not be saved in a certain import state. + // TRANS: %s is the import state in the which the error occurred. + throw new ServerException(_m('Cannot save auth token in Yammer import state %s.',$this->state->state)); } $data = $this->client->accessToken($verifier); @@ -324,7 +328,7 @@ class YammerRunner $stub->limit(20); $stub->orderBy('id'); $stub->find(); - + if ($stub->N == 0) { common_log(LOG_INFO, "Finished saving Yammer messages; import complete!"); $this->state->state = 'done'; @@ -353,7 +357,6 @@ class YammerRunner return $map->count(); } - /** * Count the number of Yammer groups we've mapped into our system! * @@ -365,7 +368,6 @@ class YammerRunner return $map->count(); } - /** * Count the number of Yammer notices we've pulled down for pending import... * @@ -377,7 +379,6 @@ class YammerRunner return $map->count(); } - /** * Count the number of Yammer notices we've mapped into our system! * @@ -401,8 +402,8 @@ class YammerRunner /** * Record an error condition from a background run, which we should * display in progress state for the admin. - * - * @param string $msg + * + * @param string $msg */ public function recordError($msg) { @@ -428,7 +429,7 @@ class YammerRunner /** * Get the last recorded background error message, if any. - * + * * @return string */ public function lastError() diff --git a/plugins/YammerImport/scripts/yammer-import.php b/plugins/YammerImport/scripts/yammer-import.php index b4aa921e50..22b6422195 100644 --- a/plugins/YammerImport/scripts/yammer-import.php +++ b/plugins/YammerImport/scripts/yammer-import.php @@ -4,7 +4,6 @@ if (php_sapi_name() != 'cli') { die('no'); } - define('INSTALLDIR', dirname(dirname(dirname(dirname(__FILE__))))); $longoptions = array('verify=', 'reset');