Add translator documentation.

Whitespace updates.
i18n fixes.
This commit is contained in:
Siebrand Mazeland 2011-06-05 19:58:11 +02:00
parent fdca686298
commit 158140a118
3 changed files with 27 additions and 24 deletions

View File

@ -25,9 +25,6 @@ For example, to trust WikiHow and Wikipedia users:
), ),
)); ));
Todo: Todo:
* add a more visible indicator that validation is still outstanding * add a more visible indicator that validation is still outstanding
* test with XMPP, API posting * test with XMPP, API posting

View File

@ -50,14 +50,12 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/ * @link http://status.net/
*/ */
class RequireValidatedEmailPlugin extends Plugin class RequireValidatedEmailPlugin extends Plugin
{ {
/** /**
* Users created before this time will be grandfathered in * Users created before this time will be grandfathered in
* without the validation requirement. * without the validation requirement.
*/ */
public $grandfatherCutoff = null; public $grandfatherCutoff = null;
/** /**
@ -74,13 +72,11 @@ class RequireValidatedEmailPlugin extends Plugin
* ), * ),
* )); * ));
*/ */
public $trustedOpenIDs = array(); public $trustedOpenIDs = array();
/** /**
* Whether or not to disallow login for unvalidated users. * Whether or not to disallow login for unvalidated users.
*/ */
public $disallowLogin = false; public $disallowLogin = false;
function onAutoload($cls) function onAutoload($cls)
@ -112,13 +108,13 @@ class RequireValidatedEmailPlugin extends Plugin
* *
* @return bool hook result code * @return bool hook result code
*/ */
function onStartNoticeSave($notice) function onStartNoticeSave($notice)
{ {
$user = User::staticGet('id', $notice->profile_id); $user = User::staticGet('id', $notice->profile_id);
if (!empty($user)) { // it's a remote notice if (!empty($user)) { // it's a remote notice
if (!$this->validated($user)) { if (!$this->validated($user)) {
$msg = _m("You must validate your email address before posting."); // TRANS: Client exception thrown when trying to post notices before validating an e-mail address.
$msg = _m('You must validate your email address before posting.');
throw new ClientException($msg); throw new ClientException($msg);
} }
} }
@ -133,12 +129,12 @@ class RequireValidatedEmailPlugin extends Plugin
* *
* @return bool hook result code * @return bool hook result code
*/ */
function onStartRegisterUser(&$user, &$profile) function onStartRegisterUser(&$user, &$profile)
{ {
$email = $user->email; $email = $user->email;
if (empty($email)) { if (empty($email)) {
// TRANS: Client exception thrown when trying to register without providing an e-mail address.
throw new ClientException(_m('You must provide an email address to register.')); throw new ClientException(_m('You must provide an email address to register.'));
} }
@ -164,8 +160,7 @@ class RequireValidatedEmailPlugin extends Plugin
// Give other plugins a chance to override, if they can validate // Give other plugins a chance to override, if they can validate
// that somebody's ok despite a non-validated email. // that somebody's ok despite a non-validated email.
// FIXME: This isn't how to do it! Use Start*/End* instead // @todo FIXME: This isn't how to do it! Use Start*/End* instead
Event::handle('RequireValidatedEmailPlugin_Override', Event::handle('RequireValidatedEmailPlugin_Override',
array($user, &$knownGood)); array($user, &$knownGood));
@ -201,7 +196,6 @@ class RequireValidatedEmailPlugin extends Plugin
* *
* @return bool true if user has a trusted OpenID. * @return bool true if user has a trusted OpenID.
*/ */
function hasTrustedOpenID($user) function hasTrustedOpenID($user)
{ {
if ($this->trustedOpenIDs && class_exists('User_openid')) { if ($this->trustedOpenIDs && class_exists('User_openid')) {
@ -228,7 +222,6 @@ class RequireValidatedEmailPlugin extends Plugin
* *
* @return boolean hook value * @return boolean hook value
*/ */
function onPluginVersion(&$versions) function onPluginVersion(&$versions)
{ {
$versions[] = $versions[] =
@ -240,7 +233,9 @@ class RequireValidatedEmailPlugin extends Plugin
'homepage' => 'homepage' =>
'http://status.net/wiki/Plugin:RequireValidatedEmail', 'http://status.net/wiki/Plugin:RequireValidatedEmail',
'rawdescription' => 'rawdescription' =>
// TRANS: Plugin description.
_m('Disables posting without a validated email address.')); _m('Disables posting without a validated email address.'));
return true; return true;
} }
@ -251,7 +246,6 @@ class RequireValidatedEmailPlugin extends Plugin
* *
* @return boolean hook value * @return boolean hook value
*/ */
function onStartShowNoticeForm($action) function onStartShowNoticeForm($action)
{ {
$user = common_current_user(); $user = common_current_user();

View File

@ -44,7 +44,6 @@ if (!defined('STATUSNET')) {
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/ * @link http://status.net/
*/ */
class ConfirmfirstemailAction extends Action class ConfirmfirstemailAction extends Action
{ {
public $confirm; public $confirm;
@ -59,13 +58,13 @@ class ConfirmfirstemailAction extends Action
* *
* @return boolean true * @return boolean true
*/ */
function prepare($argarray) function prepare($argarray)
{ {
parent::prepare($argarray); parent::prepare($argarray);
$user = common_current_user(); $user = common_current_user();
if (!empty($user)) { if (!empty($user)) {
// TRANS: Client exception thrown when trying to register while already logged in.
throw new ClientException(_m('You are already logged in.')); throw new ClientException(_m('You are already logged in.'));
} }
@ -74,6 +73,7 @@ class ConfirmfirstemailAction extends Action
$this->confirm = Confirm_address::staticGet('code', $this->code); $this->confirm = Confirm_address::staticGet('code', $this->code);
if (empty($this->confirm)) { if (empty($this->confirm)) {
// TRANS: Client exception thrown when trying to register with a non-existing confirmation code.
throw new ClientException(_m('Confirmation code not found.')); throw new ClientException(_m('Confirmation code not found.'));
return; return;
} }
@ -81,12 +81,15 @@ class ConfirmfirstemailAction extends Action
$this->user = User::staticGet('id', $this->confirm->user_id); $this->user = User::staticGet('id', $this->confirm->user_id);
if (empty($this->user)) { if (empty($this->user)) {
// TRANS: Client exception thrown when trying to register with a confirmation code that is not connected with a user.
throw new ServerException(_m('No user for that confirmation code.')); throw new ServerException(_m('No user for that confirmation code.'));
} }
$type = $this->confirm->address_type; $type = $this->confirm->address_type;
if ($type != 'email') { if ($type != 'email') {
// TRANS: Client exception thrown when trying to register with a invalid e-mail address.
// TRANS: %s is the invalid e-mail address.
throw new ServerException(sprintf(_m('Unrecognized address type %s.'), $type)); throw new ServerException(sprintf(_m('Unrecognized address type %s.'), $type));
} }
@ -103,10 +106,12 @@ class ConfirmfirstemailAction extends Action
$confirm = $this->trimmed('confirm'); $confirm = $this->trimmed('confirm');
if (strlen($password) < 6) { if (strlen($password) < 6) {
// TRANS: Client exception thrown when trying to register with too short a password.
throw new ClientException(_m('Password too short.')); throw new ClientException(_m('Password too short.'));
return; return;
} else if (0 != strcmp($password, $confirm)) { } else if (0 != strcmp($password, $confirm)) {
throw new ClientException(_m("Passwords do not match.")); // TRANS: Client exception thrown when trying to register without providing the same password twice.
throw new ClientException(_m('Passwords do not match.'));
return; return;
} }
@ -123,7 +128,6 @@ class ConfirmfirstemailAction extends Action
* *
* @return void * @return void
*/ */
function handle($argarray=null) function handle($argarray=null)
{ {
$homepage = common_local_url('all', $homepage = common_local_url('all',
@ -162,6 +166,7 @@ class ConfirmfirstemailAction extends Action
function showContent() function showContent()
{ {
$this->element('p', 'instructions', $this->element('p', 'instructions',
// TRANS: Form instructions. %s is the nickname of the to be registered user.
sprintf(_m('You have confirmed the email address for your new user account %s. '. sprintf(_m('You have confirmed the email address for your new user account %s. '.
'Use the form below to set your new password.'), 'Use the form below to set your new password.'),
$this->user->nickname)); $this->user->nickname));
@ -172,6 +177,7 @@ class ConfirmfirstemailAction extends Action
function title() function title()
{ {
// TRANS: Page title.
return _m('Set a password'); return _m('Set a password');
} }
} }
@ -188,7 +194,8 @@ class ConfirmFirstEmailForm extends Form
function formLegend() function formLegend()
{ {
return _m('Confirm email'); // TRANS: Form legend.
return _m('Confirm email address');
} }
function action() function action()
@ -206,11 +213,15 @@ class ConfirmFirstEmailForm extends Form
{ {
$this->out->elementStart('ul', 'form_data'); $this->out->elementStart('ul', 'form_data');
$this->out->elementStart('li'); $this->out->elementStart('li');
// TRANS: Field label.
$this->out->password('password', _m('New password'), $this->out->password('password', _m('New password'),
// TRANS: Field title for password field.
_m('6 or more characters.')); _m('6 or more characters.'));
$this->out->elementEnd('li'); $this->out->elementEnd('li');
$this->out->elementStart('li'); $this->out->elementStart('li');
$this->out->password('confirm', _m('Confirm'), // TRANS: Field label for repeat password field.
$this->out->password('confirm', _m('LABEL','Confirm'),
// TRANS: Field title for repeat password field.
_m('Same as password above.')); _m('Same as password above.'));
$this->out->elementEnd('li'); $this->out->elementEnd('li');
$this->out->elementEnd('ul'); $this->out->elementEnd('ul');
@ -218,6 +229,7 @@ class ConfirmFirstEmailForm extends Form
function formActions() function formActions()
{ {
$this->out->submit('save', _m('Save')); // TRANS: Button text for completing registration by e-mail.
$this->out->submit('save', _m('BUTTON','Save'));
} }
} }