Skip to content

Commit 8eb8568

Browse files
committed
pht for Releeph
Summary: Went and pht'd most everything I could find, except exceptions. Fixes T3091 Test Plan: Bopped around the application, didn't seem to break anything but didn't test all flows. Should be safe. Reviewers: epriestley, edward Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T3091 Differential Revision: https://secure.phabricator.com/D5825
1 parent ff41013 commit 8eb8568

13 files changed

+156
-145
lines changed

src/applications/releeph/application/PhabricatorApplicationReleeph.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
final class PhabricatorApplicationReleeph extends PhabricatorApplication {
44

55
public function getName() {
6-
return 'Releeph';
6+
return pht('Releeph');
77
}
88

99
public function getShortDescription() {
10-
return 'Release Branches';
10+
return pht('Release Branches');
1111
}
1212

1313
public function getBaseURI() {

src/applications/releeph/controller/ReleephController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ protected function getReleephRequest() {
109109
public function buildStandardPageResponse($view, array $data) {
110110
$page = $this->buildStandardPageView();
111111

112-
$page->setApplicationName('Releeph');
112+
$page->setApplicationName(pht('Releeph'));
113113
$page->setBaseURI('/releeph/');
114114
$page->setTitle(idx($data, 'title'));
115115
$page->setGlyph("\xD3\x82");

src/applications/releeph/controller/branch/ReleephBranchAccessController.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,17 @@ public function processRequest() {
4141
->setURI($origin_uri);
4242
}
4343

44-
$button_text = ucfirst($this->action).' Branch';
45-
$message = hsprintf(
46-
'<p>Really %s the branch <i>%s</i>?</p>',
44+
$button_text = pht('%s Branch', $this->action);
45+
$text = pht('Really %s the branch: %s?',
4746
$this->action,
4847
$rph_branch->getBasename());
48+
$message = phutil_tag('p', array(), $text);
4949

5050

5151
$dialog = new AphrontDialogView();
5252
$dialog
5353
->setUser($request->getUser())
54-
->setTitle('Confirm')
54+
->setTitle(pht('Confirm'))
5555
->appendChild($message)
5656
->addSubmitButton($button_text)
5757
->addCancelButton($origin_uri);

src/applications/releeph/controller/branch/ReleephBranchCreateController.php

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,23 @@ public function processRequest() {
2828
$branch_date_control = id(new AphrontFormDateControl())
2929
->setUser($request->getUser())
3030
->setName('templateDate')
31-
->setLabel('Date')
32-
->setCaption('The date used for filling out the branch template.')
31+
->setLabel(pht('Date'))
32+
->setCaption(pht('The date used for filling out the branch template.'))
3333
->setInitialTime(AphrontFormDateControl::TIME_START_OF_DAY);
3434
$branch_date = $branch_date_control->readValueFromRequest($request);
3535

3636
if ($request->isFormPost()) {
3737
$cut_commit = null;
3838
if (!$cut_point) {
39-
$e_cut = 'Required';
40-
$errors[] = 'You must give a branch cut point';
39+
$e_cut = pht('Required');
40+
$errors[] = pht('You must give a branch cut point');
4141
} else {
4242
try {
4343
$finder = id(new ReleephCommitFinder())
4444
->setReleephProject($releeph_project);
4545
$cut_commit = $finder->fromPartial($cut_point);
4646
} catch (Exception $e) {
47-
$e_cut = 'Invalid';
47+
$e_cut = pht('Invalid');
4848
$errors[] = $e->getMessage();
4949
}
5050
}
@@ -67,39 +67,40 @@ public function processRequest() {
6767
if ($errors) {
6868
$error_view = new AphrontErrorView();
6969
$error_view->setErrors($errors);
70-
$error_view->setTitle('Form Errors');
70+
$error_view->setTitle(pht('Form Errors'));
7171
}
7272

7373
$form = id(new AphrontFormView())
7474
->setUser($request->getUser())
7575
->appendChild(
7676
id(new AphrontFormTextControl())
77-
->setLabel('Symbolic name')
77+
->setLabel(pht('Symbolic Name'))
7878
->setName('symbolicName')
7979
->setValue($symbolic_name)
80-
->setCaption('Mutable alternate name, for easy reference, '.
81-
'(e.g. "LATEST")'))
80+
->setCaption(pht('Mutable alternate name, for easy reference, '.
81+
'(e.g. "LATEST")')))
8282
->appendChild(
8383
id(new AphrontFormTextControl())
84-
->setLabel('Cut point')
84+
->setLabel(pht('Cut point'))
8585
->setName('cutPoint')
8686
->setValue($cut_point)
8787
->setError($e_cut)
8888
->setCaption(
89-
'A commit ID for your repo type, or a Diffusion ID like "rE123"'))
89+
pht('A commit ID for your repo type, or a '.
90+
'Diffusion ID like "rE123"')))
9091
->appendChild($branch_date_control)
9192
->appendChild(
9293
id(new AphrontFormSubmitControl())
93-
->setValue('Cut Branch')
94+
->setValue(pht('Cut Branch'))
9495
->addCancelButton($releeph_project->getURI()));
9596

9697
$panel = id(new AphrontPanelView())
9798
->appendChild($form)
98-
->setHeader('Cut Branch')
99+
->setHeader(pht('Cut Branch'))
99100
->setWidth(AphrontPanelView::WIDTH_FORM);
100101

101102
return $this->buildStandardPageResponse(
102103
array($error_view, $panel),
103-
array('title' => 'Cut new branch'));
104+
array('title' => pht('Cut new branch')));
104105
}
105106
}

src/applications/releeph/controller/branch/ReleephBranchEditController.php

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ public function processRequest() {
2525
$branch_name);
2626

2727
if ($existing_with_same_branch_name) {
28-
$errors[] = sprintf(
28+
$errors[] = pht(
2929
"The branch name %s is currently taken. Please use another name. ",
3030
$branch_name);
31-
$e_existing_with_same_branch_name = 'Error';
31+
$e_existing_with_same_branch_name = pht('Error');
3232
}
3333

3434
if (!$errors) {
@@ -73,52 +73,53 @@ public function processRequest() {
7373
->setUser($request->getUser())
7474
->appendChild(
7575
id(new AphrontFormStaticControl())
76-
->setLabel('Branch name')
76+
->setLabel(pht('Branch Name'))
7777
->setValue($branch_name))
7878
->appendChild(
7979
id(new AphrontFormMarkupControl())
80-
->setLabel('Cut point')
80+
->setLabel(pht('Cut Point'))
8181
->setValue($handles[$cut_commit_phid]->renderLink()))
8282
->appendChild(
8383
id(new AphrontFormMarkupControl())
84-
->setLabel('Created by')
84+
->setLabel(pht('Created By'))
8585
->setValue($handles[$creator_phid]->renderLink()))
8686
->appendChild(
8787
id(new AphrontFormTextControl)
88-
->setLabel('Symbolic Name')
88+
->setLabel(pht('Symbolic Name'))
8989
->setName('symbolicName')
9090
->setValue($symbolic_name)
91-
->setCaption('Mutable alternate name, for easy reference, '.
92-
'(e.g. "LATEST")'))
93-
->appendChild(hsprintf(
94-
'<br>' .
95-
'In dire situations where the branch name is wrong, ' .
96-
'you can edit it in the database by changing the field below. ' .
97-
'If you do this, it is very important that you change your ' .
98-
'branch\'s name in the VCS to reflect the new name in Releeph, ' .
99-
'otherwise a catastrophe of previously unheard-of magnitude ' .
100-
'will befall your project.'))
91+
->setCaption(pht('Mutable alternate name, for easy reference, '.
92+
'(e.g. "LATEST")')))
93+
->appendChild(phutil_tag(
94+
'p',
95+
array(),
96+
pht('In dire situations where the branch name is wrong, ' .
97+
'you can edit it in the database by changing the field below. ' .
98+
'If you do this, it is very important that you change your ' .
99+
'branch\'s name in the VCS to reflect the new name in Releeph, ' .
100+
'otherwise a catastrophe of previously unheard-of magnitude ' .
101+
'will befall your project.')))
101102
->appendChild(
102103
id(new AphrontFormTextControl)
103-
->setLabel('New branch name')
104+
->setLabel(pht('New Branch Name'))
104105
->setName('branchName')
105106
->setValue($branch_name)
106107
->setError($e_existing_with_same_branch_name))
107108
->appendChild(
108109
id(new AphrontFormSubmitControl())
109110
->addCancelButton($releeph_branch->getURI())
110-
->setValue('Save'));
111+
->setValue(pht('Save')));
111112

112113
$error_view = null;
113114
if ($errors) {
114115
$error_view = id(new AphrontErrorView())
115116
->setSeverity(AphrontErrorView::SEVERITY_ERROR)
116117
->setErrors($errors)
117-
->setTitle('Errors');
118+
->setTitle(pht('Errors'));
118119
}
119120

120-
$title = hsprintf(
121-
'Edit branch %s',
121+
$title = pht(
122+
'Edit Branch %s',
122123
$releeph_branch->getDisplayNameWithDetail());
123124

124125
$panel = id(new AphrontPanelView())

src/applications/releeph/controller/branch/ReleephBranchViewController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function processRequest() {
4343

4444
$form->appendChild(
4545
id(new AphrontFormSubmitControl())
46-
->setValue('Filter'));
46+
->setValue(pht('Filter')));
4747

4848
$list = id(new ReleephRequestHeaderListView())
4949
->setOriginType('branch')
@@ -72,7 +72,7 @@ public function processRequest() {
7272
$crumbs->addAction(
7373
id(new PhabricatorMenuItemView())
7474
->setHref($create_uri)
75-
->setName('Request Pick')
75+
->setName(pht('Request Pick'))
7676
->setIcon('create'));
7777
}
7878

src/applications/releeph/controller/project/ReleephProjectActionController.php

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,18 @@ public function processRequest() {
2424

2525
$dialog = id(new AphrontDialogView())
2626
->setUser($request->getUser())
27-
->setTitle('Really deactivate Releeph Project?')
28-
->appendChild(hsprintf(
29-
'<p>Really deactivate the Releeph project <i>%s</i>?',
30-
$rph_project->getName()))
31-
->appendChild(hsprintf(
32-
'<p style="margin-top:1em">It will still exist, but '.
33-
'will be hidden from the list of active projects.</p>'))
34-
->addSubmitButton('Deactivate Releeph Project')
27+
->setTitle(pht('Really deactivate Releeph Project?'))
28+
->appendChild(phutil_tag(
29+
'p',
30+
array(),
31+
pht('Really deactivate the Releeph project: %s?',
32+
$rph_project->getName())))
33+
->appendChild(phutil_tag(
34+
'p',
35+
array(),
36+
pht('It will still exist, but '.
37+
'will be hidden from the list of active projects.')))
38+
->addSubmitButton(pht('Deactivate Releeph Project'))
3539
->addCancelButton($request->getRequestURI());
3640

3741
return id(new AphrontDialogResponse())->setDialog($dialog);
@@ -49,12 +53,15 @@ public function processRequest() {
4953

5054
$dialog = id(new AphrontDialogView())
5155
->setUser($request->getUser())
52-
->setTitle('Really delete Releeph Project?')
53-
->appendChild(hsprintf(
54-
'<p>Really delete the "%s" Releeph project? '.
55-
'This cannot be undone!</p>',
56-
$rph_project->getName()))
57-
->addSubmitButton('Delete Releeph Project')
56+
->setTitle(pht('Really delete Releeph Project?'))
57+
->appendChild(phutil_tag(
58+
'p',
59+
array(),
60+
pht('Really delete the Releeph project: %s? '.
61+
'This cannot be undone!'),
62+
$rph_project->getName()))
63+
->setHeaderColor(PhabricatorActionHeaderView::HEADER_RED)
64+
->addSubmitButton(pht('Delete'))
5865
->addCancelButton($request->getRequestURI());
5966
return id(new AphrontDialogResponse())->setDialog($dialog);
6067

src/applications/releeph/controller/project/ReleephProjectCreateController.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,21 @@ public function processRequest() {
2424

2525
if ($request->isFormPost()) {
2626
if (!$name) {
27-
$e_name = 'Required';
27+
$e_name = pht('Required');
2828
$errors[] =
29-
'Your releeph project should have a simple descriptive name.';
29+
pht('Your Releeph project should have a simple descriptive name.');
3030
}
3131

3232
if (!$trunk_branch) {
33-
$e_trunk_branch = 'Required';
33+
$e_trunk_branch = pht('Required');
3434
$errors[] =
35-
'You must specify which branch you will be picking from.';
35+
pht('You must specify which branch you will be picking from.');
3636
}
3737

3838
$all_names = mpull(id(new ReleephProject())->loadAll(), 'getName');
3939

4040
if (in_array($name, $all_names)) {
41-
$errors[] = "Releeph project name {$name} is already taken";
41+
$errors[] = pht('Releeph project name %s is already taken', $name);
4242
}
4343

4444
$arc_project = $arc_projects[$arc_pr_id];
@@ -63,7 +63,7 @@ public function processRequest() {
6363
if ($errors) {
6464
$error_view = new AphrontErrorView();
6565
$error_view->setErrors($errors);
66-
$error_view->setTitle('Form Errors');
66+
$error_view->setTitle(pht('Form Errors'));
6767
}
6868

6969
// Make our own optgroup select control
@@ -88,19 +88,19 @@ public function processRequest() {
8888
}
8989

9090
$project_name_input = id(new AphrontFormTextControl())
91-
->setLabel('Name')
91+
->setLabel(pht('Name'))
9292
->setDisableAutocomplete(true)
9393
->setName('name')
9494
->setValue($name)
9595
->setError($e_name)
96-
->setCaption('A name like "Thrift" but not "Thrift releases".');
96+
->setCaption(pht('A name like "Thrift" but not "Thrift releases".'));
9797

9898
$arc_project_input = id(new AphrontFormSelectControl())
99-
->setLabel('Arc Project')
99+
->setLabel(pht('Arc Project'))
100100
->setName('arcPrID')
101101
->setValue($arc_pr_id)
102-
->setCaption(hsprintf(
103-
"If your Arc project isn't listed, associate it with a repository %s",
102+
->setCaption(pht(
103+
'If your Arc project isn\'t listed, associate it with a repository %s',
104104
phutil_tag(
105105
'a',
106106
array(
@@ -111,7 +111,7 @@ public function processRequest() {
111111
->setOptions($arc_project_choices);
112112

113113
$branch_name_preview = id(new ReleephBranchPreviewView())
114-
->setLabel('Example Branch')
114+
->setLabel(pht('Example Branch'))
115115
->addControl('projectName', $project_name_input)
116116
->addControl('arcProjectID', $arc_project_input)
117117
->addStatic('template', '')
@@ -123,27 +123,27 @@ public function processRequest() {
123123
->appendChild($arc_project_input)
124124
->appendChild(
125125
id(new AphrontFormTextControl())
126-
->setLabel('Trunk')
126+
->setLabel(pht('Trunk'))
127127
->setName('trunkBranch')
128128
->setValue($trunk_branch)
129129
->setError($e_trunk_branch)
130-
->setCaption('The development branch, '.
131-
'from which requests will be picked.'))
130+
->setCaption(pht('The development branch, '.
131+
'from which requests will be picked.')))
132132
->appendChild($branch_name_preview)
133133
->appendChild(
134134
id(new AphrontFormSubmitControl())
135135
->addCancelButton('/releeph/project/')
136-
->setValue('Create'));
136+
->setValue(pht('Create')));
137137

138138
$panel = id(new AphrontPanelView())
139-
->setHeader('Create Releeph Project')
139+
->setHeader(pht('Create Releeph Project'))
140140
->appendChild($form)
141141
->setWidth(AphrontPanelView::WIDTH_FORM);
142142

143143
return $this->buildStandardPageResponse(
144144
array($error_view, $panel),
145145
array(
146-
'title' => 'Create new Releeph Project'
146+
'title' => pht('Create New Releeph Project')
147147
));
148148
}
149149
}

0 commit comments

Comments
 (0)