Commit cb74822e authored by Siebrand Mazeland's avatar Siebrand Mazeland

i18n/L10n consistency updates.

parent 50015799
......@@ -95,9 +95,11 @@ class ApiAccountUpdateProfileImageAction extends ApiAuthAction
&& empty($_POST)
&& ($_SERVER['CONTENT_LENGTH'] > 0)
) {
$msg = _('The server was unable to handle that much POST ' .
'data (%s bytes) due to its current configuration.');
// TRANS: Client error displayed when the number of bytes in a POST request exceeds a limit.
// TRANS: %s is the number of bytes of the CONTENT_LENGTH.
$msg = _m('The server was unable to handle that much POST data (%s byte) due to its current configuration.',
'The server was unable to handle that much POST data (%s bytes) due to its current configuration.',
intval($_SERVER['CONTENT_LENGTH']));
$this->clientError(sprintf($msg, $_SERVER['CONTENT_LENGTH']));
return;
}
......
......@@ -49,7 +49,6 @@ require_once INSTALLDIR . '/lib/apiauth.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 ApiGroupCreateAction extends ApiAuthAction
{
var $group = null;
......@@ -95,7 +94,6 @@ class ApiGroupCreateAction extends ApiAuthAction
*
* @return void
*/
function handle($args)
{
parent::handle($args);
......@@ -111,6 +109,7 @@ class ApiGroupCreateAction extends ApiAuthAction
}
if (empty($this->user)) {
// TRANS: Client error given when a user was not found (404).
$this->clientError(_('No such user.'), 404, $this->format);
return;
}
......@@ -137,13 +136,13 @@ class ApiGroupCreateAction extends ApiAuthAction
break;
default:
$this->clientError(
// TRANS: Client error given when an API method was not found (404).
_('API method not found.'),
404,
$this->format
);
break;
}
}
/**
......@@ -164,6 +163,7 @@ class ApiGroupCreateAction extends ApiAuthAction
if (!$valid) {
$this->clientError(
// TRANS: Validation error in form for group creation.
_(
'Nickname must have only lowercase letters ' .
'and numbers and no spaces.'
......@@ -174,6 +174,7 @@ class ApiGroupCreateAction extends ApiAuthAction
return false;
} elseif ($this->groupNicknameExists($this->nickname)) {
$this->clientError(
// TRANS: Client error trying to create a group with a nickname this is already in use.
_('Nickname already in use. Try another one.'),
403,
$this->format
......@@ -181,6 +182,7 @@ class ApiGroupCreateAction extends ApiAuthAction
return false;
} else if (!User_group::allowedNickname($this->nickname)) {
$this->clientError(
// TRANS: Client error in form for group creation.
_('Not a valid nickname.'),
403,
$this->format
......@@ -197,6 +199,7 @@ class ApiGroupCreateAction extends ApiAuthAction
)
)) {
$this->clientError(
// TRANS: Client error in form for group creation.
_('Homepage is not a valid URL.'),
403,
$this->format
......@@ -206,7 +209,8 @@ class ApiGroupCreateAction extends ApiAuthAction
!is_null($this->fullname)
&& mb_strlen($this->fullname) > 255) {
$this->clientError(
_('Full name is too long (max 255 chars).'),
// TRANS: Client error in form for group creation.
_('Full name is too long (maximum 255 characters).'),
403,
$this->format
);
......@@ -225,7 +229,7 @@ class ApiGroupCreateAction extends ApiAuthAction
!is_null($this->location)
&& mb_strlen($this->location) > 255) {
$this->clientError(
_('Location is too long (max 255 chars).'),
_('Location is too long (maximum 255 characters).'),
403,
$this->format
);
......
......@@ -78,9 +78,11 @@ class ApiMediaUploadAction extends ApiAuthAction
&& empty($_POST)
&& ($_SERVER['CONTENT_LENGTH'] > 0)
) {
$msg = _('The server was unable to handle that much POST ' .
'data (%s bytes) due to its current configuration.');
// TRANS: Client error displayed when the number of bytes in a POST request exceeds a limit.
// TRANS: %s is the number of bytes of the CONTENT_LENGTH.
$msg = _m('The server was unable to handle that much POST data (%s byte) due to its current configuration.',
'The server was unable to handle that much POST data (%s bytes) due to its current configuration.',
intval($_SERVER['CONTENT_LENGTH']));
$this->clientError(sprintf($msg, $_SERVER['CONTENT_LENGTH']));
return;
}
......
......@@ -254,9 +254,11 @@ class AvatarsettingsAction extends AccountSettingsAction
&& empty($_POST)
&& ($_SERVER['CONTENT_LENGTH'] > 0)
) {
$msg = _('The server was unable to handle that much POST ' .
'data (%s bytes) due to its current configuration.');
// TRANS: Client error displayed when the number of bytes in a POST request exceeds a limit.
// TRANS: %s is the number of bytes of the CONTENT_LENGTH.
$msg = _m('The server was unable to handle that much POST data (%s byte) due to its current configuration.',
'The server was unable to handle that much POST data (%s bytes) due to its current configuration.',
intval($_SERVER['CONTENT_LENGTH']));
$this->showForm(sprintf($msg, $_SERVER['CONTENT_LENGTH']));
return;
}
......
......@@ -120,8 +120,11 @@ class DesignadminpanelAction extends AdminPanelAction
&& empty($_POST)
&& ($_SERVER['CONTENT_LENGTH'] > 0)
) {
$msg = _('The server was unable to handle that much POST ' .
'data (%s bytes) due to its current configuration.');
// TRANS: Client error displayed when the number of bytes in a POST request exceeds a limit.
// TRANS: %s is the number of bytes of the CONTENT_LENGTH.
$msg = _m('The server was unable to handle that much POST data (%s byte) due to its current configuration.',
'The server was unable to handle that much POST data (%s bytes) due to its current configuration.',
intval($_SERVER['CONTENT_LENGTH']));
$this->clientException(sprintf($msg, $_SERVER['CONTENT_LENGTH']));
return;
}
......
......@@ -116,9 +116,11 @@ class EditApplicationAction extends OwnerDesignAction
&& empty($_POST)
&& ($_SERVER['CONTENT_LENGTH'] > 0)
) {
// TRANS: Client exception. %s is CONTENT_LENGTH (in bytes).
$msg = _('The server was unable to handle that much POST ' .
'data (%s bytes) due to its current configuration.');
// TRANS: Client error displayed when the number of bytes in a POST request exceeds a limit.
// TRANS: %s is the number of bytes of the CONTENT_LENGTH.
$msg = _m('The server was unable to handle that much POST data (%s byte) due to its current configuration.',
'The server was unable to handle that much POST data (%s bytes) due to its current configuration.',
intval($_SERVER['CONTENT_LENGTH']));
$this->clientException(sprintf($msg, $_SERVER['CONTENT_LENGTH']));
return;
}
......
......@@ -199,13 +199,13 @@ class EditgroupAction extends GroupDesignAction
$this->showForm(_('Homepage is not a valid URL.'));
return;
} else if (!is_null($fullname) && mb_strlen($fullname) > 255) {
$this->showForm(_('Full name is too long (max 255 chars).'));
$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(_('Description is too long (max %d chars).'), User_group::maxDescription()));
return;
} else if (!is_null($location) && mb_strlen($location) > 255) {
$this->showForm(_('Location is too long (max 255 chars).'));
$this->showForm(_('Location is too long (maximum 255 characters).'));
return;
}
......
......@@ -42,14 +42,14 @@ 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 NewApplicationAction extends OwnerDesignAction
{
var $msg;
function title()
{
return _('New Application');
// TRANS: This is the title of the form for adding a new application.
return _('New application');
}
/**
......@@ -61,6 +61,7 @@ class NewApplicationAction extends OwnerDesignAction
parent::prepare($args);
if (!common_logged_in()) {
// TRANS: Client error displayed trying to add a new application while not logged in.
$this->clientError(_('You must be logged in to register an application.'));
return false;
}
......@@ -91,35 +92,38 @@ class NewApplicationAction extends OwnerDesignAction
function handlePost($args)
{
// Workaround for PHP returning empty $_POST and $_FILES when POST
// Workaround for PHP returning empty $_POST and $_FILES when POST
// length > post_max_size in php.ini
if (empty($_FILES)
&& empty($_POST)
&& ($_SERVER['CONTENT_LENGTH'] > 0)
) {
$msg = _('The server was unable to handle that much POST ' .
'data (%s bytes) due to its current configuration.');
// TRANS: Client error displayed when the number of bytes in a POST request exceeds a limit.
// TRANS: %s is the number of bytes of the CONTENT_LENGTH.
$msg = _m('The server was unable to handle that much POST data (%s byte) due to its current configuration.',
'The server was unable to handle that much POST data (%s bytes) due to its current configuration.',
intval($_SERVER['CONTENT_LENGTH']));
$this->clientException(sprintf($msg, $_SERVER['CONTENT_LENGTH']));
return;
}
// CSRF protection
$token = $this->trimmed('token');
if (!$token || $token != common_session_token()) {
$this->clientError(_('There was a problem with your session token.'));
return;
}
// CSRF protection
$token = $this->trimmed('token');
if (!$token || $token != common_session_token()) {
$this->clientError(_('There was a problem with your session token.'));
return;
}
$cur = common_current_user();
$cur = common_current_user();
if ($this->arg('cancel')) {
common_redirect(common_local_url('oauthappssettings'), 303);
} elseif ($this->arg('save')) {
$this->trySave();
} else {
$this->clientError(_('Unexpected form submission.'));
}
if ($this->arg('cancel')) {
common_redirect(common_local_url('oauthappssettings'), 303);
} elseif ($this->arg('save')) {
$this->trySave();
} else {
$this->clientError(_('Unexpected form submission.'));
}
}
function showForm($msg=null)
......@@ -162,14 +166,18 @@ class NewApplicationAction extends OwnerDesignAction
$this->showForm(_('Name already in use. Try another one.'));
return;
} elseif (mb_strlen($name) > 255) {
$this->showForm(_('Name is too long (max 255 chars).'));
$this->showForm(_('Name is too long (maximum 255 chars).'));
return;
} elseif (empty($description)) {
$this->showForm(_('Description is required.'));
return;
} elseif (Oauth_application::descriptionTooLong($description)) {
$this->showForm(sprintf(
_('Description is too long (max %d chars).'),
// TRANS: Form validation error in New application form.
// TRANS: %d is the maximum number of characters for the description.
_m('Description is too long (maximum %d character).',
'Description is too long (maximum %d characters).',
Oauth_application::maxDesc()),
Oauth_application::maxDesc()));
return;
} elseif (empty($source_url)) {
......@@ -188,7 +196,7 @@ class NewApplicationAction extends OwnerDesignAction
$this->showForm(_('Organization is required.'));
return;
} elseif (mb_strlen($organization) > 255) {
$this->showForm(_('Organization is too long (max 255 chars).'));
$this->showForm(_('Organization is too long (maximum 255 chars).'));
return;
} elseif (empty($homepage)) {
$this->showForm(_('Organization homepage is required.'));
......
......@@ -139,13 +139,13 @@ class NewgroupAction extends Action
$this->showForm(_('Homepage is not a valid URL.'));
return;
} else if (!is_null($fullname) && mb_strlen($fullname) > 255) {
$this->showForm(_('Full name is too long (max 255 chars).'));
$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()));
return;
} else if (!is_null($location) && mb_strlen($location) > 255) {
$this->showForm(_('Location is too long (max 255 chars).'));
$this->showForm(_('Location is too long (maximum 255 characters).'));
return;
}
......
......@@ -147,8 +147,11 @@ class NewmessageAction extends Action
$content_shortened = common_shorten_links($this->content);
if (Message::contentTooLong($content_shortened)) {
$this->showForm(sprintf(_('That\'s too long. ' .
'Max message size is %d chars.'),
// TRANS: Form validation error displayed when message content is too long.
// TRANS: %d is the maximum number of characters for a message.
$this->showForm(sprintf(_m('That\'s too long. Maximum message size is %d character.',
'That\'s too long. Maximum message size is %d characters.',
Message::maxContent()),
Message::maxContent()));
return;
}
......
......@@ -82,7 +82,6 @@ class NewnoticeAction extends Action
*
* @return void
*/
function handle($args)
{
if (!common_logged_in()) {
......@@ -91,9 +90,12 @@ class NewnoticeAction extends Action
// check for this before token since all POST and FILES data
// is losts when size is exceeded
if (empty($_POST) && $_SERVER['CONTENT_LENGTH']) {
$this->clientError(sprintf(_('The server was unable to handle ' .
'that much POST data (%s bytes) due to its current configuration.'),
$_SERVER['CONTENT_LENGTH']));
// TRANS: Client error displayed when the number of bytes in a POST request exceeds a limit.
// TRANS: %s is the number of bytes of the CONTENT_LENGTH.
$msg = _m('The server was unable to handle that much POST data (%s byte) due to its current configuration.',
'The server was unable to handle that much POST data (%s bytes) due to its current configuration.',
intval($_SERVER['CONTENT_LENGTH']));
$this->clientError(sprintf($msg,$_SERVER['CONTENT_LENGTH']));
}
parent::handle($args);
......@@ -352,4 +354,3 @@ class NewnoticeAction extends Action
$nli->show();
}
}
......@@ -253,20 +253,20 @@ class ProfilesettingsAction extends AccountSettingsAction
return;
} else if (!is_null($fullname) && mb_strlen($fullname) > 255) {
// TRANS: Validation error in form for profile settings.
$this->showForm(_('Full name is too long (max 255 characters).'));
$this->showForm(_('Full name is too long (maximum 255 characters).'));
return;
} else if (Profile::bioTooLong($bio)) {
// TRANS: Validation error in form for profile settings.
// TRANS: Plural form is used based on the maximum number of allowed
// TRANS: characters for the biography (%d).
$this->showForm(sprintf(_m('Bio is too long (max %d character).',
'Bio is too long (max %d characters).',
$this->showForm(sprintf(_m('Bio is too long (maximum %d character).',
'Bio is too long (maximum %d characters).',
Profile::maxBio()),
Profile::maxBio()));
return;
} else if (!is_null($location) && mb_strlen($location) > 255) {
// TRANS: Validation error in form for profile settings.
$this->showForm(_('Location is too long (max 255 characters).'));
$this->showForm(_('Location is too long (maximum 255 characters).'));
return;
} else if (is_null($timezone) || !in_array($timezone, DateTimeZone::listIdentifiers())) {
// TRANS: Validation error in form for profile settings.
......@@ -278,7 +278,7 @@ class ProfilesettingsAction extends AccountSettingsAction
return;
} else if (!is_null($language) && strlen($language) > 50) {
// TRANS: Validation error in form for profile settings.
$this->showForm(_('Language is too long (max 50 characters).'));
$this->showForm(_('Language is too long (maximum 50 characters).'));
return;
}
......
......@@ -224,14 +224,16 @@ class RegisterAction extends Action
$this->showForm(_('Homepage is not a valid URL.'));
return;
} else if (!is_null($fullname) && mb_strlen($fullname) > 255) {
$this->showForm(_('Full name is too long (max 255 chars).'));
$this->showForm(_('Full name is too long (maximum 255 characters).'));
return;
} else if (Profile::bioTooLong($bio)) {
$this->showForm(sprintf(_('Bio is too long (max %d chars).'),
$this->showForm(sprintf(_m('Bio is too long (maximum %d character).',
'Bio is too long (maximum %d characters).',
Profile::maxBio()),
Profile::maxBio()));
return;
} else if (!is_null($location) && mb_strlen($location) > 255) {
$this->showForm(_('Location is too long (max 255 chars).'));
$this->showForm(_('Location is too long (maximum 255 characters).'));
return;
} else if (strlen($password) < 6) {
$this->showForm(_('Password must be 6 or more characters.'));
......@@ -465,7 +467,12 @@ class RegisterAction extends Action
$this->elementStart('li');
$maxBio = Profile::maxBio();
if ($maxBio > 0) {
$bioInstr = sprintf(_('Describe yourself and your interests in %d chars'),
// TRANS: Tooltip for field label in form for profile settings. Plural
// TRANS: is decided by the number of characters available for the
// TRANS: biography (%d).
$bioInstr = sprintf(_m('Describe yourself and your interests in %d character',
'Describe yourself and your interests in %d characters',
$maxBio),
$maxBio);
} else {
$bioInstr = _('Describe yourself and your interests');
......
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