Add translator documentation.

Broke a few long lines.
i18n/L10n updates.
Whitespace updates.
This commit is contained in:
Siebrand Mazeland 2011-06-19 15:02:31 +02:00
parent 42b28547d5
commit 0155198ffa
17 changed files with 146 additions and 77 deletions

View File

@ -139,8 +139,6 @@ File type and size limitations on attachments will be applied, so beware some
attachments may not make it through. attachments may not make it through.
Code structure Code structure
============== ==============
@ -179,4 +177,3 @@ Yammer_notice_stub: data object for temporary storage of fetched Yammer messages
Yammer_user, Yammer_user,
Yammer_group, Yammer_group,
Yammer_notice: data objects mapping original Yammer item IDs to their local copies. Yammer_notice: data objects mapping original Yammer item IDs to their local copies.

View File

@ -42,6 +42,7 @@ class YammeradminpanelAction extends AdminPanelAction
*/ */
function title() function title()
{ {
// TRANS: Page title for Yammer import administration panel.
return _m('Yammer Import'); return _m('Yammer Import');
} }
@ -52,6 +53,7 @@ class YammeradminpanelAction extends AdminPanelAction
*/ */
function getInstructions() function getInstructions()
{ {
// TRANS: Instructions for Yammer import administration panel.
return _m('This Yammer import tool is still undergoing testing, ' . return _m('This Yammer import tool is still undergoing testing, ' .
'and is incomplete in some areas. ' . 'and is incomplete in some areas. ' .
'Currently user subscriptions and group memberships are not ' . 'Currently user subscriptions and group memberships are not ' .
@ -111,7 +113,8 @@ class YammeradminpanelAction extends AdminPanelAction
} else if ($this->subaction == 'progress') { } else if ($this->subaction == 'progress') {
$form = $this->statusForm(); $form = $this->statusForm();
} else { } 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); return $this->showAjaxForm($form);
} }
@ -132,6 +135,7 @@ class YammeradminpanelAction extends AdminPanelAction
{ {
$this->startHTML('text/xml;charset=utf-8'); $this->startHTML('text/xml;charset=utf-8');
$this->elementStart('head'); $this->elementStart('head');
// TRANS: Page title for Yammer import administration panel.
$this->element('title', null, _m('Yammer import')); $this->element('title', null, _m('Yammer import'));
$this->elementEnd('head'); $this->elementEnd('head');
$this->elementStart('body'); $this->elementStart('body');

View File

@ -33,7 +33,6 @@ if (!defined('STATUSNET')) {
class YammerauthAction extends AdminPanelAction class YammerauthAction extends AdminPanelAction
{ {
/** /**
* Show the Yammer admin panel form * Show the Yammer admin panel form
* *
@ -55,7 +54,6 @@ class YammerauthAction extends AdminPanelAction
* *
* @return void * @return void
*/ */
function handle($args) function handle($args)
{ {
if ($this->verify_token) { if ($this->verify_token) {
@ -68,6 +66,7 @@ class YammerauthAction extends AdminPanelAction
$this->startHTML('text/xml;charset=utf-8'); $this->startHTML('text/xml;charset=utf-8');
$this->elementStart('head'); $this->elementStart('head');
// TRANS: Page title for Yammer administration panel.
$this->element('title', null, _m('Connect to Yammer')); $this->element('title', null, _m('Connect to Yammer'));
$this->elementEnd('head'); $this->elementEnd('head');
$this->elementStart('body'); $this->elementStart('body');
@ -76,4 +75,3 @@ class YammerauthAction extends AdminPanelAction
$this->elementEnd('html'); $this->elementEnd('html');
} }
} }

View File

@ -40,7 +40,6 @@ if (!defined('STATUSNET')) {
* - schemaDef (call self::doSchemaDef) * - schemaDef (call self::doSchemaDef)
* - record (call self::doRecord) * - record (call self::doRecord)
*/ */
class Yammer_common extends Memcached_DataObject class Yammer_common extends Memcached_DataObject
{ {
public $__table = 'yammer_XXXX'; // table name public $__table = 'yammer_XXXX'; // table name
@ -50,7 +49,7 @@ class Yammer_common extends Memcached_DataObject
public $created; // datetime 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) protected static function doSchemaDef($field)
{ {
@ -87,7 +86,6 @@ class Yammer_common extends Memcached_DataObject
* *
* @return array list of key field names * @return array list of key field names
*/ */
function keys() function keys()
{ {
return array_keys($this->keyTypes()); 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; * 'K' for primary key: for compound keys, add an entry for each component;
* 'U' for unique keys: compound keys are not well supported here. * 'U' for unique keys: compound keys are not well supported here.
*/ */
function keyTypes() function keyTypes()
{ {
return array('id' => 'K', $this->__field => 'U'); 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. * @return array magic three-false array that stops auto-incrementing.
*/ */
function sequenceKey() function sequenceKey()
{ {
return array(false, false, false); return array(false, false, false);
@ -135,7 +131,6 @@ class Yammer_common extends Memcached_DataObject
* *
* @return Yammer_common new object for this value * @return Yammer_common new object for this value
*/ */
protected static function doRecord($class, $field, $orig_id, $local_id) protected static function doRecord($class, $field, $orig_id, $local_id)
{ {
$map = parent::staticGet($class, 'id', $orig_id); $map = parent::staticGet($class, 'id', $orig_id);

View File

@ -48,7 +48,6 @@ class Yammer_group extends Yammer_common
* @return Yammer_group object found, or null for no hits * @return Yammer_group object found, or null for no hits
* *
*/ */
function staticGet($k, $v=null) function staticGet($k, $v=null)
{ {
return Memcached_DataObject::staticGet('Yammer_group', $k, $v); 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 * Return schema definition to set this table up in onCheckSchema
*/ */
static function schemaDef() static function schemaDef()
{ {
return self::doSchemaDef('group_id'); return self::doSchemaDef('group_id');
@ -71,7 +69,6 @@ class Yammer_group extends Yammer_common
* *
* @return Yammer_group new object for this value * @return Yammer_group new object for this value
*/ */
static function record($orig_id, $group_id) static function record($orig_id, $group_id)
{ {
return self::doRecord('Yammer_group', 'group_id', $orig_id, $group_id); return self::doRecord('Yammer_group', 'group_id', $orig_id, $group_id);

View File

@ -48,7 +48,6 @@ class Yammer_notice extends Yammer_common
* @return Yammer_notice object found, or null for no hits * @return Yammer_notice object found, or null for no hits
* *
*/ */
function staticGet($k, $v=null) function staticGet($k, $v=null)
{ {
return Memcached_DataObject::staticGet('Yammer_notice', $k, $v); 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 * Return schema definition to set this table up in onCheckSchema
*/ */
static function schemaDef() static function schemaDef()
{ {
return self::doSchemaDef('notice_id'); return self::doSchemaDef('notice_id');
@ -71,7 +69,6 @@ class Yammer_notice extends Yammer_common
* *
* @return Yammer_notice new object for this value * @return Yammer_notice new object for this value
*/ */
static function record($orig_id, $notice_id) static function record($orig_id, $notice_id)
{ {
return self::doRecord('Yammer_notice', 'notice_id', $orig_id, $notice_id); return self::doRecord('Yammer_notice', 'notice_id', $orig_id, $notice_id);

View File

@ -40,7 +40,6 @@ if (!defined('STATUSNET')) {
* down in reverse chronological order, then go back over them from oldest to * down in reverse chronological order, then go back over them from oldest to
* newest and actually save them into our notice table. * newest and actually save them into our notice table.
*/ */
class Yammer_notice_stub extends Memcached_DataObject class Yammer_notice_stub extends Memcached_DataObject
{ {
public $__table = 'yammer_notice_stub'; // table name public $__table = 'yammer_notice_stub'; // table name
@ -57,9 +56,7 @@ class Yammer_notice_stub extends Memcached_DataObject
* @param mixed $v Value to lookup * @param mixed $v Value to lookup
* *
* @return Yammer_notice_stub object found, or null for no hits * @return Yammer_notice_stub object found, or null for no hits
*
*/ */
function staticGet($k, $v=null) function staticGet($k, $v=null)
{ {
return Memcached_DataObject::staticGet('Yammer_notice_stub', $k, $v); 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 * @return array array of column definitions
*/ */
function table() function table()
{ {
return array('id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL, 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; * 'K' for primary key: for compound keys, add an entry for each component;
* 'U' for unique keys: compound keys are not well supported here. * 'U' for unique keys: compound keys are not well supported here.
*/ */
function keyTypes() function keyTypes()
{ {
return array('id' => 'K'); 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. * @return array magic three-false array that stops auto-incrementing.
*/ */
function sequenceKey() function sequenceKey()
{ {
return array(false, false, false); return array(false, false, false);

View File

@ -55,9 +55,7 @@ class Yammer_state extends Memcached_DataObject
* @param mixed $v Value to lookup * @param mixed $v Value to lookup
* *
* @return Yammer_state object found, or null for no hits * @return Yammer_state object found, or null for no hits
*
*/ */
function staticGet($k, $v=null) function staticGet($k, $v=null)
{ {
return Memcached_DataObject::staticGet('Yammer_state', $k, $v); return Memcached_DataObject::staticGet('Yammer_state', $k, $v);
@ -90,7 +88,6 @@ class Yammer_state extends Memcached_DataObject
* *
* @return array array of column definitions * @return array array of column definitions
*/ */
function table() function table()
{ {
return array('id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL, 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 * @return array list of key field names
*/ */
function keys() function keys()
{ {
return array_keys($this->keyTypes()); 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; * 'K' for primary key: for compound keys, add an entry for each component;
* 'U' for unique keys: compound keys are not well supported here. * 'U' for unique keys: compound keys are not well supported here.
*/ */
function keyTypes() function keyTypes()
{ {
return array('id' => 'K'); return array('id' => 'K');
@ -148,7 +143,6 @@ class Yammer_state extends Memcached_DataObject
* *
* @return array magic three-false array that stops auto-incrementing. * @return array magic three-false array that stops auto-incrementing.
*/ */
function sequenceKey() function sequenceKey()
{ {
return array(false, false, false); return array(false, false, false);

View File

@ -48,7 +48,6 @@ class Yammer_user extends Yammer_common
* @return Yammer_user object found, or null for no hits * @return Yammer_user object found, or null for no hits
* *
*/ */
function staticGet($k, $v=null) function staticGet($k, $v=null)
{ {
return Memcached_DataObject::staticGet('Yammer_user', $k, $v); 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 * Return schema definition to set this table up in onCheckSchema
*/ */
static function schemaDef() static function schemaDef()
{ {
return self::doSchemaDef('user_id'); return self::doSchemaDef('user_id');
@ -71,7 +69,6 @@ class Yammer_user extends Yammer_common
* *
* @return Yammer_user new object for this value * @return Yammer_user new object for this value
*/ */
static function record($orig_id, $user_id) static function record($orig_id, $user_id)
{ {
return self::doRecord('Yammer_user', 'user_id', $orig_id, $user_id); return self::doRecord('Yammer_user', 'user_id', $orig_id, $user_id);

View File

@ -69,7 +69,11 @@ class SN_YammerClient
if ($response->isOk()) { if ($response->isOk()) {
return $response->getBody(); return $response->getBody();
} else { } 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); $data = json_decode($body, true);
if ($data === null) { if ($data === null) {
common_log(LOG_ERR, "Invalid JSON response from Yammer API: " . $body); 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; return $data;
} }
@ -160,7 +165,8 @@ class SN_YammerClient
public function requestToken() public function requestToken()
{ {
if ($this->token || $this->tokenSecret) { 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'); $data = $this->fetchApi('oauth/request_token');
$arr = array(); $arr = array();

View File

@ -53,6 +53,7 @@ class YammerApikeyForm extends Form
*/ */
function formLegend() function formLegend()
{ {
// TRANS: Form legend for adding details to connect to a remote Yammer API.
$this->out->element('legend', null, _m('Yammer API registration')); $this->out->element('legend', null, _m('Yammer API registration'));
} }
@ -69,6 +70,7 @@ class YammerApikeyForm extends Form
$this->out->elementStart('fieldset'); $this->out->elementStart('fieldset');
$this->out->elementStart('p'); $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, ' . $this->out->text(_m('Before we can connect to your Yammer network, ' .
'you will need to register the importer as an ' . 'you will need to register the importer as an ' .
'application authorized to pull data on your behalf. ' . 'application authorized to pull data on your behalf. ' .
@ -81,21 +83,28 @@ class YammerApikeyForm extends Form
$this->out->element('a', $this->out->element('a',
array('href' => 'https://www.yammer.com/client_applications/new', array('href' => 'https://www.yammer.com/client_applications/new',
'target' => '_blank'), 'target' => '_blank'),
// TRANS: Link description to a Yammer application registration form.
_m('Open Yammer application registration form')); _m('Open Yammer application registration form'));
$this->out->elementEnd('p'); $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->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('ul', array('class' => 'form_data'));
$this->out->elementStart('li'); $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->input('consumer_key', _m('Consumer key:'), common_config('yammer', 'consumer_key'));
$this->out->elementEnd('li'); $this->out->elementEnd('li');
$this->out->elementStart('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->input('consumer_secret', _m('Consumer secret:'), common_config('yammer', 'consumer_secret'));
$this->out->elementEnd('li'); $this->out->elementEnd('li');
$this->out->elementEnd('ul'); $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'); $this->out->elementEnd('fieldset');
} }

View File

@ -45,6 +45,7 @@ class YammerAuthInitForm extends Form
*/ */
function formLegend() function formLegend()
{ {
// TRANS: Form legend.
$this->out->element('legend', null, _m('Connect to Yammer')); $this->out->element('legend', null, _m('Connect to Yammer'));
} }
@ -59,8 +60,12 @@ class YammerAuthInitForm extends Form
$this->out->hidden('subaction', 'authinit'); $this->out->hidden('subaction', 'authinit');
$this->out->elementStart('fieldset'); $this->out->elementStart('fieldset');
$this->out->submit('submit', _m('Start authentication'), 'submit', null, _m('Request authorization to connect to Yammer account')); // TRANS: Button text for starting Yammer authentication.
$this->out->submit('change-apikey', _m('Change API key')); $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'); $this->out->elementEnd('fieldset');
} }

View File

@ -53,6 +53,7 @@ class YammerAuthVerifyForm extends Form
*/ */
function formLegend() function formLegend()
{ {
// TRANS: Form legend.
$this->out->element('legend', null, _m('Connect to Yammer')); $this->out->element('legend', null, _m('Connect to Yammer'));
} }
@ -69,6 +70,7 @@ class YammerAuthVerifyForm extends Form
$this->out->elementStart('fieldset'); $this->out->elementStart('fieldset');
$this->out->elementStart('p'); $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->text(_m('Follow this link to confirm authorization at Yammer; you will be prompted to log in if necessary:'));
$this->out->elementEnd('p'); $this->out->elementEnd('p');
@ -84,18 +86,24 @@ class YammerAuthVerifyForm extends Form
$this->out->element('a', $this->out->element('a',
array('href' => $this->runner->getAuthUrl(), array('href' => $this->runner->getAuthUrl(),
'target' => '_blank'), 'target' => '_blank'),
// TRANS: Link description for a link in an external Yammer system.
_m('Open Yammer authentication window')); _m('Open Yammer authentication window'));
$this->out->elementEnd('p'); $this->out->elementEnd('p');
// TRANS: Form instructions.
$this->out->element('p', array(), _m('Copy the verification code you are given below:')); $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('ul', array('class' => 'form_data'));
$this->out->elementStart('li'); $this->out->elementStart('li');
// TRANS: Field label.
$this->out->input('verify_token', _m('Verification code:')); $this->out->input('verify_token', _m('Verification code:'));
$this->out->elementEnd('li'); $this->out->elementEnd('li');
$this->out->elementEnd('ul'); $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'); $this->out->elementEnd('fieldset');
} }

View File

@ -180,7 +180,8 @@ class YammerImporter
function prepUser($item) function prepUser($item)
{ {
if ($item['type'] != 'user') { 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']; $origId = $item['id'];
@ -227,6 +228,7 @@ class YammerImporter
$bio[] = $item['summary']; $bio[] = $item['summary'];
} }
if (!empty($item['expertise'])) { if (!empty($item['expertise'])) {
// TRANS: Used as a prefix for the Yammer expertise field contents.
$bio[] = _m('Expertise:') . ' ' . $item['expertise']; $bio[] = _m('Expertise:') . ' ' . $item['expertise'];
} }
$options['bio'] = implode("\n\n", $bio); $options['bio'] = implode("\n\n", $bio);
@ -262,7 +264,8 @@ class YammerImporter
function prepGroup($item) function prepGroup($item)
{ {
if ($item['type'] != 'group') { 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']; $origId = $item['id'];
@ -277,7 +280,6 @@ class YammerImporter
$avatar = $item['mugshot_url']; // as with user profiles... $avatar = $item['mugshot_url']; // as with user profiles...
$options['mainpage'] = common_local_url('showgroup', $options['mainpage'] = common_local_url('showgroup',
array('nickname' => $options['nickname'])); array('nickname' => $options['nickname']));
@ -285,7 +287,7 @@ class YammerImporter
$options['homepage'] = ''; $options['homepage'] = '';
$options['location'] = ''; $options['location'] = '';
$options['aliases'] = array(); $options['aliases'] = array();
// @fixme what about admin user for the group? // @todo FIXME: What about admin user for the group?
$options['local'] = true; $options['local'] = true;
return array('orig_id' => $origId, return array('orig_id' => $origId,
@ -303,7 +305,8 @@ class YammerImporter
function prepNotice($item) function prepNotice($item)
{ {
if (isset($item['type']) && $item['type'] != 'message') { 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']; $origId = $item['id'];
@ -430,7 +433,9 @@ class YammerImporter
$url = preg_replace('/_small(\..*?)$/', '$1', $url); $url = preg_replace('/_small(\..*?)$/', '$1', $url);
if (!common_valid_http_url($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 // @fixme this should be better encapsulated
@ -438,7 +443,9 @@ class YammerImporter
$temp_filename = tempnam(sys_get_temp_dir(), 'listener_avatar'); $temp_filename = tempnam(sys_get_temp_dir(), 'listener_avatar');
try { try {
if (!copy($url, $temp_filename)) { 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; $id = $dest->id;

View File

@ -60,39 +60,92 @@ class YammerProgressForm extends Form
$labels = array( $labels = array(
'init' => 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'), 'progress' => _m('No import running'),
// TRANS: "Complete" description for initialize state.
'complete' => _m('Initiated Yammer server connection...'), 'complete' => _m('Initiated Yammer server connection...'),
), ),
'requesting-auth' => array( 'requesting-auth' => array(
// TRANS: Field label for a Yammer import connect step.
'label' => _m('Connect to Yammer'), 'label' => _m('Connect to Yammer'),
// TRANS: "In progress" description.
'progress' => _m('Awaiting authorization...'), 'progress' => _m('Awaiting authorization...'),
// TRANS: "Complete" description for connect state.
'complete' => _m('Connected.'), 'complete' => _m('Connected.'),
), ),
'import-users' => array( 'import-users' => array(
// TRANS: Field label for a Yammer user import users step.
'label' => _m('Import user accounts'), 'label' => _m('Import user accounts'),
'progress' => sprintf(_m("Importing %d user...", "Importing %d users...", $userCount), $userCount), // TRANS: "In progress" description.
'complete' => sprintf(_m("Imported %d user.", "Imported %d users.", $userCount), $userCount), // 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( 'import-groups' => array(
// TRANS: Field label for a Yammer group import step.
'label' => _m('Import user groups'), 'label' => _m('Import user groups'),
'progress' => sprintf(_m("Importing %d group...", "Importing %d groups...", $groupCount), $groupCount), // TRANS: "In progress" description.
'complete' => sprintf(_m("Imported %d group.", "Imported %d groups.", $groupCount), $groupCount), // 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( 'fetch-messages' => array(
// TRANS: Field label for a Yammer import prepare notices step.
'label' => _m('Prepare public notices for import'), 'label' => _m('Prepare public notices for import'),
'progress' => sprintf(_m("Preparing %d notice...", "Preparing %d notices...", $fetchedCount), $fetchedCount), // TRANS: "In progress" description.
'complete' => sprintf(_m("Prepared %d notice.", "Prepared %d notices.", $fetchedCount), $fetchedCount), // 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( 'save-messages' => array(
// TRANS: Field label for a Yammer import notices step.
'label' => _m('Import public notices'), 'label' => _m('Import public notices'),
'progress' => sprintf(_m("Importing %d notice...", "Importing %d notices...", $savedCount), $savedCount), // TRANS: "In progress" description.
'complete' => sprintf(_m("Imported %d notice.", "Imported %d notices.", $savedCount), $savedCount), // 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( 'done' => array(
// TRANS: Field label for a Yammer import done step.
'label' => _m('Done'), 'label' => _m('Done'),
'progress' => sprintf(_m("Import is complete!")), // TRANS: "In progress" description for done step.
'complete' => sprintf(_m("Import is complete!")), 'progress' => sprintf(_m('Import is complete!')),
// TRANS: "Complete" description for done step.
'complete' => sprintf(_m('Import is complete!')),
) )
); );
$steps = array_keys($labels); $steps = array_keys($labels);
@ -105,6 +158,7 @@ class YammerProgressForm extends Form
$classes[] = 'yammer-running'; $classes[] = 'yammer-running';
} }
$this->out->elementStart('fieldset', array('class' => implode(' ', $classes))); $this->out->elementStart('fieldset', array('class' => implode(' ', $classes)));
// TRANS: Fieldset legend.
$this->out->element('legend', array(), _m('Import status')); $this->out->element('legend', array(), _m('Import status'));
foreach ($steps as $step => $state) { foreach ($steps as $step => $state) {
if ($state == 'init') { if ($state == 'init') {
@ -129,7 +183,8 @@ class YammerProgressForm extends Form
$this->progressBar($state, $this->progressBar($state,
'waiting', 'waiting',
$labels[$state]['label'], $labels[$state]['label'],
_m("Waiting...")); // TRANS: Progress bar status.
_m('Waiting...'));
} }
} }
$this->out->elementEnd('fieldset'); $this->out->elementEnd('fieldset');
@ -143,11 +198,13 @@ class YammerProgressForm extends Form
$this->out->element('div', array('class' => 'import-status'), $status); $this->out->element('div', array('class' => 'import-status'), $status);
if ($class == 'progress') { if ($class == 'progress') {
if ($state == 'done') { if ($state == 'done') {
// TRANS: Button text for resetting the import state.
$this->out->submit('abort-import', _m('Reset import state')); $this->out->submit('abort-import', _m('Reset import state'));
} else { } else {
if ($error) { if ($error) {
$this->errorBox($error); $this->errorBox($error);
} else { } else {
// TRANS: Button text for pausing an import.
$this->out->submit('pause-import', _m('Pause import')); $this->out->submit('pause-import', _m('Pause import'));
} }
} }
@ -157,11 +214,15 @@ class YammerProgressForm extends Form
private function errorBox($msg) 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')); $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('legend', array(), _m('Paused'));
$this->out->element('p', array(), $errline); $this->out->element('p', array(), $errline);
// TRANS: Button text for continuing a paused import.
$this->out->submit('continue-import', _m('Continue')); $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->submit('abort-import', _m('Abort import'));
$this->out->elementEnd('fieldset'); $this->out->elementEnd('fieldset');
} }

View File

@ -123,7 +123,8 @@ class YammerRunner
public function requestAuth() public function requestAuth()
{ {
if ($this->state->state != 'init') { 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(); $data = $this->client->requestToken();
@ -149,7 +150,8 @@ class YammerRunner
if ($this->state() == 'requesting-auth') { if ($this->state() == 'requesting-auth') {
return $this->client->authorizeUrl($this->state->oauth_token); return $this->client->authorizeUrl($this->state->oauth_token);
} else { } 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) public function saveAuthToken($verifier)
{ {
if ($this->state->state != 'requesting-auth') { 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); $data = $this->client->accessToken($verifier);
@ -353,7 +357,6 @@ class YammerRunner
return $map->count(); return $map->count();
} }
/** /**
* Count the number of Yammer groups we've mapped into our system! * Count the number of Yammer groups we've mapped into our system!
* *
@ -365,7 +368,6 @@ class YammerRunner
return $map->count(); return $map->count();
} }
/** /**
* Count the number of Yammer notices we've pulled down for pending import... * Count the number of Yammer notices we've pulled down for pending import...
* *
@ -377,7 +379,6 @@ class YammerRunner
return $map->count(); return $map->count();
} }
/** /**
* Count the number of Yammer notices we've mapped into our system! * Count the number of Yammer notices we've mapped into our system!
* *

View File

@ -4,7 +4,6 @@ if (php_sapi_name() != 'cli') {
die('no'); die('no');
} }
define('INSTALLDIR', dirname(dirname(dirname(dirname(__FILE__))))); define('INSTALLDIR', dirname(dirname(dirname(dirname(__FILE__)))));
$longoptions = array('verify=', 'reset'); $longoptions = array('verify=', 'reset');