* i18n/L10n updates.

* translator documentation added/updated.
* superfluous whitespace removed.
This commit is contained in:
Siebrand Mazeland 2010-10-31 00:58:35 +02:00
parent 83233a8a43
commit 08edd1fedf
13 changed files with 122 additions and 88 deletions

View File

@ -42,7 +42,6 @@ require_once INSTALLDIR.'/lib/attachmentlist.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 AttachmentAction extends Action
{
/**
@ -70,6 +69,7 @@ class AttachmentAction extends Action
}
if (empty($this->attachment)) {
// TRANS: Client error displayed trying to get a non-existing attachment.
$this->clientError(_('No such attachment.'), 404);
return false;
}
@ -81,7 +81,6 @@ class AttachmentAction extends Action
*
* @return boolean true
*/
function isReadOnly($args)
{
return true;
@ -129,7 +128,6 @@ class AttachmentAction extends Action
*
* @return void
*/
function handle($args)
{
parent::handle($args);
@ -150,7 +148,6 @@ class AttachmentAction extends Action
*
* @return void
*/
function showLocalNavBlock()
{
}
@ -162,7 +159,6 @@ class AttachmentAction extends Action
*
* @return void
*/
function showContent()
{
$ali = new Attachment($this->attachment, $this);
@ -174,7 +170,6 @@ class AttachmentAction extends Action
*
* @return void
*/
function showPageNoticeBlock()
{
}
@ -191,4 +186,3 @@ class AttachmentAction extends Action
$atcs->show();
}
}

View File

@ -42,7 +42,6 @@ require_once INSTALLDIR.'/actions/attachment.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 Attachment_ajaxAction extends AttachmentAction
{
/**
@ -80,4 +79,3 @@ class Attachment_ajaxAction extends AttachmentAction
$this->elementEnd('div');
}
}

View File

@ -42,10 +42,8 @@ require_once INSTALLDIR.'/actions/attachment.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 Attachment_thumbnailAction extends AttachmentAction
{
function handle($args)
{
$this->showPage();
@ -79,6 +77,4 @@ class Attachment_thumbnailAction extends AttachmentAction
}
$this->element('img', array('src' => $file_thumbnail->url, 'alt' => 'Thumbnail'));
}
}

View File

@ -56,27 +56,32 @@ class AvatarbynicknameAction extends Action
parent::handle($args);
$nickname = $this->trimmed('nickname');
if (!$nickname) {
// TRANS: Client error displayed trying to get an avatar without providing a nickname.
$this->clientError(_('No nickname.'));
return;
}
$size = $this->trimmed('size');
if (!$size) {
// TRANS: Client error displayed trying to get an avatar without providing an avatar size.
$this->clientError(_('No size.'));
return;
}
$size = strtolower($size);
if (!in_array($size, array('original', '96', '48', '24'))) {
// TRANS: Client error displayed trying to get an avatar providing an invalid avatar size.
$this->clientError(_('Invalid size.'));
return;
}
$user = User::staticGet('nickname', $nickname);
if (!$user) {
// TRANS: Client error displayed trying to get an avatar for a non-existing user.
$this->clientError(_('No such user.'));
return;
}
$profile = $user->getProfile();
if (!$profile) {
// TRANS: Client error displayed trying to get an avatar for a user without a profile.
$this->clientError(_('User has no profile.'));
return;
}
@ -103,4 +108,3 @@ class AvatarbynicknameAction extends Action
return true;
}
}

View File

@ -49,7 +49,6 @@ define('MAX_ORIGINAL', 480);
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class AvatarsettingsAction extends AccountSettingsAction
{
var $mode = null;
@ -61,9 +60,9 @@ class AvatarsettingsAction extends AccountSettingsAction
*
* @return string Title of the page
*/
function title()
{
// TRANS: Title for avatar upload page.
return _('Avatar');
}
@ -72,10 +71,12 @@ class AvatarsettingsAction extends AccountSettingsAction
*
* @return instructions for use
*/
function getInstructions()
{
return sprintf(_('You can upload your personal avatar. The maximum file size is %s.'), ImageFile::maxFileSize());
// TRANS: Instruction for avatar upload page.
// TRANS: %s is the maximum file size, for example "500b", "10kB" or "2MB".
return sprintf(_('You can upload your personal avatar. The maximum file size is %s.'),
ImageFile::maxFileSize());
}
/**
@ -103,6 +104,7 @@ class AvatarsettingsAction extends AccountSettingsAction
if (!$profile) {
common_log_db_error($user, 'SELECT', __FILE__);
// TRANS: Server error displayed in avatar upload page when no matching profile can be found for a user.
$this->serverError(_('User without matching profile.'));
return;
}
@ -116,6 +118,7 @@ class AvatarsettingsAction extends AccountSettingsAction
'action' =>
common_local_url('avatarsettings')));
$this->elementStart('fieldset');
// TRANS: Avatar upload page form legend.
$this->element('legend', null, _('Avatar settings'));
$this->hidden('token', common_session_token());
@ -124,6 +127,7 @@ class AvatarsettingsAction extends AccountSettingsAction
if ($original) {
$this->elementStart('li', array('id' => 'avatar_original',
'class' => 'avatar_view'));
// TRANS: Header on avatar upload page for thumbnail of originally uploaded avatar (h2).
$this->element('h2', null, _("Original"));
$this->elementStart('div', array('id'=>'avatar_original_view'));
$this->element('img', array('src' => $original->url,
@ -139,6 +143,7 @@ class AvatarsettingsAction extends AccountSettingsAction
if ($avatar) {
$this->elementStart('li', array('id' => 'avatar_preview',
'class' => 'avatar_view'));
// TRANS: Header on avatar upload page for thumbnail of to be used rendition of uploaded avatar (h2).
$this->element('h2', null, _("Preview"));
$this->elementStart('div', array('id'=>'avatar_preview_view'));
$this->element('img', array('src' => $original->url,
@ -146,7 +151,8 @@ class AvatarsettingsAction extends AccountSettingsAction
'height' => AVATAR_PROFILE_SIZE,
'alt' => $user->nickname));
$this->elementEnd('div');
$this->submit('delete', _('Delete'));
// TRANS: Button on avatar upload page to delete current avatar.
$this->submit('delete', _m('BUTTON','Delete'));
$this->elementEnd('li');
}
@ -163,7 +169,8 @@ class AvatarsettingsAction extends AccountSettingsAction
$this->elementStart('ul', 'form_actions');
$this->elementStart('li');
$this->submit('upload', _('Upload'));
// TRANS: Button on avatar upload page to upload an avatar.
$this->submit('upload', _m('BUTTON','Upload'));
$this->elementEnd('li');
$this->elementEnd('ul');
}
@ -171,7 +178,6 @@ class AvatarsettingsAction extends AccountSettingsAction
$this->elementEnd('fieldset');
$this->elementEnd('form');
}
function showCropForm()
@ -182,6 +188,7 @@ class AvatarsettingsAction extends AccountSettingsAction
if (!$profile) {
common_log_db_error($user, 'SELECT', __FILE__);
// TRANS: Server error displayed in avatar upload page when no matching profile can be found for a user.
$this->serverError(_('User without matching profile.'));
return;
}
@ -194,6 +201,7 @@ class AvatarsettingsAction extends AccountSettingsAction
'action' =>
common_local_url('avatarsettings')));
$this->elementStart('fieldset');
// TRANS: Avatar upload page crop form legend.
$this->element('legend', null, _('Avatar settings'));
$this->hidden('token', common_session_token());
@ -202,6 +210,7 @@ class AvatarsettingsAction extends AccountSettingsAction
$this->elementStart('li',
array('id' => 'avatar_original',
'class' => 'avatar_view'));
// TRANS: Header on avatar upload crop form for thumbnail of originally uploaded avatar (h2).
$this->element('h2', null, _("Original"));
$this->elementStart('div', array('id'=>'avatar_original_view'));
$this->element('img', array('src' => Avatar::url($this->filedata['filename']),
@ -214,6 +223,7 @@ class AvatarsettingsAction extends AccountSettingsAction
$this->elementStart('li',
array('id' => 'avatar_preview',
'class' => 'avatar_view'));
// TRANS: Header on avatar upload crop form for thumbnail of to be used rendition of uploaded avatar (h2).
$this->element('h2', null, _("Preview"));
$this->elementStart('div', array('id'=>'avatar_preview_view'));
$this->element('img', array('src' => Avatar::url($this->filedata['filename']),
@ -228,13 +238,14 @@ class AvatarsettingsAction extends AccountSettingsAction
'type' => 'hidden',
'id' => $crop_info));
}
$this->submit('crop', _('Crop'));
// TRANS: Button on avatar upload crop form to confirm a selected crop as avatar.
$this->submit('crop', _m('BUTTON','Crop'));
$this->elementEnd('li');
$this->elementEnd('ul');
$this->elementEnd('fieldset');
$this->elementEnd('form');
}
/**
@ -244,7 +255,6 @@ class AvatarsettingsAction extends AccountSettingsAction
*
* @return void
*/
function handlePost()
{
// Workaround for PHP returning empty $_POST and $_FILES when POST
@ -280,6 +290,7 @@ class AvatarsettingsAction extends AccountSettingsAction
} else if ($this->arg('delete')) {
$this->deleteAvatar();
} else {
// TRANS: Unexpected validation error on avatar upload form.
$this->showForm(_('Unexpected form submission.'));
}
Event::handle('EndAvatarSaveForm', array($this));
@ -294,7 +305,6 @@ class AvatarsettingsAction extends AccountSettingsAction
*
* @return void
*/
function uploadAvatar()
{
try {
@ -304,6 +314,7 @@ class AvatarsettingsAction extends AccountSettingsAction
return;
}
if ($imagefile === null) {
// TRANS: Validation error on avatar upload form when no file was uploaded.
$this->showForm(_('No file uploaded.'));
return;
}
@ -331,6 +342,7 @@ class AvatarsettingsAction extends AccountSettingsAction
$this->mode = 'crop';
// TRANS: Avatar upload form unstruction after uploading a file.
$this->showForm(_('Pick a square area of the image to be your avatar'),
true);
}
@ -340,12 +352,12 @@ class AvatarsettingsAction extends AccountSettingsAction
*
* @return void
*/
function cropAvatar()
{
$filedata = $_SESSION['FILEDATA'];
if (!$filedata) {
// TRANS: Server error displayed if an avatar upload went wrong somehow server side.
$this->serverError(_('Lost our file data.'));
return;
}
@ -372,6 +384,7 @@ class AvatarsettingsAction extends AccountSettingsAction
$this->showForm(_('Avatar updated.'), true);
common_broadcast_profile($profile);
} else {
// TRANS: Error displayed on the avatar upload page if the avatar could not be updated for an unknown reason.
$this->showForm(_('Failed updating avatar.'));
}
}
@ -381,7 +394,6 @@ class AvatarsettingsAction extends AccountSettingsAction
*
* @return void
*/
function deleteAvatar()
{
$user = common_current_user();
@ -396,6 +408,7 @@ class AvatarsettingsAction extends AccountSettingsAction
$avatar = $profile->getAvatar(AVATAR_MINI_SIZE);
if($avatar) $avatar->delete();
// TRANS: Success message for deleting a user avatar.
$this->showForm(_('Avatar deleted.'), true);
}
@ -416,7 +429,6 @@ class AvatarsettingsAction extends AccountSettingsAction
*
* @return void
*/
function showScripts()
{
parent::showScripts();

View File

@ -42,7 +42,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
* @link http://status.net/
*/
class BlockAction extends ProfileFormAction
{
var $profile = null;
@ -54,7 +53,6 @@ class BlockAction extends ProfileFormAction
*
* @return boolean success flag
*/
function prepare($args)
{
if (!parent::prepare($args)) {
@ -66,6 +64,7 @@ class BlockAction extends ProfileFormAction
assert(!empty($cur)); // checked by parent
if ($cur->hasBlocked($this->profile)) {
// TRANS: Client error displayed when blocking a user that has already been blocked.
$this->clientError(_('You already blocked that user.'));
return false;
}
@ -82,7 +81,6 @@ class BlockAction extends ProfileFormAction
*
* @return void
*/
function handle($args)
{
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
@ -104,6 +102,7 @@ class BlockAction extends ProfileFormAction
}
function title() {
// TRANS: Title for block user page.
return _('Block user');
}
@ -133,8 +132,10 @@ class BlockAction extends ProfileFormAction
'action' => common_local_url('block')));
$this->elementStart('fieldset');
$this->hidden('token', common_session_token());
// TRANS: Legend for block user form.
$this->element('legend', _('Block user'));
$this->element('p', null,
// TRANS: Explanation of consequences when blocking a user on the block user page.
_('Are you sure you want to block this user? '.
'Afterwards, they will be unsubscribed from you, '.
'unable to subscribe to you in the future, and '.
@ -184,6 +185,7 @@ class BlockAction extends ProfileFormAction
}
if (!$result) {
// TRANS: Server error displayed when blocking a user fails.
$this->serverError(_('Failed to save block information.'));
return;
}

View File

@ -40,7 +40,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class BlockedfromgroupAction extends GroupDesignAction
{
var $page = null;
@ -70,6 +69,7 @@ class BlockedfromgroupAction extends GroupDesignAction
}
if (!$nickname) {
// TRANS: Client error displayed when requesting a list of blocked users for a group without providing a group nickname.
$this->clientError(_('No nickname.'), 404);
return false;
}
@ -77,6 +77,7 @@ class BlockedfromgroupAction extends GroupDesignAction
$local = Local_group::staticGet('nickname', $nickname);
if (!$local) {
// TRANS: Client error displayed when requesting a list of blocked users for a non-local group.
$this->clientError(_('No such group.'), 404);
return false;
}
@ -84,6 +85,7 @@ class BlockedfromgroupAction extends GroupDesignAction
$this->group = User_group::staticGet('id', $local->group_id);
if (!$this->group) {
// TRANS: Client error displayed when requesting a list of blocked users for a non-existing group.
$this->clientError(_('No such group.'), 404);
return false;
}
@ -94,9 +96,13 @@ class BlockedfromgroupAction extends GroupDesignAction
function title()
{
if ($this->page == 1) {
// TRANS: Title for first page with list of users blocked from a group.
// TRANS: %s is a group nickname.
return sprintf(_('%s blocked profiles'),
$this->group->nickname);
} else {
// TRANS: Title for any but the first page with list of users blocked from a group.
// TRANS: %1$s is a group nickname, %2$d is a page number.
return sprintf(_('%1$s blocked profiles, page %2$d'),
$this->group->nickname,
$this->page);
@ -112,6 +118,7 @@ class BlockedfromgroupAction extends GroupDesignAction
function showPageNotice()
{
$this->element('p', 'instructions',
// TRANS: Instructions for list of users blocked from a group.
_('A list of the users blocked from joining this group.'));
}
@ -205,7 +212,6 @@ class GroupBlockListItem extends ProfileListItem
*
* @see UnblockForm
*/
class GroupUnblockForm extends Form
{
/**
@ -234,7 +240,6 @@ class GroupUnblockForm extends Form
* @param User_group $group group to block user from
* @param array $args return-to args
*/
function __construct($out=null, $profile=null, $group=null, $args=null)
{
parent::__construct($out);
@ -249,7 +254,6 @@ class GroupUnblockForm extends Form
*
* @return int ID of the form
*/
function id()
{
// This should be unique for the page.
@ -261,7 +265,6 @@ class GroupUnblockForm extends Form
*
* @return string class of the form
*/
function formClass()
{
return 'form_group_unblock';
@ -272,7 +275,6 @@ class GroupUnblockForm extends Form
*
* @return string URL of the action
*/
function action()
{
return common_local_url('groupunblock');
@ -285,6 +287,7 @@ class GroupUnblockForm extends Form
*/
function formLegend()
{
// TRANS: Form legend for unblocking a user from a group.
$this->out->element('legend', null, _('Unblock user from group'));
}
@ -293,7 +296,6 @@ class GroupUnblockForm extends Form
*
* @return void
*/
function formData()
{
$this->out->hidden('unblockto-' . $this->profile->id,
@ -314,9 +316,14 @@ class GroupUnblockForm extends Form
*
* @return void
*/
function formActions()
{
$this->out->submit('submit', _('Unblock'), 'submit', null, _('Unblock this user'));
$this->out->submit('submit',
// TRANS: Button text for unblocking a user from a group.
_m('BUTTON','Unblock'),
'submit',
null,
// TRANS: Tooltip for button for unblocking a user from a group.
_('Unblock this user'));
}
}

View File

@ -42,12 +42,12 @@ require_once INSTALLDIR . '/actions/newnotice.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 BookmarkletAction extends NewnoticeAction
{
function showTitle()
{
// TRANS: Title for mini-posting window loaded from bookmarklet.
// TRANS: %s is the StatusNet site name.
$this->element('title', null, sprintf(_('Post to %s'), common_config('site', 'name')));
}
@ -73,4 +73,3 @@ class BookmarkletAction extends NewnoticeAction
{
}
}

View File

@ -44,7 +44,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class ConfirmaddressAction extends Action
{
/** type of confirmation. */
@ -61,7 +60,6 @@ class ConfirmaddressAction extends Action
*
* @return void
*/
function handle($args)
{
parent::handle($args);
@ -72,27 +70,30 @@ class ConfirmaddressAction extends Action
}
$code = $this->trimmed('code');
if (!$code) {
// TRANS: Client error displayed when not providing a confirmation code in the contact address confirmation action.
$this->clientError(_('No confirmation code.'));
return;
}
$confirm = Confirm_address::staticGet('code', $code);
if (!$confirm) {
// TRANS: Client error displayed when providing a non-existing confirmation code in the contact address confirmation action.
$this->clientError(_('Confirmation code not found.'));
return;
}
$cur = common_current_user();
if ($cur->id != $confirm->user_id) {
// TRANS: Client error displayed when not providing a confirmation code for another user in the contact address confirmation action.
$this->clientError(_('That confirmation code is not for you!'));
return;
}
$type = $confirm->address_type;
if (!in_array($type, array('email', 'jabber', 'sms'))) {
// TRANS: Server error for an unknow address type, which can be 'email', 'jabber', or 'sms'.
// TRANS: Server error for a unknow address type %s, which can be 'email', 'jabber', or 'sms'.
$this->serverError(sprintf(_('Unrecognized address type %s.'), $type));
return;
}
if ($cur->$type == $confirm->address) {
// TRANS: Client error for an already confirmed email/jabbel/sms address.
// TRANS: Client error for an already confirmed email/jabber/sms address.
$this->clientError(_('That address has already been confirmed.'));
return;
}
@ -113,6 +114,7 @@ class ConfirmaddressAction extends Action
if (!$result) {
common_log_db_error($cur, 'UPDATE', __FILE__);
// TRANS: Server error displayed when a user update to the database fails in the contact address confirmation action.
$this->serverError(_('Couldn\'t update user.'));
return;
}
@ -125,7 +127,9 @@ class ConfirmaddressAction extends Action
if (!$result) {
common_log_db_error($confirm, 'DELETE', __FILE__);
$this->serverError(_('Couldn\'t delete email confirmation.'));
// TRANS: Server error displayed when an address confirmation code deletion from the
// TRANS: database fails in the contact address confirmation action.
$this->serverError(_('Could not delete address confirmation.'));
return;
}
@ -140,9 +144,9 @@ class ConfirmaddressAction extends Action
*
* @return string title
*/
function title()
{
// TRANS: Title for the contact address confirmation action.
return _('Confirm address');
}
@ -151,13 +155,14 @@ class ConfirmaddressAction extends Action
*
* @return void
*/
function showContent()
{
$cur = common_current_user();
$type = $this->type;
$this->element('p', null,
// TRANS: Success message for the contact address confirmation action.
// TRANS: %s can be 'email', 'jabber', or 'sms'.
sprintf(_('The address "%s" has been '.
'confirmed for your account.'),
$cur->$type));

View File

@ -45,7 +45,6 @@ require_once INSTALLDIR.'/lib/noticelist.php';
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
* @link http://status.net/
*/
class ConversationAction extends Action
{
var $id = null;
@ -58,7 +57,6 @@ class ConversationAction extends Action
*
* @return boolean false if id not passed in
*/
function prepare($args)
{
parent::prepare($args);
@ -81,7 +79,6 @@ class ConversationAction extends Action
*
* @return void
*/
function handle($args)
{
parent::handle($args);
@ -93,10 +90,10 @@ class ConversationAction extends Action
*
* @return string page title
*/
function title()
{
return _("Conversation");
// TRANS: Title for page with a conversion (multiple notices in context).
return _('Conversation');
}
/**
@ -107,7 +104,6 @@ class ConversationAction extends Action
*
* @return void
*/
function showContent()
{
$notices = Notice::conversationStream($this->id, null, null);
@ -134,7 +130,6 @@ class ConversationAction extends Action
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
* @link http://status.net/
*/
class ConversationTree extends NoticeList
{
var $tree = null;
@ -145,12 +140,12 @@ class ConversationTree extends NoticeList
*
* @return void
*/
function show()
{
$cnt = $this->_buildTree();
$this->out->elementStart('div', array('id' =>'notices_primary'));
// TRANS: Header on conversation page. Hidden by default (h2).
$this->out->element('h2', null, _('Notices'));
$this->out->elementStart('ol', array('class' => 'notices xoxo'));
@ -200,7 +195,6 @@ class ConversationTree extends NoticeList
*
* @return void
*/
function showNoticePlus($id)
{
$notice = $this->table[$id];
@ -237,7 +231,6 @@ class ConversationTree extends NoticeList
*
* @return NoticeListItem a list item to show
*/
function newListItem($notice)
{
return new ConversationTreeItem($notice, $this->out);
@ -255,7 +248,6 @@ class ConversationTree extends NoticeList
* @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
* @link http://status.net/
*/
class ConversationTreeItem extends NoticeListItem
{
/**
@ -266,7 +258,6 @@ class ConversationTreeItem extends NoticeListItem
*
* @return void
*/
function showStart()
{
return;
@ -280,7 +271,6 @@ class ConversationTreeItem extends NoticeListItem
*
* @return void
*/
function showEnd()
{
return;
@ -293,7 +283,6 @@ class ConversationTreeItem extends NoticeListItem
*
* @return void
*/
function showContext()
{
return;

View File

@ -45,14 +45,13 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class EditgroupAction extends GroupDesignAction
{
var $msg;
function title()
{
// TRANS: Title for form to edit a group. %s is a group nickname.
return sprintf(_('Edit %s group'), $this->group->nickname);
}
@ -65,6 +64,7 @@ class EditgroupAction extends GroupDesignAction
parent::prepare($args);
if (!common_logged_in()) {
// TRANS: Client error displayed trying to edit a group while not logged in.
$this->clientError(_('You must be logged in to create a group.'));
return false;
}
@ -81,6 +81,7 @@ class EditgroupAction extends GroupDesignAction
}
if (!$nickname) {
// TRANS: Client error displayed trying to edit a group while not proving a nickname for the group to edit.
$this->clientError(_('No nickname.'), 404);
return false;
}
@ -97,6 +98,7 @@ class EditgroupAction extends GroupDesignAction
}
if (!$this->group) {
// TRANS: Client error displayed trying to edit a non-existing group.
$this->clientError(_('No such group.'), 404);
return false;
}
@ -104,6 +106,7 @@ class EditgroupAction extends GroupDesignAction
$cur = common_current_user();
if (!$cur->isAdmin($this->group)) {
// TRANS: Client error displayed trying to edit a group while not being a group admin.
$this->clientError(_('You must be an admin to edit the group.'), 403);
return false;
}
@ -120,7 +123,6 @@ class EditgroupAction extends GroupDesignAction
*
* @return void
*/
function handle($args)
{
parent::handle($args);
@ -155,6 +157,7 @@ class EditgroupAction extends GroupDesignAction
$this->element('p', 'error', $this->msg);
} else {
$this->element('p', 'instructions',
// TRANS: Form instructions for group edit form.
_('Use this form to edit the group.'));
}
}
@ -169,6 +172,7 @@ class EditgroupAction extends GroupDesignAction
{
$cur = common_current_user();
if (!$cur->isAdmin($this->group)) {
// TRANS: Client error displayed trying to edit a group while not being a group admin.
$this->clientError(_('You must be an admin to edit the group.'), 403);
return;
}
@ -183,28 +187,39 @@ class EditgroupAction extends GroupDesignAction
if (!Validate::string($nickname, array('min_length' => 1,
'max_length' => 64,
'format' => NICKNAME_FMT))) {
// TRANS: Group edit form validation error.
$this->showForm(_('Nickname must have only lowercase letters '.
'and numbers and no spaces.'));
return;
} else if ($this->nicknameExists($nickname)) {
// TRANS: Group edit form validation error.
$this->showForm(_('Nickname already in use. Try another one.'));
return;
} else if (!User_group::allowedNickname($nickname)) {
// TRANS: Group edit form validation error.
$this->showForm(_('Not a valid nickname.'));
return;
} else if (!is_null($homepage) && (strlen($homepage) > 0) &&
!Validate::uri($homepage,
array('allowed_schemes' =>
array('http', 'https')))) {
// TRANS: Group edit form validation error.
$this->showForm(_('Homepage is not a valid URL.'));
return;
} else if (!is_null($fullname) && mb_strlen($fullname) > 255) {
// TRANS: Group edit form validation error.
$this->showForm(_('Full name is too long (maximum 255 characters).'));
return;
} else if (User_group::descriptionTooLong($description)) {
$this->showForm(sprintf(_('Description is too long (max %d chars).'), User_group::maxDescription()));
$this->showForm(sprintf(
// TRANS: Group edit form validation error.
_m('Description is too long (maximum %d character).',
'Description is too long (maximum %d characters).',
User_group::maxDescription()),
User_group::maxDescription()));
return;
} else if (!is_null($location) && mb_strlen($location) > 255) {
// TRANS: Group edit form validation error.
$this->showForm(_('Location is too long (maximum 255 characters).'));
return;
}
@ -216,7 +231,11 @@ class EditgroupAction extends GroupDesignAction
}
if (count($aliases) > common_config('group', 'maxaliases')) {
$this->showForm(sprintf(_('Too many aliases! Maximum %d.'),
// TRANS: Group edit form validation error.
// TRANS: %d is the maximum number of allowed aliases.
$this->showForm(sprintf(_m('Too many aliases! Maximum %d allowed.',
'Too many aliases! Maximum %d allowed.',
common_config('group', 'maxaliases')),
common_config('group', 'maxaliases')));
return;
}
@ -225,16 +244,19 @@ class EditgroupAction extends GroupDesignAction
if (!Validate::string($alias, array('min_length' => 1,
'max_length' => 64,
'format' => NICKNAME_FMT))) {
// TRANS: Group edit form validation error.
$this->showForm(sprintf(_('Invalid alias: "%s"'), $alias));
return;
}
if ($this->nicknameExists($alias)) {
// TRANS: Group edit form validation error.
$this->showForm(sprintf(_('Alias "%s" already in use. Try another one.'),
$alias));
return;
}
// XXX assumes alphanum nicknames
if (strcmp($alias, $nickname) == 0) {
// TRANS: Group edit form validation error.
$this->showForm(_('Alias can\'t be the same as nickname.'));
return;
}
@ -255,12 +277,14 @@ class EditgroupAction extends GroupDesignAction
if (!$result) {
common_log_db_error($this->group, 'UPDATE', __FILE__);
// TRANS: Server error displayed when editing a group fails.
$this->serverError(_('Could not update group.'));
}
$result = $this->group->setAliases($aliases);
if (!$result) {
// TRANS: Server error displayed when group aliases could not be added.
$this->serverError(_('Could not create aliases.'));
}
@ -277,6 +301,7 @@ class EditgroupAction extends GroupDesignAction
array('nickname' => $nickname)),
303);
} else {
// TRANS: Group edit form success message.
$this->showForm(_('Options saved.'));
}
}
@ -300,4 +325,3 @@ class EditgroupAction extends GroupDesignAction
return false;
}
}

View File

@ -43,25 +43,25 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
class NewgroupAction extends Action
{
var $msg;
function title()
{
// TRANS: Title for form to create a group.
return _('New group');
}
/**
* Prepare to run
*/
function prepare($args)
{
parent::prepare($args);
if (!common_logged_in()) {
// TRANS: Client error displayed trying to create a group while not logged in.
$this->clientError(_('You must be logged in to create a group.'));
return false;
}
@ -78,7 +78,6 @@ class NewgroupAction extends Action
*
* @return void
*/
function handle($args)
{
parent::handle($args);
@ -107,6 +106,7 @@ class NewgroupAction extends Action
$this->element('p', 'error', $this->msg);
} else {
$this->element('p', 'instructions',
// TRANS: Form instructions for group create form.
_('Use this form to create a new group.'));
}
}
@ -123,26 +123,31 @@ class NewgroupAction extends Action
if (!Validate::string($nickname, array('min_length' => 1,
'max_length' => 64,
'format' => NICKNAME_FMT))) {
// TRANS: Group create form validation error.
$this->showForm(_('Nickname must have only lowercase letters '.
'and numbers and no spaces.'));
return;
} else if ($this->nicknameExists($nickname)) {
// TRANS: Group create form validation error.
$this->showForm(_('Nickname already in use. Try another one.'));
return;
} else if (!User_group::allowedNickname($nickname)) {
// TRANS: Group create form validation error.
$this->showForm(_('Not a valid nickname.'));
return;
} else if (!is_null($homepage) && (strlen($homepage) > 0) &&
!Validate::uri($homepage,
array('allowed_schemes' =>
array('http', 'https')))) {
// TRANS: Group create form validation error.
$this->showForm(_('Homepage is not a valid URL.'));
return;
} else if (!is_null($fullname) && mb_strlen($fullname) > 255) {
// TRANS: Group create form validation error.
$this->showForm(_('Full name is too long (maximum 255 characters).'));
return;
} else if (User_group::descriptionTooLong($description)) {
// TRANS: Form validation error creating a new group because the description is too long.
// TRANS: Group create form validation error.
// TRANS: %d is the maximum number of allowed characters.
$this->showForm(sprintf(_m('Description is too long (maximum %d character).',
'Description is too long (maximum %d characters).',
@ -150,6 +155,7 @@ class NewgroupAction extends Action
User_group::maxDescription()));
return;
} else if (!is_null($location) && mb_strlen($location) > 255) {
// TRANS: Group create form validation error.
$this->showForm(_('Location is too long (maximum 255 characters).'));
return;
}
@ -161,7 +167,7 @@ class NewgroupAction extends Action
}
if (count($aliases) > common_config('group', 'maxaliases')) {
// TRANS: Client error shown when providing too many aliases during group creation.
// TRANS: Group create form validation error.
// TRANS: %d is the maximum number of allowed aliases.
$this->showForm(sprintf(_m('Too many aliases! Maximum %d allowed.',
'Too many aliases! Maximum %d allowed.',
@ -174,16 +180,19 @@ class NewgroupAction extends Action
if (!Validate::string($alias, array('min_length' => 1,
'max_length' => 64,
'format' => NICKNAME_FMT))) {
// TRANS: Group create form validation error.
$this->showForm(sprintf(_('Invalid alias: "%s"'), $alias));
return;
}
if ($this->nicknameExists($alias)) {
// TRANS: Group create form validation error.
$this->showForm(sprintf(_('Alias "%s" already in use. Try another one.'),
$alias));
return;
}
// XXX assumes alphanum nicknames
if (strcmp($alias, $nickname) == 0) {
// TRANS: Group create form validation error.
$this->showForm(_('Alias can\'t be the same as nickname.'));
return;
}
@ -227,4 +236,3 @@ class NewgroupAction extends Action
return false;
}
}

View File

@ -44,7 +44,6 @@ if (!defined('STATUSNET')) {
*
* @see BlockForm
*/
class UnblockForm extends ProfileActionForm
{
/**
@ -52,7 +51,6 @@ class UnblockForm extends ProfileActionForm
*
* @return string Name of the action, lowercased.
*/
function target()
{
return 'unblock';
@ -63,11 +61,10 @@ class UnblockForm extends ProfileActionForm
*
* @return string Title of the form, internationalized
*/
function title()
{
// TRANS: Title for the form to unblock a user.
return _('Unblock');
return _m('TITLE','Unblock');
}
/**
@ -75,7 +72,6 @@ class UnblockForm extends ProfileActionForm
*
* @return string description of the form, internationalized
*/
function description()
{
// TRANS: Description of the form to unblock a user.