Update translator documentation.

This commit is contained in:
Siebrand Mazeland 2011-04-19 01:13:28 +02:00
parent 9346d50102
commit 2c105e5575
7 changed files with 73 additions and 57 deletions

View File

@ -291,11 +291,11 @@ class InviteAction extends CurrentUserDesignAction
// TRANS: Subject for invitation email. Note that 'them' is correct as a gender-neutral // TRANS: Subject for invitation email. Note that 'them' is correct as a gender-neutral
// TRANS: singular 3rd-person pronoun in English. %1$s is the inviting user, $2$s is // TRANS: singular 3rd-person pronoun in English. %1$s is the inviting user, $2$s is
// TRANS: the StatusNet sitename. // TRANS: the StatusNet sitename.
$headers['Subject'] = sprintf(_('%1$s has invited you to join them on %2$s'), $bestname, $sitename); $headers['Subject'] = sprintf(_('%1$s has invited you to join them on %2$s'), $bestname, $sitename);
$title = (empty($personal)) ? 'invite' : 'invitepersonal'; $title = (empty($personal)) ? 'invite' : 'invitepersonal';
// @todo FIXME: i18n issue.
$inviteTemplate = DocFile::forTitle($title, DocFile::mailPaths()); $inviteTemplate = DocFile::forTitle($title, DocFile::mailPaths());
$body = $inviteTemplate->toHTML(array('inviter' => $bestname, $body = $inviteTemplate->toHTML(array('inviter' => $bestname,

View File

@ -58,11 +58,16 @@ class DomainWhitelistPlugin extends Plugin
if (!$this->matchesWhitelist($email)) { if (!$this->matchesWhitelist($email)) {
$whitelist = $this->getWhitelist(); $whitelist = $this->getWhitelist();
if (count($whitelist) == 1) { if (count($whitelist) == 1) {
$message = sprintf(_("Email address must be in this domain: %s"), // TRANS: Client exception thrown when a given e-mailaddress is not in the domain whitelist.
// TRANS: %s is a whitelisted e-mail domain.
$message = sprintf(_m('Email address must be in this domain: %s.'),
$whitelist[0]); $whitelist[0]);
} else { } else {
$message = sprintf(_("Email address must be in one of these domains: %s"), // TRANS: Client exception thrown when a given e-mailaddress is not in the domain whitelist.
implode(', ', $whitelist)); // TRANS: %s are whitelisted e-mail domains separated by comma's (localisable).
$message = sprintf(_('Email address must be in one of these domains: %s.'),
// TRANS: Separator for whitelisted domains.
implode(_m('SEPARATOR',', '), $whitelist));
} }
throw new ClientException($message); throw new ClientException($message);
} }

View File

@ -45,7 +45,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 EmailRegistrationPlugin extends Plugin class EmailRegistrationPlugin extends Plugin
{ {
function onAutoload($cls) function onAutoload($cls)
@ -88,6 +87,7 @@ class EmailRegistrationPlugin extends Plugin
{ {
$dir = dirname(__FILE__); $dir = dirname(__FILE__);
// @todo FIXME: i18n issue.
$docFile = DocFile::forTitle($title, $dir.'/doc-src/'); $docFile = DocFile::forTitle($title, $dir.'/doc-src/');
if (!empty($docFile)) { if (!empty($docFile)) {
@ -105,7 +105,8 @@ class EmailRegistrationPlugin extends Plugin
'author' => 'Evan Prodromou', 'author' => 'Evan Prodromou',
'homepage' => 'http://status.net/wiki/Plugin:EmailRegistration', 'homepage' => 'http://status.net/wiki/Plugin:EmailRegistration',
'rawdescription' => 'rawdescription' =>
_m('Use email only for registration')); // TRANS: Plugin description.
_m('Use email only for registration.'));
return true; return true;
} }
} }

View File

@ -52,7 +52,6 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php';
* *
* @see DB_DataObject * @see DB_DataObject
*/ */
class User_greeting_count extends Memcached_DataObject class User_greeting_count extends Memcached_DataObject
{ {
public $__table = 'user_greeting_count'; // table name public $__table = 'user_greeting_count'; // table name
@ -174,7 +173,7 @@ class User_greeting_count extends Memcached_DataObject
if (!$result) { if (!$result) {
// TRANS: Exception thrown when the user greeting count could not be saved in the database. // TRANS: Exception thrown when the user greeting count could not be saved in the database.
// TRANS: %d is a user ID (number). // TRANS: %d is a user ID (number).
throw Exception(sprintf(_m("Could not increment greeting count for %d."), throw Exception(sprintf(_m('Could not increment greeting count for %d.'),
$user_id)); $user_id));
} }
} }

View File

@ -4,7 +4,7 @@
* Copyright (C) 2011, StatusNet, Inc. * Copyright (C) 2011, StatusNet, Inc.
* *
* Registration confirmation form * Registration confirmation form
* *
* PHP version 5 * PHP version 5
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -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 ConfirmRegistrationForm extends Form class ConfirmRegistrationForm extends Form
{ {
protected $code; protected $code;
@ -62,15 +61,16 @@ class ConfirmRegistrationForm extends Form
function formData() function formData()
{ {
$this->out->element('p', 'instructions', $this->out->element('p', 'instructions',
sprintf(_('Enter a password to confirm your new account.'))); // TRANS: Form instructions.
sprintf(_m('Enter a password to confirm your new account.')));
$this->hidden('code', $this->code); $this->hidden('code', $this->code);
$this->out->elementStart('ul', 'form_data'); $this->out->elementStart('ul', 'form_data');
$this->elementStart('li'); $this->elementStart('li');
$this->element('label', array('for' => 'nickname-ignore'), _('User name')); $this->element('label', array('for' => 'nickname-ignore'), _m('User name'));
$this->element('input', array('name' => 'nickname-ignore', $this->element('input', array('name' => 'nickname-ignore',
'type' => 'text', 'type' => 'text',
@ -82,7 +82,8 @@ class ConfirmRegistrationForm extends Form
$this->elementStart('li'); $this->elementStart('li');
$this->element('label', array('for' => 'email-ignore'), _('Email')); // TRANS: Field label.
$this->element('label', array('for' => 'email-ignore'), _m('Email address'));
$this->element('input', array('name' => 'email-ignore', $this->element('input', array('name' => 'email-ignore',
'type' => 'text', 'type' => 'text',
@ -94,15 +95,15 @@ class ConfirmRegistrationForm extends Form
$this->elementStart('li'); $this->elementStart('li');
// TRANS: Field label on account registration page. // TRANS: Field label on account registration page.
$this->password('password1', _('Password'), $this->password('password1', _m('Password'),
// TRANS: Field title on account registration page. // TRANS: Field title on account registration page.
_('6 or more characters.')); _m('6 or more characters.'));
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementStart('li'); $this->elementStart('li');
// TRANS: Field label on account registration page. In this field the password has to be entered a second time. // TRANS: Field label on account registration page. In this field the password has to be entered a second time.
$this->password('password2', _m('PASSWORD','Confirm'), $this->password('password2', _m('PASSWORD','Confirm'),
// TRANS: Field title on account registration page. // TRANS: Field title on account registration page.
_('Same as password above.')); _m('Same as password above.'));
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementStart('li'); $this->elementStart('li');
@ -117,12 +118,12 @@ class ConfirmRegistrationForm extends Form
$this->elementStart('label', array('class' => 'checkbox', $this->elementStart('label', array('class' => 'checkbox',
'for' => 'tos')); 'for' => 'tos'));
// TRANS: Checkbox title for terms of service and privacy policy.
$this->raw(sprintf(_('I agree to the <a href="%1$s">Terms of service</a> and '. $this->raw(sprintf(_m('I agree to the <a href="%1$s">Terms of service</a> and '.
'<a href="%1$s">Privacy policy</a> of this site.'), '<a href="%1$s">Privacy policy</a> of this site.'),
common_local_url('doc', array('title' => 'tos')), common_local_url('doc', array('title' => 'tos')),
common_local_url('doc', array('title' => 'privacy')))); common_local_url('doc', array('title' => 'privacy'))));
$this->elementEnd('label'); $this->elementEnd('label');
$this->elementEnd('li'); $this->elementEnd('li');
@ -146,7 +147,7 @@ class ConfirmRegistrationForm extends Form
function formActions() function formActions()
{ {
// TRANS: Button text for action to save a new bookmark. // TRANS: Button text for action to register.
$this->out->submit('submit', _m('BUTTON', 'Register')); $this->out->submit('submit', _m('BUTTON', 'Register'));
} }

View File

@ -4,7 +4,7 @@
* Copyright (C) 2011, StatusNet, Inc. * Copyright (C) 2011, StatusNet, Inc.
* *
* Register a user by their email address * Register a user by their email address
* *
* PHP version 5 * PHP version 5
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -39,10 +39,10 @@ if (!defined('STATUSNET')) {
* *
* There are four cases where we're called: * There are four cases where we're called:
* *
* 1. GET, no arguments. Initial registration; ask for an email address. * 1. GET, no arguments. Initial registration; ask for an email address.
* 2. POST, email address argument. Initial registration; send an email to confirm. * 2. POST, email address argument. Initial registration; send an email to confirm.
* 3. GET, code argument. Confirming an invitation or a registration; look them up, * 3. GET, code argument. Confirming an invitation or a registration; look them up,
* create the relevant user if possible, login as that user, and * create the relevant user if possible, login as that user, and
* show a password-entry form. * show a password-entry form.
* 4. POST, password argument. After confirmation, set the password for the new * 4. POST, password argument. After confirmation, set the password for the new
* user, and redirect to a registration complete action with some instructions. * user, and redirect to a registration complete action with some instructions.
@ -54,7 +54,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 EmailregisterAction extends Action class EmailregisterAction extends Action
{ {
const NEWEMAIL = 1; const NEWEMAIL = 1;
@ -95,7 +94,8 @@ class EmailregisterAction extends Action
$this->code = $this->trimmed('code'); $this->code = $this->trimmed('code');
if (empty($this->code)) { if (empty($this->code)) {
throw new ClientException(_('No confirmation code.')); // TRANS: Client exception thrown when no confirmation code was provided.
throw new ClientException(_m('No confirmation code.'));
} }
$this->invitation = Invitation::staticGet('code', $this->code); $this->invitation = Invitation::staticGet('code', $this->code);
@ -105,13 +105,14 @@ class EmailregisterAction extends Action
$this->confirmation = Confirm_address::staticGet('code', $this->code); $this->confirmation = Confirm_address::staticGet('code', $this->code);
if (empty($this->confirmation)) { if (empty($this->confirmation)) {
throw new ClientException(_('No such confirmation code.'), 403); // TRANS: Client exception thrown when given confirmation code was not issued.
throw new ClientException(_m('No such confirmation code.'), 403);
} }
} }
$this->password1 = $this->trimmed('password1'); $this->password1 = $this->trimmed('password1');
$this->password2 = $this->trimmed('password2'); $this->password2 = $this->trimmed('password2');
$this->tos = $this->boolean('tos'); $this->tos = $this->boolean('tos');
} }
} else { // GET } else { // GET
@ -128,7 +129,8 @@ class EmailregisterAction extends Action
$this->confirmation = Confirm_address::staticGet('code', $this->code); $this->confirmation = Confirm_address::staticGet('code', $this->code);
if (empty($this->confirmation)) { if (empty($this->confirmation)) {
throw new ClientException(_('No such confirmation code.'), 405); // TRANS: Client exception thrown when given confirmation code was not issued.
throw new ClientException(_m('No such confirmation code.'), 405);
} }
} }
} }
@ -148,7 +150,7 @@ class EmailregisterAction extends Action
case self::SETPASSWORD: case self::SETPASSWORD:
case self::CONFIRMINVITE: case self::CONFIRMINVITE:
case self::CONFIRMREGISTER: case self::CONFIRMREGISTER:
// TRANS: Title for page where to change password. // TRANS: Title for page where to register with a confirmation code.
return _m('TITLE','Complete registration'); return _m('TITLE','Complete registration');
break; break;
} }
@ -202,7 +204,8 @@ class EmailregisterAction extends Action
$old = User::staticGet('email', $this->email); $old = User::staticGet('email', $this->email);
if (!empty($old)) { if (!empty($old)) {
$this->error = sprintf(_('A user with that email address already exists. You can use the '. // TRANS: Error text when trying to register with an already registered e-mail address.
$this->error = sprintf(_m('A user with that email address already exists. You can use the '.
'<a href="%s">password recovery</a> tool to recover a missing password.'), '<a href="%s">password recovery</a> tool to recover a missing password.'),
common_local_url('recoverpassword')); common_local_url('recoverpassword'));
$this->showRegistrationForm(); $this->showRegistrationForm();
@ -217,7 +220,8 @@ class EmailregisterAction extends Action
Event::handle('EndValidateUserEmail', array(null, $this->email, &$valid)); Event::handle('EndValidateUserEmail', array(null, $this->email, &$valid));
} }
if (!$valid) { if (!$valid) {
$this->error = _('Not a valid email address.'); // TRANS: Error text when trying to register with an invalid e-mail address.
$this->error = _m('Not a valid email address.');
$this->showRegistrationForm(); $this->showRegistrationForm();
return; return;
} }
@ -231,17 +235,19 @@ class EmailregisterAction extends Action
if (empty($confirm)) { if (empty($confirm)) {
$confirm = Confirm_address::saveNew(null, $this->email, 'register'); $confirm = Confirm_address::saveNew(null, $this->email, 'register');
$prompt = sprintf(_('An email was sent to %s to confirm that address. Check your email inbox for instructions.'), // TRANS: Confirmation text after initial registration.
$prompt = sprintf(_m('An email was sent to %s to confirm that address. Check your email inbox for instructions.'),
$this->email); $this->email);
} else { } else {
$prompt = sprintf(_('The address %s was already registered but not confirmed. The confirmation code was resent.'), // TRANS: Confirmation text after re-requesting an e-mail confirmation code.
$prompt = sprintf(_m('The address %s was already registered but not confirmed. The confirmation code was resent.'),
$this->email); $this->email);
} }
$this->sendConfirmEmail($confirm); $this->sendConfirmEmail($confirm);
$this->complete = $prompt; $this->complete = $prompt;
$this->showPage(); $this->showPage();
} }
@ -252,7 +258,7 @@ class EmailregisterAction extends Action
} else if (!empty($this->confirmation)) { } else if (!empty($this->confirmation)) {
$email = $this->confirmation->address; $email = $this->confirmation->address;
} }
$nickname = $this->nicknameFromEmail($email); $nickname = $this->nicknameFromEmail($email);
$this->form = new ConfirmRegistrationForm($this, $this->form = new ConfirmRegistrationForm($this,
@ -270,18 +276,22 @@ class EmailregisterAction extends Action
} else if (!empty($this->confirmation)) { } else if (!empty($this->confirmation)) {
$email = $this->confirmation->address; $email = $this->confirmation->address;
} else { } else {
// TRANS: Exception.
throw new Exception('No confirmation thing.'); throw new Exception('No confirmation thing.');
} }
if (!$this->tos) { if (!$this->tos) {
$this->error = _('You must accept the terms of service and privacy policy to register.'); // TRANS: Error text when trying to register without accepting TOS and privacy policy.
$this->error = _m('You must accept the terms of service and privacy policy to register.');
return; return;
} else if (empty($this->password1)) { } else if (empty($this->password1)) {
$this->error = _('You must set a password'); // TRANS: Error text when trying to register without a password.
$this->error = _m('You must set a password.');
} else if (strlen($this->password1) < 6) { } else if (strlen($this->password1) < 6) {
$this->error = _('Password must be 6 or more characters.'); // TRANS: Error text when trying to register with too short a password.
$this->error = _m('Password must be 6 or more characters.');
} else if ($this->password1 != $this->password2) { } else if ($this->password1 != $this->password2) {
$this->error = _('Passwords do not match.'); $this->error = _m('Passwords do not match.');
} }
if (!empty($this->error)) { if (!empty($this->error)) {
@ -299,7 +309,8 @@ class EmailregisterAction extends Action
'email_confirmed' => true)); 'email_confirmed' => true));
if (empty($this->user)) { if (empty($this->user)) {
throw new Exception("Failed to register user."); // TRANS: Exception thrown when user registration fails.
throw new Exception('Failed to register user.');
} }
common_set_user($this->user); common_set_user($this->user);
@ -320,6 +331,7 @@ class EmailregisterAction extends Action
} else if (!empty($this->confirmation)) { } else if (!empty($this->confirmation)) {
$this->confirmation->delete(); $this->confirmation->delete();
} else { } else {
// TRANS: Exception.
throw new Exception('No confirmation thing.'); throw new Exception('No confirmation thing.');
} }
@ -338,11 +350,15 @@ class EmailregisterAction extends Action
$headers['From'] = mail_notify_from(); $headers['From'] = mail_notify_from();
$headers['To'] = trim($confirm->address); $headers['To'] = trim($confirm->address);
$headers['Subject'] = sprintf(_('Confirm your registration on %1$s'), $sitename); // TRANS: Subject for confirmation e-mail.
// TRANS: %s is the StatusNet sitename.
$headers['Subject'] = sprintf(_m('Confirm your registration on %s'), $sitename);
$confirmUrl = common_local_url('register', array('code' => $confirm->code)); $confirmUrl = common_local_url('register', array('code' => $confirm->code));
$body = sprintf(_('Someone (probably you) has requested an account on %1$s using this email address.'. // TRANS: Body for confirmation e-mail.
// TRANS: %1$s is the StatusNet sitename, %2$s is the confirmation URL.
$body = sprintf(_m('Someone (probably you) has requested an account on %1$s using this email address.'.
"\n". "\n".
'To confirm the address, click the following URL or copy it into the address bar of your browser.'. 'To confirm the address, click the following URL or copy it into the address bar of your browser.'.
"\n". "\n".
@ -383,7 +399,6 @@ class EmailregisterAction extends Action
* *
* @return boolean is read only action? * @return boolean is read only action?
*/ */
function isReadOnly($args) function isReadOnly($args)
{ {
return false; return false;
@ -392,9 +407,9 @@ class EmailregisterAction extends Action
function nicknameFromEmail($email) function nicknameFromEmail($email)
{ {
$parts = explode('@', $email); $parts = explode('@', $email);
$nickname = $parts[0]; $nickname = $parts[0];
$nickname = preg_replace('/[^A-Za-z0-9]/', '', $nickname); $nickname = preg_replace('/[^A-Za-z0-9]/', '', $nickname);
$nickname = Nickname::normalize($nickname); $nickname = Nickname::normalize($nickname);
@ -418,7 +433,6 @@ class EmailregisterAction extends Action
* *
* @return void * @return void
*/ */
function showLocalNav() function showLocalNav()
{ {
$nav = new LoginGroupNav($this); $nav = new LoginGroupNav($this);

View File

@ -4,7 +4,7 @@
* Copyright (C) 2011, StatusNet, Inc. * Copyright (C) 2011, StatusNet, Inc.
* *
* Email registration form * Email registration form
* *
* PHP version 5 * PHP version 5
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -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 EmailRegistrationForm extends Form class EmailRegistrationForm extends Form
{ {
protected $email; protected $email;
@ -58,14 +57,15 @@ class EmailRegistrationForm extends Form
function formData() function formData()
{ {
$this->out->element('p', 'instructions', $this->out->element('p', 'instructions',
_('Enter your email address to register for an account.')); // TRANS: Form instructions.
_m('Enter your email address to register for an account.'));
$this->out->elementStart('fieldset', array('id' => 'new_bookmark_data')); $this->out->elementStart('fieldset', array('id' => 'new_bookmark_data'));
$this->out->elementStart('ul', 'form_data'); $this->out->elementStart('ul', 'form_data');
$this->li(); $this->li();
$this->out->input('email', $this->out->input('email',
// TRANS: Field label on form for adding a new bookmark. // TRANS: Field label on form for registering an account.
_m('LABEL','E-mail address'), _m('LABEL','E-mail address'),
$this->email); $this->email);
$this->unli(); $this->unli();
@ -87,10 +87,9 @@ class EmailRegistrationForm extends Form
* *
* @return void * @return void
*/ */
function formActions() function formActions()
{ {
// TRANS: Button text for action to save a new bookmark. // TRANS: Button text for registering an account.
$this->out->submit('submit', _m('BUTTON', 'Register')); $this->out->submit('submit', _m('BUTTON', 'Register'));
} }
@ -102,7 +101,6 @@ class EmailRegistrationForm extends Form
* *
* @return int ID of the form * @return int ID of the form
*/ */
function id() function id()
{ {
return 'form_email_registration'; return 'form_email_registration';
@ -116,7 +114,6 @@ class EmailRegistrationForm extends Form
* *
* @return string URL to post to * @return string URL to post to
*/ */
function action() function action()
{ {
return common_local_url('register'); return common_local_url('register');
@ -127,4 +124,3 @@ class EmailRegistrationForm extends Form
return 'form_email_registration form_settings'; return 'form_email_registration form_settings';
} }
} }