phtize all the things

Summary: `pht`ize a whole bunch of strings in rP.

Test Plan: Intense eyeballing.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: hach-que, Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D12797
This commit is contained in:
Joshua Spence
2015-05-22 17:27:56 +10:00
parent d3268aecc2
commit 36e2d02d6e
928 changed files with 5267 additions and 4239 deletions

View File

@@ -6,23 +6,19 @@ abstract class PhabricatorOAuthServerController
public function buildStandardPageResponse($view, array $data) {
$user = $this->getRequest()->getUser();
$page = $this->buildStandardPageView();
$page->setApplicationName('OAuth Server');
$page->setApplicationName(pht('OAuth Server'));
$page->setBaseURI('/oauthserver/');
$page->setTitle(idx($data, 'title'));
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI('/oauthserver/'));
$nav->addLabel('Clients');
$nav->addFilter('client/create',
'Create Client');
$nav->addLabel(pht('Clients'));
$nav->addFilter('client/create', pht('Create Client'));
foreach ($this->getExtraClientFilters() as $filter) {
$nav->addFilter($filter['url'],
$filter['label']);
$nav->addFilter($filter['url'], $filter['label']);
}
$nav->addFilter('client',
'My Clients');
$nav->selectFilter($this->getFilter(),
'clientauthorization');
$nav->addFilter('client', pht('My Clients'));
$nav->selectFilter($this->getFilter(), 'clientauthorization');
$nav->appendChild($view);

View File

@@ -26,25 +26,31 @@ final class PhabricatorOAuthServerTokenController
if ($grant_type != 'authorization_code') {
$response->setError('unsupported_grant_type');
$response->setErrorDescription(
'Only grant_type authorization_code is supported.');
pht(
'Only %s %s is supported.',
'grant_type',
'authorization_code'));
return $response;
}
if (!$code) {
$response->setError('invalid_request');
$response->setErrorDescription(
'Required parameter code missing.');
$response->setErrorDescription(pht('Required parameter code missing.'));
return $response;
}
if (!$client_phid) {
$response->setError('invalid_request');
$response->setErrorDescription(
'Required parameter client_id missing.');
pht(
'Required parameter %s missing.',
'client_id'));
return $response;
}
if (!$client_secret) {
$response->setError('invalid_request');
$response->setErrorDescription(
'Required parameter client_secret missing.');
pht(
'Required parameter %s missing.',
'client_secret'));
return $response;
}
// one giant try / catch around all the exciting database stuff so we
@@ -56,7 +62,9 @@ final class PhabricatorOAuthServerTokenController
if (!$auth_code) {
$response->setError('invalid_grant');
$response->setErrorDescription(
'Authorization code '.$code.' not found.');
pht(
'Authorization code %d not found.',
$code));
return $response;
}
@@ -70,25 +78,29 @@ final class PhabricatorOAuthServerTokenController
$redirect_uri != $auth_code_redirect_uri) {
$response->setError('invalid_grant');
$response->setErrorDescription(
'Redirect uri in request must exactly match redirect uri '.
'from authorization code.');
pht(
'Redirect URI in request must exactly match redirect URI '.
'from authorization code.'));
return $response;
}
} else if ($redirect_uri) {
$response->setError('invalid_grant');
$response->setErrorDescription(
'Redirect uri in request and no redirect uri in authorization '.
'code. The two must exactly match.');
pht(
'Redirect URI in request and no redirect URI in authorization '.
'code. The two must exactly match.'));
return $response;
}
$client = id(new PhabricatorOAuthServerClient())
->loadOneWhere('phid = %s',
$client_phid);
->loadOneWhere('phid = %s', $client_phid);
if (!$client) {
$response->setError('invalid_client');
$response->setErrorDescription(
'Client with client_id '.$client_phid.' not found.');
pht(
'Client with %s %d not found.',
'client_id',
$client_phid));
return $response;
}
$server->setClient($client);
@@ -99,7 +111,9 @@ final class PhabricatorOAuthServerTokenController
if (!$user) {
$response->setError('invalid_grant');
$response->setErrorDescription(
'User with phid '.$user_phid.' not found.');
pht(
'User with PHID %d not found.',
$user_phid));
return $response;
}
$server->setUser($user);
@@ -107,12 +121,15 @@ final class PhabricatorOAuthServerTokenController
$test_code = new PhabricatorOAuthServerAuthorizationCode();
$test_code->setClientSecret($client_secret);
$test_code->setClientPHID($client_phid);
$is_good_code = $server->validateAuthorizationCode($auth_code,
$test_code);
$is_good_code = $server->validateAuthorizationCode(
$auth_code,
$test_code);
if (!$is_good_code) {
$response->setError('invalid_grant');
$response->setErrorDescription(
'Invalid authorization code '.$code.'.');
pht(
'Invalid authorization code %d.',
$code));
return $response;
}
@@ -129,8 +146,9 @@ final class PhabricatorOAuthServerTokenController
} catch (Exception $e) {
$response->setError('server_error');
$response->setErrorDescription(
'The authorization server encountered an unexpected condition '.
'which prevented it from fulfilling the request.');
pht(
'The authorization server encountered an unexpected condition '.
'which prevented it from fulfilling the request.'));
return $response;
}
}

View File

@@ -82,13 +82,13 @@ final class PhabricatorOAuthClientEditController
->setUser($viewer)
->appendChild(
id(new AphrontFormTextControl())
->setLabel('Name')
->setLabel(pht('Name'))
->setName('name')
->setValue($client->getName())
->setError($e_name))
->appendChild(
id(new AphrontFormTextControl())
->setLabel('Redirect URI')
->setLabel(pht('Redirect URI'))
->setName('redirect_uri')
->setValue($client->getRedirectURI())
->setError($e_redirect))

View File

@@ -50,11 +50,11 @@ final class PhabricatorOAuthClientSecretController
if ($is_serious) {
$body = pht(
'The secret associated with this oauth application will be shown in '.
'The secret associated with this OAuth application will be shown in '.
'plain text on your screen.');
} else {
$body = pht(
'The secret associated with this oauth application will be shown in '.
'The secret associated with this OAuth application will be shown in '.
'plain text on your screen. Before continuing, wrap your arms around '.
'your monitor to create a human shield, keeping it safe from prying '.
'eyes. Protect company secrets!');