* remove i18n for debug message.
* add i18n for some server exceptions. * add translator documentation. * L10n updates. * remove superfluous whitespace.
This commit is contained in:
parent
6e1dfab1b9
commit
7903a2504f
|
@ -44,7 +44,6 @@ if (!defined('STATUSNET')) {
|
|||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
class RestoreaccountAction extends Action
|
||||
{
|
||||
private $success = false;
|
||||
|
@ -55,9 +54,9 @@ class RestoreaccountAction extends Action
|
|||
*
|
||||
* @return string page title
|
||||
*/
|
||||
|
||||
function title()
|
||||
{
|
||||
// TRANS: Page title for page where a user account can be restored from backup.
|
||||
return _("Restore account");
|
||||
}
|
||||
|
||||
|
@ -68,7 +67,6 @@ class RestoreaccountAction extends Action
|
|||
*
|
||||
* @return boolean true
|
||||
*/
|
||||
|
||||
function prepare($argarray)
|
||||
{
|
||||
parent::prepare($argarray);
|
||||
|
@ -76,10 +74,12 @@ class RestoreaccountAction extends Action
|
|||
$cur = common_current_user();
|
||||
|
||||
if (empty($cur)) {
|
||||
// TRANS: Client exception displayed when trying to restore an account while not logged in.
|
||||
throw new ClientException(_('Only logged-in users can restore their account.'), 403);
|
||||
}
|
||||
|
||||
if (!$cur->hasRight(Right::RESTOREACCOUNT)) {
|
||||
// TRANS: Client exception displayed when trying to restore an account without having restore rights.
|
||||
throw new ClientException(_('You may not restore your account.'), 403);
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,6 @@ class RestoreaccountAction extends Action
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function handle($argarray=null)
|
||||
{
|
||||
parent::handle($argarray);
|
||||
|
@ -113,12 +112,12 @@ class RestoreaccountAction extends Action
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function restoreAccount()
|
||||
{
|
||||
$this->checkSessionToken();
|
||||
|
||||
if (!isset($_FILES['restorefile']['error'])) {
|
||||
// TRANS: Client exception displayed trying to restore an account while something went wrong uploading a file.
|
||||
throw new ClientException(_('No uploaded file.'));
|
||||
}
|
||||
|
||||
|
@ -143,7 +142,7 @@ class RestoreaccountAction extends Action
|
|||
' partially uploaded.'));
|
||||
return;
|
||||
case UPLOAD_ERR_NO_FILE:
|
||||
// No file; probably just a non-AJAX submission.
|
||||
// TRANS: Client exception. No file; probably just a non-AJAX submission.
|
||||
throw new ClientException(_('No uploaded file.'));
|
||||
return;
|
||||
case UPLOAD_ERR_NO_TMP_DIR:
|
||||
|
@ -170,18 +169,21 @@ class RestoreaccountAction extends Action
|
|||
|
||||
try {
|
||||
if (!file_exists($filename)) {
|
||||
throw new ServerException("No such file '$filename'.");
|
||||
// TRANS: Server exception thrown when an expected file upload could not be found.
|
||||
throw new ServerException(_("No such file '$filename'."));
|
||||
}
|
||||
|
||||
if (!is_file($filename)) {
|
||||
throw new ServerException("Not a regular file: '$filename'.");
|
||||
// TRANS: Server exception thrown when an expected file upload is not an actual file.
|
||||
throw new ServerException(_("Not a regular file: '$filename'."));
|
||||
}
|
||||
|
||||
if (!is_readable($filename)) {
|
||||
throw new ServerException("File '$filename' not readable.");
|
||||
// TRANS: Server exception thrown when an expected file upload could not be read.
|
||||
throw new ServerException(_("File '$filename' not readable."));
|
||||
}
|
||||
|
||||
common_debug(sprintf(_("Getting backup from file '%s'."), $filename));
|
||||
common_debug(sprintf("Getting backup from file '%s'.", $filename));
|
||||
|
||||
$xml = file_get_contents($filename);
|
||||
|
||||
|
@ -201,7 +203,8 @@ class RestoreaccountAction extends Action
|
|||
if (!$feed ||
|
||||
$feed->namespaceURI != Activity::ATOM ||
|
||||
$feed->localName != 'feed') {
|
||||
throw new ClientException(_("Not an atom feed."));
|
||||
// TRANS: Client exception thrown when a feed is not an Atom feed.
|
||||
throw new ClientException(_("Not an Atom feed."));
|
||||
}
|
||||
|
||||
// Enqueue for processing.
|
||||
|
@ -230,14 +233,15 @@ class RestoreaccountAction extends Action
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function showContent()
|
||||
{
|
||||
if ($this->success) {
|
||||
$this->element('p', null,
|
||||
// TRANS: Success message when a feed has been restored.
|
||||
_('Feed has been restored. Your old posts should now appear in search and your profile page.'));
|
||||
} else if ($this->inprogress) {
|
||||
$this->element('p', null,
|
||||
// TRANS: Message when a feed restore is in progress.
|
||||
_('Feed will be restored. Please wait a few minutes for results.'));
|
||||
} else {
|
||||
$form = new RestoreAccountForm($this);
|
||||
|
@ -254,7 +258,6 @@ class RestoreaccountAction extends Action
|
|||
*
|
||||
* @return boolean is read only action?
|
||||
*/
|
||||
|
||||
function isReadOnly($args)
|
||||
{
|
||||
return false;
|
||||
|
@ -267,7 +270,6 @@ class RestoreaccountAction extends Action
|
|||
*
|
||||
* @return string last modified http header
|
||||
*/
|
||||
|
||||
function lastModified()
|
||||
{
|
||||
// For comparison with If-Last-Modified
|
||||
|
@ -282,7 +284,6 @@ class RestoreaccountAction extends Action
|
|||
*
|
||||
* @return string etag http header
|
||||
*/
|
||||
|
||||
function etag()
|
||||
{
|
||||
return null;
|
||||
|
@ -299,7 +300,6 @@ class RestoreaccountAction extends Action
|
|||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
class RestoreAccountForm extends Form
|
||||
{
|
||||
function __construct($out=null) {
|
||||
|
@ -312,7 +312,6 @@ class RestoreAccountForm extends Form
|
|||
*
|
||||
* @return string the form's class
|
||||
*/
|
||||
|
||||
function formClass()
|
||||
{
|
||||
return 'form_profile_restore';
|
||||
|
@ -323,7 +322,6 @@ class RestoreAccountForm extends Form
|
|||
*
|
||||
* @return string the form's action URL
|
||||
*/
|
||||
|
||||
function action()
|
||||
{
|
||||
return common_local_url('restoreaccount');
|
||||
|
@ -336,11 +334,11 @@ class RestoreAccountForm extends Form
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function formData()
|
||||
{
|
||||
$this->out->elementStart('p', 'instructions');
|
||||
|
||||
// TRANS: Form instructions for feed restore.
|
||||
$this->out->raw(_('You can upload a backed-up stream in '.
|
||||
'<a href="http://activitystrea.ms/">Activity Streams</a> format.'));
|
||||
|
||||
|
@ -364,13 +362,14 @@ class RestoreAccountForm extends Form
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function formActions()
|
||||
{
|
||||
$this->out->submit('submit',
|
||||
// TRANS: Submit button to confirm upload of a user backup file for account restore.
|
||||
_m('BUTTON', 'Upload'),
|
||||
'submit',
|
||||
null,
|
||||
// TRANS: Title for submit button to confirm upload of a user backup file for account restore.
|
||||
_('Upload the file'));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user