Commit 691f374a authored by Siebrand Mazeland's avatar Siebrand Mazeland

* Add/update translator documentation.

* Update punctuation in form validation message for consistency.
* Remove superfluous whitespace.
parent c29a9388
<?php
/**
* Disfavor action.
*
......
......@@ -198,6 +198,7 @@ class EditApplicationAction extends OwnerDesignAction
} elseif (Oauth_application::descriptionTooLong($description)) {
$this->showForm(sprintf(
// TRANS: Validation error shown when providing too long a description in the "Edit application" form.
// TRANS: %d is the maximum number of allowed characters.
_m('Description is too long (maximum %d character).',
'Description is too long (maximum %d characters).',
Oauth_application::maxDesc()),
......@@ -223,6 +224,7 @@ class EditApplicationAction extends OwnerDesignAction
$this->showForm(_('Organization is too long (maximum 255 characters).'));
return;
} elseif (empty($homepage)) {
// TRANS: Form validation error show when an organisation name has not been provided in the edit application form.
$this->showForm(_('Organization homepage is required.'));
return;
} elseif ((mb_strlen($homepage) > 0)
......
......@@ -46,7 +46,6 @@ require_once INSTALLDIR.'/lib/accountsettingsaction.php';
*
* @see Widget
*/
class EmailsettingsAction extends AccountSettingsAction
{
/**
......@@ -54,7 +53,6 @@ class EmailsettingsAction extends AccountSettingsAction
*
* @return string Title of the page
*/
function title()
{
// TRANS: Title for e-mail settings.
......@@ -66,7 +64,6 @@ class EmailsettingsAction extends AccountSettingsAction
*
* @return instructions for use
*/
function getInstructions()
{
// XXX: For consistency of parameters in messages, this should be a
......@@ -91,7 +88,6 @@ class EmailsettingsAction extends AccountSettingsAction
*
* @return void
*/
function showContent()
{
$user = common_current_user();
......@@ -118,8 +114,8 @@ class EmailsettingsAction extends AccountSettingsAction
$confirm = $this->getConfirmation();
if ($confirm) {
$this->element('p', array('id' => 'form_unconfirmed'), $confirm->address);
// TRANS: Form note in e-mail settings form.
$this->element('p', array('class' => 'form_note'),
// TRANS: Form note in e-mail settings form.
_('Awaiting confirmation on this address. '.
'Check your inbox (and spam box!) for a message '.
'with further instructions.'));
......@@ -173,7 +169,7 @@ class EmailsettingsAction extends AccountSettingsAction
if ($user->incomingemail) {
$this->elementStart('p');
$this->element('span', 'address', $user->incomingemail);
// XXX: Looks a little awkward in the UI.
// @todo XXX: Looks a little awkward in the UI.
// Something like "xxxx@identi.ca Send email ..". Needs improvement.
$this->element('span', 'input_instructions',
// TRANS: Form instructions for incoming e-mail form in e-mail settings.
......@@ -208,7 +204,7 @@ class EmailsettingsAction extends AccountSettingsAction
$this->element('legend', null, _('Email preferences'));
$this->elementStart('ul', 'form_data');
if (Event::handle('StartEmailFormData', array($this))) {
$this->elementStart('li');
$this->checkbox('emailnotifysub',
......@@ -262,7 +258,6 @@ class EmailsettingsAction extends AccountSettingsAction
*
* @return Confirm_address Email address confirmation for user, or null
*/
function getConfirmation()
{
$user = common_current_user();
......@@ -288,7 +283,6 @@ class EmailsettingsAction extends AccountSettingsAction
*
* @return void
*/
function handlePost()
{
// CSRF protection
......@@ -322,13 +316,12 @@ class EmailsettingsAction extends AccountSettingsAction
*
* @return void
*/
function savePreferences()
{
$user = common_current_user();
if (Event::handle('StartEmailSaveForm', array($this, &$user))) {
$emailnotifysub = $this->boolean('emailnotifysub');
$emailnotifyfav = $this->boolean('emailnotifyfav');
$emailnotifymsg = $this->boolean('emailnotifymsg');
......@@ -336,13 +329,13 @@ class EmailsettingsAction extends AccountSettingsAction
$emailnotifyattn = $this->boolean('emailnotifyattn');
$emailmicroid = $this->boolean('emailmicroid');
$emailpost = $this->boolean('emailpost');
assert(!is_null($user)); // should already be checked
$user->query('BEGIN');
$original = clone($user);
$user->emailnotifysub = $emailnotifysub;
$user->emailnotifyfav = $emailnotifyfav;
$user->emailnotifymsg = $emailnotifymsg;
......@@ -350,20 +343,20 @@ class EmailsettingsAction extends AccountSettingsAction
$user->emailnotifyattn = $emailnotifyattn;
$user->emailmicroid = $emailmicroid;
$user->emailpost = $emailpost;
$result = $user->update($original);
if ($result === false) {
common_log_db_error($user, 'UPDATE', __FILE__);
// TRANS: Server error thrown on database error updating e-mail preferences.
$this->serverError(_('Could not update user.'));
return;
}
$user->query('COMMIT');
Event::handle('EndEmailSaveForm', array($this));
// TRANS: Confirmation message for successful e-mail preferences save.
$this->showForm(_('Email preferences saved.'), true);
}
......@@ -374,7 +367,6 @@ class EmailsettingsAction extends AccountSettingsAction
*
* @return void
*/
function addAddress()
{
$user = common_current_user();
......@@ -393,7 +385,7 @@ class EmailsettingsAction extends AccountSettingsAction
if (!$email) {
// TRANS: Message given saving e-mail address that cannot be normalised.
$this->showForm(_('Cannot normalize that email address'));
$this->showForm(_('Cannot normalize that email address.'));
return;
}
if (!Validate::email($email, common_config('email', 'check_domain'))) {
......@@ -442,7 +434,6 @@ class EmailsettingsAction extends AccountSettingsAction
*
* @return void
*/
function cancelConfirmation()
{
$email = $this->arg('email');
......@@ -478,7 +469,6 @@ class EmailsettingsAction extends AccountSettingsAction
*
* @return void
*/
function removeAddress()
{
$user = common_current_user();
......@@ -519,12 +509,12 @@ class EmailsettingsAction extends AccountSettingsAction
*
* @return void
*/
function removeIncoming()
{
$user = common_current_user();
if (!$user->incomingemail) {
// TRANS: Form validation error displayed when trying to remove an incoming e-mail address while no address has been set.
$this->showForm(_('No incoming email address.'));
return;
}
......@@ -549,7 +539,6 @@ class EmailsettingsAction extends AccountSettingsAction
*
* @return void
*/
function newIncoming()
{
$user = common_current_user();
......
<?php
/**
* Favor action.
*
......@@ -59,6 +58,7 @@ class FavorAction extends Action
{
parent::handle($args);
if (!common_logged_in()) {
// TRANS: Client error displayed when trying to mark a notice as favorite without being logged in.
$this->clientError(_('Not logged in.'));
return;
}
......@@ -76,11 +76,13 @@ class FavorAction extends Action
return;
}
if ($user->hasFave($notice)) {
// TRANS: Client error displayed when trying to mark a notice as favorite that already is a favorite.
$this->clientError(_('This notice is already a favorite!'));
return;
}
$fave = Fave::addNew($user->getProfile(), $notice);
if (!$fave) {
// TRANS: Server error displayed when trying to mark a notice as favorite fails in the database.
$this->serverError(_('Could not create favorite.'));
return;
}
......@@ -89,6 +91,7 @@ class FavorAction extends Action
if ($this->boolean('ajax')) {
$this->startHTML('text/xml;charset=utf-8');
$this->elementStart('head');
// TRANS: Page title for page on which favorite notices can be unfavourited.
$this->element('title', null, _('Disfavor favorite'));
$this->elementEnd('head');
$this->elementStart('body');
......@@ -123,4 +126,3 @@ class FavorAction extends Action
}
}
}
......@@ -48,7 +48,6 @@ require_once INSTALLDIR.'/lib/noticelist.php';
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class FavoritedAction extends Action
{
var $page = null;
......@@ -62,8 +61,11 @@ class FavoritedAction extends Action
function title()
{
if ($this->page == 1) {
// TRANS: Page title for first page of favorited notices.
return _('Popular notices');
} else {
// TRANS: Page title for all but first page of favorited notices.
// TRANS: %d is the page number being displayed.
return sprintf(_('Popular notices, page %d'), $this->page);
}
}
......@@ -73,9 +75,9 @@ class FavoritedAction extends Action
*
* @return instructions for use
*/
function getInstructions()
{
// TRANS: Description on page displaying favorited notices.
return _('The most popular notices on the site right now.');
}
......@@ -84,7 +86,6 @@ class FavoritedAction extends Action
*
* @return boolean true
*/
function isReadOnly($args)
{
return true;
......@@ -99,7 +100,6 @@ class FavoritedAction extends Action
*
* @todo move queries from showContent() to here
*/
function prepare($args)
{
parent::prepare($args);
......@@ -119,7 +119,6 @@ class FavoritedAction extends Action
*
* @return void
*/
function handle($args)
{
parent::handle($args);
......@@ -134,7 +133,6 @@ class FavoritedAction extends Action
*
* @return void
*/
function showPageNotice()
{
$instr = $this->getInstructions();
......@@ -147,12 +145,16 @@ class FavoritedAction extends Action
function showEmptyList()
{
// TRANS: Text displayed instead of a list when a site does not yet have any favourited notices.
$message = _('Favorite notices appear on this page but no one has favorited one yet.') . ' ';
if (common_logged_in()) {
// TRANS: Additional text displayed instead of a list when a site does not yet have any favourited notices for logged in users.
$message .= _('Be the first to add a notice to your favorites by clicking the fave button next to any notice you like.');
}
else {
// TRANS: Additional text displayed instead of a list when a site does not yet have any favourited notices for not logged in users.
// TRANS: %%action.register%% is a registration link. "[link text](link)" is Mark Down. Do not change the formatting.
$message .= _('Why not [register an account](%%action.register%%) and be the first to add a notice to your favorites!');
}
......@@ -168,7 +170,6 @@ class FavoritedAction extends Action
*
* @return void
*/
function showLocalNav()
{
$nav = new PublicGroupNav($this);
......@@ -182,7 +183,6 @@ class FavoritedAction extends Action
*
* @return void
*/
function showContent()
{
$pop = new Popularity();
......
<?php
/**
* RSS feed for user favorites action class.
*
......@@ -50,7 +49,6 @@ require_once INSTALLDIR.'/lib/rssaction.php';
*/
class FavoritesrssAction extends Rss10Action
{
/** The user whose favorites to display */
var $user = null;
......@@ -62,7 +60,6 @@ class FavoritesrssAction extends Rss10Action
*
* @return boolean success
*/
function prepare($args)
{
parent::prepare($args);
......@@ -71,6 +68,7 @@ class FavoritesrssAction extends Rss10Action
$this->user = User::staticGet('nickname', $nickname);
if (!$this->user) {
// TRANS: Client error displayed when trying to get the RSS feed with favorites of a user that does not exist.
$this->clientError(_('No such user.'));
return false;
} else {
......@@ -108,10 +106,14 @@ class FavoritesrssAction extends Rss10Action
$c = array('url' => common_local_url('favoritesrss',
array('nickname' =>
$user->nickname)),
// TRANS: Title of RSS feed with favourite notices of a user.
// TRANS: %s is a user's nickname.
'title' => sprintf(_("%s's favorite notices"), $user->nickname),
'link' => common_local_url('showfavorites',
array('nickname' =>
$user->nickname)),
// TRANS: Desciption of RSS feed with favourite notices of a user.
// TRANS: %1$s is a user's nickname, %2$s is the name of the StatusNet site.
'description' => sprintf(_('Updates favored by %1$s on %2$s!'),
$user->nickname, common_config('site', 'name')));
return $c;
......
......@@ -45,7 +45,6 @@ require_once INSTALLDIR.'/lib/publicgroupnav.php';
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class FeaturedAction extends Action
{
var $page = null;
......@@ -66,8 +65,11 @@ class FeaturedAction extends Action
function title()
{
if ($this->page == 1) {
// TRANS: Page title for first page of featured users.
return _('Featured users');
} else {
// TRANS: Page title for all but first page of featured users.
// TRANS: %d is the page number being displayed.
return sprintf(_('Featured users, page %d'), $this->page);
}
}
......@@ -96,7 +98,8 @@ class FeaturedAction extends Action
function getInstructions()
{
return sprintf(_('A selection of some great users on %s'),
// TRANS: Description on page displaying featured users.
return sprintf(_('A selection of some great users on %s.'),
common_config('site', 'name'));
}
......
......@@ -21,6 +21,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
require_once(INSTALLDIR.'/actions/shownotice.php');
// @todo FIXME: Add documentation.
class FileAction extends Action
{
var $id = null;
......@@ -31,14 +32,17 @@ class FileAction extends Action
parent::prepare($args);
$this->id = $this->trimmed('notice');
if (empty($this->id)) {
// TRANS: Client error displayed when no notice ID was given trying do display a file.
$this->clientError(_('No notice ID.'));
}
$notice = Notice::staticGet('id', $this->id);
if (empty($notice)) {
// TRANS: Client error displayed when an invalid notice ID was given trying do display a file.
$this->clientError(_('No notice.'));
}
$atts = $notice->attachments();
if (empty($atts)) {
// TRANS: Client error displayed when trying do display a file for a notice without a file attachement.
$this->clientError(_('No attachments.'));
}
foreach ($atts as $att) {
......@@ -48,6 +52,9 @@ class FileAction extends Action
}
}
if (empty($this->filerec)) {
// XXX: Is this translation hint correct? If yes, please remove comment, if no, please correct and remove comment.
// TRANS: Client error displayed when trying do display a file for a notice with file attachements
// TRANS: that could not be found.
$this->clientError(_('No uploaded attachments.'));
}
return true;
......@@ -62,11 +69,8 @@ class FileAction extends Action
*
* @return boolean true
*/
function isReadOnly($args)
{
return true;
}
}
......@@ -55,7 +55,6 @@ class NewApplicationAction extends OwnerDesignAction
/**
* Prepare to run
*/
function prepare($args)
{
parent::prepare($args);
......@@ -78,7 +77,6 @@ class NewApplicationAction extends OwnerDesignAction
*
* @return void
*/
function handle($args)
{
parent::handle($args);
......@@ -122,6 +120,7 @@ class NewApplicationAction extends OwnerDesignAction
} elseif ($this->arg('save')) {
$this->trySave();
} else {
// TRANS: Client error displayed when encountering an unexpected action on form submission.
$this->clientError(_('Unexpected form submission.'));
}
}
......@@ -144,6 +143,7 @@ class NewApplicationAction extends OwnerDesignAction
$this->element('p', 'error', $this->msg);
} else {
$this->element('p', 'instructions',
// TRANS: Form instructions for registering a new application.
_('Use this form to register a new application.'));
}
}
......@@ -160,15 +160,19 @@ class NewApplicationAction extends OwnerDesignAction
$access_type = $this->arg('default_access_type');
if (empty($name)) {
// TRANS: Validation error shown when not providing a name in the "New application" form.
$this->showForm(_('Name is required.'));
return;
} else if ($this->nameExists($name)) {
// TRANS: Validation error shown when providing a name for an application that already exists in the "New application" form.
$this->showForm(_('Name already in use. Try another one.'));
return;
} elseif (mb_strlen($name) > 255) {
// TRANS: Validation error shown when providing too long a name in the "New application" form.
$this->showForm(_('Name is too long (maximum 255 characters).'));
return;
} elseif (empty($description)) {
// TRANS: Validation error shown when not providing a description in the "New application" form.
$this->showForm(_('Description is required.'));
return;
} elseif (Oauth_application::descriptionTooLong($description)) {
......@@ -181,6 +185,7 @@ class NewApplicationAction extends OwnerDesignAction
Oauth_application::maxDesc()));
return;
} elseif (empty($source_url)) {
// TRANS: Validation error shown when not providing a source URL in the "New application" form.
$this->showForm(_('Source URL is required.'));
return;
} elseif ((strlen($source_url) > 0)
......@@ -190,15 +195,19 @@ class NewApplicationAction extends OwnerDesignAction
)
)
{
// TRANS: Validation error shown when providing an invalid source URL in the "New application" form.
$this->showForm(_('Source URL is not valid.'));
return;
} elseif (empty($organization)) {
// TRANS: Validation error shown when not providing an organisation in the "New application" form.
$this->showForm(_('Organization is required.'));
return;
} elseif (mb_strlen($organization) > 255) {
// TRANS: Validation error shown when providing too long an arganisation name in the "Edit application" form.
$this->showForm(_('Organization is too long (maximum 255 characters).'));
return;
} elseif (empty($homepage)) {
// TRANS: Form validation error show when an organisation name has not been provided in the new application form.
$this->showForm(_('Organization homepage is required.'));
return;
} elseif ((strlen($homepage) > 0)
......@@ -208,9 +217,11 @@ class NewApplicationAction extends OwnerDesignAction
)
)
{
// TRANS: Validation error shown when providing an invalid homepage URL in the "New application" form.
$this->showForm(_('Homepage is not a valid URL.'));
return;
} elseif (mb_strlen($callback_url) > 255) {
// TRANS: Validation error shown when providing too long a callback URL in the "New application" form.
$this->showForm(_('Callback is too long.'));
return;
} elseif (strlen($callback_url) > 0
......@@ -220,6 +231,7 @@ class NewApplicationAction extends OwnerDesignAction
)
)
{
// TRANS: Validation error shown when providing an invalid callback URL in the "New application" form.
$this->showForm(_('Callback URL is not valid.'));
return;
}
......@@ -263,6 +275,7 @@ class NewApplicationAction extends OwnerDesignAction
if (!$result) {
common_log_db_error($consumer, 'INSERT', __FILE__);
// TRANS: Server error displayed when an application could not be registered in the database through the "New application" form.
$this->serverError(_('Could not create application.'));
}
......@@ -272,6 +285,7 @@ class NewApplicationAction extends OwnerDesignAction
if (!$this->app_id) {
common_log_db_error($app, 'INSERT', __FILE__);
// TRANS: Server error displayed when an application could not be registered in the database through the "New application" form.
$this->serverError(_('Could not create application.'));
$app->query('ROLLBACK');
}
......@@ -281,7 +295,6 @@ class NewApplicationAction extends OwnerDesignAction
$app->query('COMMIT');
common_redirect(common_local_url('oauthappssettings'), 303);
}
/**
......@@ -294,12 +307,9 @@ class NewApplicationAction extends OwnerDesignAction
*
* @return boolean true if the name already exists
*/
function nameExists($name)
{
$app = Oauth_application::staticGet('name', $name);
return !empty($app);
}
}
......@@ -44,7 +44,6 @@ require_once INSTALLDIR.'/lib/feedlist.php';
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class ShowfavoritesAction extends OwnerDesignAction
{
/** User we're getting the faves of */
......@@ -57,7 +56,6 @@ class ShowfavoritesAction extends OwnerDesignAction
*
* @return boolean true
*/
function isReadOnly($args)
{
return true;
......@@ -70,12 +68,15 @@ class ShowfavoritesAction extends OwnerDesignAction
*
* @return string title of page
*/
function title()
{
if ($this->page == 1) {
// TRANS: Title for first page of favourite notices of a user.
// TRANS: %s is the user for whom the favourite notices are displayed.
return sprintf(_('%s\'s favorite notices'), $this->user->nickname);
} else {
// TRANS: Title for all but the first page of favourite notices of a user.
// TRANS: %1$s is the user for whom the favourite notices are displayed, %2$d is the page number.
return sprintf(_('%1$s\'s favorite notices, page %2$d'),
$this->user->nickname,
$this->page);
......@@ -92,7 +93,6 @@ class ShowfavoritesAction extends OwnerDesignAction
*
* @return boolean success flag
*/
function prepare($args)
{
parent::prepare($args);
......@@ -102,6 +102,7 @@ class ShowfavoritesAction extends OwnerDesignAction
$this->user = User::staticGet('nickname', $nickname);
if (!$this->user) {
// TRANS: Client error displayed when trying to display favourite notices for a non-existing user.
$this->clientError(_('No such user.'));
return false;
}
......@@ -129,6 +130,7 @@ class ShowfavoritesAction extends OwnerDesignAction
}
if (empty($this->notice)) {
// TRANS: Server error displayed when favourite notices could not be retrieved from the database.
$this->serverError(_('Could not retrieve favorite notices.'));
return;
}
......@@ -150,7 +152,6 @@ class ShowfavoritesAction extends OwnerDesignAction
*
* @return void
*/
function handle($args)
{
parent::handle($args);
......@@ -162,12 +163,12 @@ class ShowfavoritesAction extends OwnerDesignAction
*
* @return array Feed objects to show
*/
function getFeeds()
{
return array(new Feed(Feed::RSS1,
common_local_url('favoritesrss',
array('nickname' => $this->user->nickname)),
// TRANS: Feed link text. %s is a username.
sprintf(_('Feed for favorites of %s (RSS 1.0)'),
$this->user->nickname)),
new Feed(Feed::RSS2,
......@@ -175,6 +176,7 @@ class ShowfavoritesAction extends OwnerDesignAction
array(
'id' => $this->user->nickname,
'format' => 'rss')),
// TRANS: Feed link text. %s is a username.
sprintf(_('Feed for favorites of %s (RSS 2.0)'),
$this->user->nickname)),
new Feed(Feed::ATOM,
......@@ -182,6 +184,7 @@ class ShowfavoritesAction extends OwnerDesignAction
array(
'id' => $this->user->nickname,
'format' => 'atom')),
// TRANS: Feed link text. %s is a username.
sprintf(_('Feed for favorites of %s (Atom)'),
$this->user->nickname)));
}
......@@ -191,7 +194,6 @@ class ShowfavoritesAction extends OwnerDesignAction
*
* @return void
*/
function showLocalNav()
{
$nav = new PersonalGroupNav($this);
......@@ -203,12 +205,18 @@ class ShowfavoritesAction extends OwnerDesignAction
if (common_logged_in()) {
$current_user = common_current_user();
if ($this->user->id === $current_user->id) {
// TRANS: Text displayed instead of favourite notices for the current logged in user that has no favourites.
$message = _('You haven\'t chosen any favorite notices yet. Click the fave button on notices you like to bookmark them for later or shed a spotlight on them.');
} else {
// TRANS: Text displayed instead of favourite notices for a user that has no favourites while logged in.
// TRANS: %s is a username.
$message = sprintf(_('%s hasn\'t added any favorite notices yet. Post something interesting they would add to their favorites :)'), $this->user->nickname);
}
}
else {
// TRANS: Text displayed instead of favourite notices for a user that has no favourites while not logged in.
// TRANS: %s is a username, %%%%action.register%%%% is a link to the user registration page.
// TRANS: (link text)[link] is a Mark Down link.
$message = sprintf(_('%s hasn\'t added any favorite notices yet. Why not [register an account](%%%%action.register%%%%) and then post something interesting they would add to their favorites :)'), $this->user->nickname);
}
......@@ -224,7 +232,6 @@ class ShowfavoritesAction extends OwnerDesignAction
*
* @return void
*/
function showContent()
{
$nl = new FavoritesNoticeList($this->notice, $this);
......@@ -240,6 +247,7 @@ class ShowfavoritesAction extends OwnerDesignAction
}
function showPageNotice() {
// TRANS: Page notice for show favourites page.
$this->element('p', 'instructions', _('This is a way to share what you like.'));
}
}
......
......@@ -532,7 +532,7 @@ class SmssettingsAction extends ConnectSettingsAction
if (!$code) {
// TRANS: Message given saving SMS phone number confirmation code without having provided one.
$this->showForm(_('No code entered'));
$this->showForm(_('No code entered.'));
return;
}
......@@ -551,6 +551,7 @@ class SmssettingsAction extends ConnectSettingsAction
$user = common_current_user();
if (!$user->incomingemail) {
// TRANS: Form validation error displayed when trying to remove an incoming e-mail address while no address has been set.
$this->showForm(_('No incoming email address.'));
return;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment