some strings to localize external mount api responses. fix #8094

This commit is contained in:
Volkan Gezer 2014-06-12 20:31:07 +02:00
parent b595c982d0
commit 565f0b281c
2 changed files with 7 additions and 5 deletions

View File

@ -5,6 +5,7 @@ require_once __DIR__ . '/../3rdparty/Dropbox/autoload.php';
OCP\JSON::checkAppEnabled('files_external'); OCP\JSON::checkAppEnabled('files_external');
OCP\JSON::checkLoggedIn(); OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck(); OCP\JSON::callCheck();
$l = OC_L10N::get('files_external');
if (isset($_POST['app_key']) && isset($_POST['app_secret'])) { if (isset($_POST['app_key']) && isset($_POST['app_secret'])) {
$oauth = new Dropbox_OAuth_Curl($_POST['app_key'], $_POST['app_secret']); $oauth = new Dropbox_OAuth_Curl($_POST['app_key'], $_POST['app_secret']);
@ -23,7 +24,7 @@ if (isset($_POST['app_key']) && isset($_POST['app_secret'])) {
'request_token_secret' => $token['token_secret']))); 'request_token_secret' => $token['token_secret'])));
} catch (Exception $exception) { } catch (Exception $exception) {
OCP\JSON::error(array('data' => array('message' => OCP\JSON::error(array('data' => array('message' =>
'Fetching request tokens failed. Verify that your Dropbox app key and secret are correct.') $l->t('Fetching request tokens failed. Verify that your Dropbox app key and secret are correct.'))
)); ));
} }
break; break;
@ -36,7 +37,7 @@ if (isset($_POST['app_key']) && isset($_POST['app_secret'])) {
'access_token_secret' => $token['token_secret'])); 'access_token_secret' => $token['token_secret']));
} catch (Exception $exception) { } catch (Exception $exception) {
OCP\JSON::error(array('data' => array('message' => OCP\JSON::error(array('data' => array('message' =>
'Fetching access tokens failed. Verify that your Dropbox app key and secret are correct.') $l->t('Fetching access tokens failed. Verify that your Dropbox app key and secret are correct.'))
)); ));
} }
} }
@ -44,5 +45,5 @@ if (isset($_POST['app_key']) && isset($_POST['app_secret'])) {
} }
} }
} else { } else {
OCP\JSON::error(array('data' => array('message' => 'Please provide a valid Dropbox app key and secret.'))); OCP\JSON::error(array('data' => array('message' => $l->t('Please provide a valid Dropbox app key and secret.'))));
} }

View File

@ -6,6 +6,7 @@ require_once 'Google_Client.php';
OCP\JSON::checkAppEnabled('files_external'); OCP\JSON::checkAppEnabled('files_external');
OCP\JSON::checkLoggedIn(); OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck(); OCP\JSON::callCheck();
$l = OC_L10N::get('files_external');
if (isset($_POST['client_id']) && isset($_POST['client_secret']) && isset($_POST['redirect'])) { if (isset($_POST['client_id']) && isset($_POST['client_secret']) && isset($_POST['redirect'])) {
$client = new Google_Client(); $client = new Google_Client();
@ -23,7 +24,7 @@ if (isset($_POST['client_id']) && isset($_POST['client_secret']) && isset($_POST
))); )));
} catch (Exception $exception) { } catch (Exception $exception) {
OCP\JSON::error(array('data' => array( OCP\JSON::error(array('data' => array(
'message' => 'Step 1 failed. Exception: '.$exception->getMessage() 'message' => $l->t('Step 1 failed. Exception: %s', array($exception->getMessage()))
))); )));
} }
} else if ($step == 2 && isset($_POST['code'])) { } else if ($step == 2 && isset($_POST['code'])) {
@ -34,7 +35,7 @@ if (isset($_POST['client_id']) && isset($_POST['client_secret']) && isset($_POST
))); )));
} catch (Exception $exception) { } catch (Exception $exception) {
OCP\JSON::error(array('data' => array( OCP\JSON::error(array('data' => array(
'message' => 'Step 2 failed. Exception: '.$exception->getMessage() 'message' => $l->t('Step 2 failed. Exception: %s', array($exception->getMessage()))
))); )));
} }
} }