From cb74822e7ad0d03fa0b4dbc3b9c4c14778ba3841 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Thu, 21 Oct 2010 13:20:21 +0200 Subject: [PATCH] i18n/L10n consistency updates. --- actions/apiaccountupdateprofileimage.php | 8 ++-- actions/apigroupcreate.php | 14 ++++--- actions/apimediaupload.php | 8 ++-- actions/avatarsettings.php | 8 ++-- actions/designadminpanel.php | 7 +++- actions/editapplication.php | 8 ++-- actions/editgroup.php | 6 +-- actions/newapplication.php | 52 ++++++++++++++---------- actions/newgroup.php | 4 +- actions/newmessage.php | 7 +++- actions/newnotice.php | 11 ++--- actions/profilesettings.php | 10 ++--- actions/register.php | 15 +++++-- 13 files changed, 96 insertions(+), 62 deletions(-) diff --git a/actions/apiaccountupdateprofileimage.php b/actions/apiaccountupdateprofileimage.php index 7f868a6eb3..1f38bd2204 100644 --- a/actions/apiaccountupdateprofileimage.php +++ b/actions/apiaccountupdateprofileimage.php @@ -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; } diff --git a/actions/apigroupcreate.php b/actions/apigroupcreate.php index fa443573d6..1608e030b8 100644 --- a/actions/apigroupcreate.php +++ b/actions/apigroupcreate.php @@ -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 ); diff --git a/actions/apimediaupload.php b/actions/apimediaupload.php index 54d7fda68f..a33771caea 100644 --- a/actions/apimediaupload.php +++ b/actions/apimediaupload.php @@ -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; } diff --git a/actions/avatarsettings.php b/actions/avatarsettings.php index 52dc2e4249..9d4040e75a 100644 --- a/actions/avatarsettings.php +++ b/actions/avatarsettings.php @@ -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; } diff --git a/actions/designadminpanel.php b/actions/designadminpanel.php index 199be43ead..321a8ee5eb 100644 --- a/actions/designadminpanel.php +++ b/actions/designadminpanel.php @@ -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; } diff --git a/actions/editapplication.php b/actions/editapplication.php index 5d23627f1d..d1c7a5c3d5 100644 --- a/actions/editapplication.php +++ b/actions/editapplication.php @@ -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; } diff --git a/actions/editgroup.php b/actions/editgroup.php index 4b596cade9..eaadbabe45 100644 --- a/actions/editgroup.php +++ b/actions/editgroup.php @@ -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; } diff --git a/actions/newapplication.php b/actions/newapplication.php index 8b150c3151..033c0852d9 100644 --- a/actions/newapplication.php +++ b/actions/newapplication.php @@ -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.')); diff --git a/actions/newgroup.php b/actions/newgroup.php index 75bc293ec6..ebfe9b599d 100644 --- a/actions/newgroup.php +++ b/actions/newgroup.php @@ -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; } diff --git a/actions/newmessage.php b/actions/newmessage.php index 25e58feab3..c58ed3849e 100644 --- a/actions/newmessage.php +++ b/actions/newmessage.php @@ -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; } diff --git a/actions/newnotice.php b/actions/newnotice.php index ea832cf4e1..57cd847c6e 100644 --- a/actions/newnotice.php +++ b/actions/newnotice.php @@ -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(); } } - diff --git a/actions/profilesettings.php b/actions/profilesettings.php index 0c1efa9072..e1a0f8b6d0 100644 --- a/actions/profilesettings.php +++ b/actions/profilesettings.php @@ -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; } diff --git a/actions/register.php b/actions/register.php index 7307bc689b..3ae3f56f60 100644 --- a/actions/register.php +++ b/actions/register.php @@ -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');