Skip to content

Commit 51dfeb7

Browse files
committed
pht for phriction
Summary: Scan all phriction app files for text to pht Test Plan: Use phriction in ALL CAPS, seems reasonably usable. Reviewers: epriestley, btrahan Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D4862
1 parent 9c19e9b commit 51dfeb7

9 files changed

+75
-72
lines changed

src/applications/phriction/application/PhabricatorApplicationPhriction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
final class PhabricatorApplicationPhriction extends PhabricatorApplication {
44

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

99
public function getBaseURI() {

src/applications/phriction/controller/PhrictionController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public function buildStandardPageResponse($view, array $data) {
99

1010
$page = $this->buildStandardPageView();
1111

12-
$page->setApplicationName('Phriction');
12+
$page->setApplicationName(pht('Phriction'));
1313
$page->setBaseURI('/w/');
1414
$page->setTitle(idx($data, 'title'));
1515
$page->setGlyph("\xE2\x9A\xA1");
@@ -32,7 +32,7 @@ public function buildSideNavView($filter = null, $for_app = false) {
3232
$nav->addFilter('', pht('Create Document'), '/phriction/new');
3333
}
3434

35-
$nav->addLabel('Filters');
35+
$nav->addLabel(pht('Filters'));
3636
$nav->addFilter('active', pht('Active Documents'));
3737
$nav->addFilter('all', pht('All Documents'));
3838
$nav->addFilter('updates', pht('Recently Updated'));

src/applications/phriction/controller/PhrictionDeleteController.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ public function processRequest() {
3232

3333
$dialog = id(new AphrontDialogView())
3434
->setUser($user)
35-
->setTitle('Delete document?')
35+
->setTitle(pht('Delete document?'))
3636
->appendChild(
37-
'Really delete this document? You can recover it later by reverting '.
38-
'to a previous version.')
39-
->addSubmitButton('Delete')
37+
pht('Really delete this document? You can recover it later by '.
38+
'reverting to a previous version.'))
39+
->addSubmitButton(pht('Delete'))
4040
->addCancelButton($document_uri);
4141

4242
return id(new AphrontDialogResponse())->setDialog($dialog);

src/applications/phriction/controller/PhrictionDiffController.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,9 @@ public function processRequest() {
138138
array(
139139
'href' => $uri->alter('l', $l - 1)->alter('r', $r - 1),
140140
),
141-
"\xC2\xAB Previous Change");
141+
pht("\xC2\xAB Previous Change"));
142142
} else {
143-
$link_l = 'Original Change';
143+
$link_l = pht('Original Change');
144144
}
145145

146146
$link_r = null;
@@ -150,9 +150,9 @@ public function processRequest() {
150150
array(
151151
'href' => $uri->alter('l', $l + 1)->alter('r', $r + 1),
152152
),
153-
"Next Change \xC2\xBB");
153+
pht("Next Change \xC2\xBB"));
154154
} else {
155-
$link_r = 'Most Recent Change';
155+
$link_r = pht('Most Recent Change');
156156
}
157157

158158
$navigation_table =
@@ -184,7 +184,7 @@ public function processRequest() {
184184
$output,
185185
),
186186
array(
187-
'title' => 'Document History',
187+
'title' => pht('Document History'),
188188
));
189189
}
190190

@@ -208,7 +208,7 @@ private function renderRevertButton(
208208
'href' => '/phriction/edit/'.$document_id.'/',
209209
'class' => 'button',
210210
),
211-
'Edit Current Version');
211+
pht('Edit Current Version'));
212212
}
213213

214214

@@ -218,7 +218,7 @@ private function renderRevertButton(
218218
'href' => '/phriction/edit/'.$document_id.'/?revert='.$version,
219219
'class' => 'button',
220220
),
221-
'Revert to Version '.phutil_escape_html($version).'...');
221+
pht('Revert to Version %s...', phutil_escape_html($version)));
222222
}
223223

224224
private function renderComparisonTable(array $content) {
@@ -244,11 +244,11 @@ private function renderComparisonTable(array $content) {
244244
$table = new AphrontTableView($rows);
245245
$table->setHeaders(
246246
array(
247-
'Date',
248-
'Time',
249-
'Version',
250-
'Author',
251-
'Description',
247+
pht('Date'),
248+
pht('Time'),
249+
pht('Version'),
250+
pht('Author'),
251+
pht('Description'),
252252
));
253253
$table->setColumnClasses(
254254
array(

src/applications/phriction/controller/PhrictionDocumentController.php

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,15 @@ public function processRequest() {
6060
'href' => $create_uri,
6161
'class' => 'green button',
6262
),
63-
'Create Page');
63+
pht('Create Page'));
6464

6565
$page_content =
6666
'<div class="phriction-content">'.
67-
'<em>No content here!</em><br />'.
68-
'No document found at <tt>'.phutil_escape_html($slug).'</tt>. '.
69-
$create_sentence.
67+
'<em>'.pht('No content here!').'</em><br />'.
68+
pht('No document found at <tt>%s</tt>.', phutil_escape_html($slug)).
69+
' '.$create_sentence.
7070
'</div>';
71-
$page_title = 'Page Not Found';
71+
$page_title = pht('Page Not Found');
7272
$buttons = $button;
7373
} else {
7474
$version = $request->getInt('v');
@@ -82,13 +82,13 @@ public function processRequest() {
8282
}
8383

8484
if ($content->getID() != $document->getContentID()) {
85+
$vdate = phabricator_datetime($content->getDateCreated(), $user);
8586
$version_note = new AphrontErrorView();
8687
$version_note->setSeverity(AphrontErrorView::SEVERITY_NOTICE);
8788
$version_note->setTitle('Older Version');
8889
$version_note->appendChild(
89-
'You are viewing an older version of this document, as it '.
90-
'appeared on '.
91-
phabricator_datetime($content->getDateCreated(), $user).'.');
90+
pht('You are viewing an older version of this document, as it '.
91+
'appeared on %s.', $vdate));
9292
}
9393
} else {
9494
$content = id(new PhrictionContent())->load($document->getContentID());
@@ -154,8 +154,8 @@ public function processRequest() {
154154
$notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE);
155155
$notice->setTitle('Document Deleted');
156156
$notice->appendChild(
157-
'This document has been deleted. You can edit it to put new content '.
158-
'here, or use history to revert to an earlier version.');
157+
pht('This document has been deleted. You can edit it to put new '.
158+
'content here, or use history to revert to an earlier version.'));
159159
$core_content = $notice->render();
160160
} else {
161161
throw new Exception("Unknown document status '{$doc_status}'!");
@@ -338,20 +338,22 @@ private function renderChildren($slug) {
338338
}
339339
}
340340
if ($more_children) {
341-
$list[] = '<li>More...</li>';
341+
$list[] = '<li>'.pht('More...').'</li>';
342342
}
343343
$list[] = '</ul>';
344344
$list = implode("\n", $list);
345345

346346
return
347347
'<div class="phriction-children">'.
348-
'<div class="phriction-children-header">Document Hierarchy</div>'.
348+
'<div class="phriction-children-header">'.
349+
pht('Document Hierarchy').
350+
'</div>'.
349351
$list.
350352
'</div>';
351353
}
352354

353355
private function renderChildDocumentLink(array $info) {
354-
$title = nonempty($info['title'], '(Untitled Document)');
356+
$title = nonempty($info['title'], pht('(Untitled Document)'));
355357
$item = phutil_render_tag(
356358
'a',
357359
array(

src/applications/phriction/controller/PhrictionEditController.php

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ public function processRequest() {
9595
$notes = $request->getStr('description');
9696

9797
if (!strlen($title)) {
98-
$e_title = 'Required';
99-
$errors[] = 'Document title is required.';
98+
$e_title = pht('Required');
99+
$errors[] = pht('Document title is required.');
100100
} else {
101101
$e_title = null;
102102
}
@@ -107,9 +107,9 @@ public function processRequest() {
107107

108108
$dialog = new AphrontDialogView();
109109
$dialog->setUser($user);
110-
$dialog->setTitle('No Edits');
110+
$dialog->setTitle(pht('No Edits'));
111111
$dialog->appendChild(
112-
'<p>You did not make any changes to the document.</p>');
112+
'<p>'.pht('You did not make any changes to the document.').'</p>');
113113
$dialog->addCancelButton($request->getRequestURI());
114114

115115
return id(new AphrontDialogResponse())->setDialog($dialog);
@@ -121,9 +121,9 @@ public function processRequest() {
121121

122122
$dialog = new AphrontDialogView();
123123
$dialog->setUser($user);
124-
$dialog->setTitle('Empty Page');
124+
$dialog->setTitle(pht('Empty Page'));
125125
$dialog->appendChild(
126-
'<p>You can not create an empty document.</p>');
126+
'<p>'.pht('You can not create an empty document.').'</p>');
127127
$dialog->addCancelButton($request->getRequestURI());
128128

129129
return id(new AphrontDialogResponse())->setDialog($dialog);
@@ -150,16 +150,16 @@ public function processRequest() {
150150
$error_view = null;
151151
if ($errors) {
152152
$error_view = id(new AphrontErrorView())
153-
->setTitle('Form Errors')
153+
->setTitle(pht('Form Errors'))
154154
->setErrors($errors);
155155
}
156156

157157
if ($document->getID()) {
158-
$panel_header = 'Edit Phriction Document';
159-
$submit_button = 'Save Changes';
158+
$panel_header = pht('Edit Phriction Document');
159+
$submit_button = pht('Save Changes');
160160
} else {
161-
$panel_header = 'Create New Phriction Document';
162-
$submit_button = 'Create Document';
161+
$panel_header = pht('Create New Phriction Document');
162+
$submit_button = pht('Create Document');
163163
}
164164

165165
$uri = $document->getSlug();
@@ -178,13 +178,14 @@ public function processRequest() {
178178
array(
179179
'href' => $request->getRequestURI()->alter('nodraft', true),
180180
),
181-
'discard this draft');
181+
pht('discard this draft'));
182182

183183
$draft_note = new AphrontErrorView();
184184
$draft_note->setSeverity(AphrontErrorView::SEVERITY_NOTICE);
185185
$draft_note->setTitle('Recovered Draft');
186186
$draft_note->appendChild(
187-
'<p>Showing a saved draft of your edits, you can '.$discard.'.</p>');
187+
'<p>'.pht('Showing a saved draft of your edits, you can %s.',
188+
$discard).'</p>');
188189
} else {
189190
$content_text = $content->getContent();
190191
$draft_note = null;
@@ -198,25 +199,25 @@ public function processRequest() {
198199
->addHiddenInput('nodraft', $request->getBool('nodraft'))
199200
->appendChild(
200201
id(new AphrontFormTextControl())
201-
->setLabel('Title')
202+
->setLabel(pht('Title'))
202203
->setValue($content->getTitle())
203204
->setError($e_title)
204205
->setName('title'))
205206
->appendChild(
206207
id(new AphrontFormStaticControl())
207-
->setLabel('URI')
208+
->setLabel(pht('URI'))
208209
->setValue($uri))
209210
->appendChild(
210211
id(new PhabricatorRemarkupControl())
211-
->setLabel('Content')
212+
->setLabel(pht('Content'))
212213
->setValue($content_text)
213214
->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_TALL)
214215
->setName('content')
215216
->setID('document-textarea')
216217
->setUser($user))
217218
->appendChild(
218219
id(new AphrontFormTextControl())
219-
->setLabel('Edit Notes')
220+
->setLabel(pht('Edit Notes'))
220221
->setValue($notes)
221222
->setError(null)
222223
->setName('description'))
@@ -233,11 +234,11 @@ public function processRequest() {
233234
$preview_panel =
234235
'<div class="aphront-panel-preview aphront-panel-preview-wide">
235236
<div class="phriction-document-preview-header">
236-
Document Preview
237+
'.pht('Document Preview').'
237238
</div>
238239
<div id="document-preview">
239240
<div class="aphront-panel-preview-loading-text">
240-
Loading preview...
241+
'.pht('Loading preview...').'
241242
</div>
242243
</div>
243244
</div>';
@@ -258,7 +259,7 @@ public function processRequest() {
258259
$preview_panel,
259260
),
260261
array(
261-
'title' => 'Edit Document',
262+
'title' => pht('Edit Document'),
262263
));
263264
}
264265

src/applications/phriction/controller/PhrictionHistoryController.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function processRequest() {
4949

5050
$diff_uri = new PhutilURI('/phriction/diff/'.$document->getID().'/');
5151

52-
$vs_previous = '<em>Created</em>';
52+
$vs_previous = '<em>'.pht('Created').'</em>';
5353
if ($content->getVersion() != 1) {
5454
$uri = $diff_uri
5555
->alter('l', $content->getVersion() - 1)
@@ -59,10 +59,10 @@ public function processRequest() {
5959
array(
6060
'href' => $uri,
6161
),
62-
'Show Change');
62+
pht('Show Change'));
6363
}
6464

65-
$vs_head = '<em>Current</em>';
65+
$vs_head = '<em>'.pht('Current').'</em>';
6666
if ($content->getID() != $document->getContentID()) {
6767
$uri = $diff_uri
6868
->alter('l', $content->getVersion())
@@ -73,7 +73,7 @@ public function processRequest() {
7373
array(
7474
'href' => $uri,
7575
),
76-
'Show Later Changes');
76+
pht('Show Later Changes'));
7777
}
7878

7979
$change_type = PhrictionChangeType::getChangeTypeLabel(
@@ -87,7 +87,7 @@ public function processRequest() {
8787
array(
8888
'href' => $slug_uri.'?v='.$version,
8989
),
90-
'Version '.$version),
90+
pht('Version %s', $version)),
9191
$handles[$content->getAuthorPHID()]->renderLink(),
9292
$change_type,
9393
phutil_escape_html($content->getDescription()),
@@ -99,14 +99,14 @@ public function processRequest() {
9999
$table = new AphrontTableView($rows);
100100
$table->setHeaders(
101101
array(
102-
'Date',
103-
'Time',
104-
'Version',
105-
'Author',
106-
'Type',
107-
'Description',
108-
'Against Previous',
109-
'Against Current',
102+
pht('Date'),
103+
pht('Time'),
104+
pht('Version'),
105+
pht('Author'),
106+
pht('Type'),
107+
pht('Description'),
108+
pht('Against Previous'),
109+
pht('Against Current'),
110110
));
111111
$table->setColumnClasses(
112112
array(
@@ -132,7 +132,7 @@ public function processRequest() {
132132
PhrictionDocument::getSlugURI($document->getSlug(), 'history')));
133133

134134
$panel = new AphrontPanelView();
135-
$panel->setHeader('Document History');
135+
$panel->setHeader(pht('Document History'));
136136
$panel->setNoBackground();
137137
$panel->appendChild($table);
138138
$panel->appendChild($pager);
@@ -143,7 +143,7 @@ public function processRequest() {
143143
$panel,
144144
),
145145
array(
146-
'title' => 'Document History',
146+
'title' => pht('Document History'),
147147
'device' => true,
148148
));
149149

0 commit comments

Comments
 (0)