diff --git a/.arcconfig b/.arcconfig
index 44832aac46..25745458f8 100644
--- a/.arcconfig
+++ b/.arcconfig
@@ -1,5 +1,4 @@
{
- "project.name" : "phabricator",
"phabricator.uri" : "https://phabricator.khanacademy.org/",
"unit.engine" : "PhutilUnitTestEngine",
"load" : ["src/"]
diff --git a/resources/celerity/map.php b/resources/celerity/map.php
index e150725a0e..5ccc0b22c6 100644
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -7,15 +7,15 @@
*/
return array(
'names' => array(
- 'core.pkg.css' => 'e3ba62e8',
+ 'core.pkg.css' => '97a49e3e',
'core.pkg.js' => '328799d0',
'darkconsole.pkg.js' => 'e7393ebb',
- 'differential.pkg.css' => 'bb338e4b',
- 'differential.pkg.js' => '45b3b51d',
+ 'differential.pkg.css' => '30602b8c',
+ 'differential.pkg.js' => '8c98ce21',
'diffusion.pkg.css' => '591664fa',
'diffusion.pkg.js' => '0115b37c',
'maniphest.pkg.css' => '68d4dd3d',
- 'maniphest.pkg.js' => 'df4aa49f',
+ 'maniphest.pkg.js' => '2f4f52c2',
'rsrc/css/aphront/aphront-bars.css' => '231ac33c',
'rsrc/css/aphront/dark-console.css' => '6378ef3d',
'rsrc/css/aphront/dialog-view.css' => '9b32db0a',
@@ -26,7 +26,7 @@
'rsrc/css/aphront/pager-view.css' => '2e3539af',
'rsrc/css/aphront/panel-view.css' => '8427b78d',
'rsrc/css/aphront/phabricator-nav-view.css' => '7aeaf435',
- 'rsrc/css/aphront/table-view.css' => '59e2c0f8',
+ 'rsrc/css/aphront/table-view.css' => '0b4cd283',
'rsrc/css/aphront/tokenizer.css' => '86a13f7f',
'rsrc/css/aphront/tooltip.css' => '7672b60f',
'rsrc/css/aphront/two-column.css' => '16ab3ad2',
@@ -60,7 +60,7 @@
'rsrc/css/application/differential/add-comment.css' => 'c47f8c40',
'rsrc/css/application/differential/changeset-view.css' => 'e19cfd6e',
'rsrc/css/application/differential/core.css' => '7ac3cabc',
- 'rsrc/css/application/differential/phui-inline-comment.css' => '2174771a',
+ 'rsrc/css/application/differential/phui-inline-comment.css' => 'aa16f165',
'rsrc/css/application/differential/results-table.css' => '181aa9d9',
'rsrc/css/application/differential/revision-comment.css' => '14b8565a',
'rsrc/css/application/differential/revision-history.css' => '0e8eb855',
@@ -112,7 +112,7 @@
'rsrc/css/core/core.css' => 'aaea7a7a',
'rsrc/css/core/remarkup.css' => '07b7dc54',
'rsrc/css/core/syntax.css' => '6b7b24d9',
- 'rsrc/css/core/z-index.css' => '8414a09b',
+ 'rsrc/css/core/z-index.css' => 'c4732d32',
'rsrc/css/diviner/diviner-shared.css' => '38813222',
'rsrc/css/font/font-awesome.css' => 'e2e712fe',
'rsrc/css/font/font-source-sans-pro.css' => '8906c07b',
@@ -121,9 +121,9 @@
'rsrc/css/layout/phabricator-hovercard-view.css' => 'dd9121a9',
'rsrc/css/layout/phabricator-side-menu-view.css' => 'c1db9e9c',
'rsrc/css/layout/phabricator-source-code-view.css' => '2ceee894',
- 'rsrc/css/phui/calendar/phui-calendar-day.css' => 'c0cf782a',
+ 'rsrc/css/phui/calendar/phui-calendar-day.css' => 'd1cf6f93',
'rsrc/css/phui/calendar/phui-calendar-list.css' => 'c1c7f338',
- 'rsrc/css/phui/calendar/phui-calendar-month.css' => '94b1750a',
+ 'rsrc/css/phui/calendar/phui-calendar-month.css' => '476be7e0',
'rsrc/css/phui/calendar/phui-calendar.css' => 'ccabe893',
'rsrc/css/phui/phui-action-header-view.css' => '89c497e7',
'rsrc/css/phui/phui-action-list.css' => '4f4d09f2',
@@ -134,7 +134,7 @@
'rsrc/css/phui/phui-document.css' => '94d5dcd8',
'rsrc/css/phui/phui-feed-story.css' => 'c9f3a0b5',
'rsrc/css/phui/phui-fontkit.css' => 'dd8ddf27',
- 'rsrc/css/phui/phui-form-view.css' => '94ae3032',
+ 'rsrc/css/phui/phui-form-view.css' => '808329f2',
'rsrc/css/phui/phui-form.css' => 'f535f938',
'rsrc/css/phui/phui-header-view.css' => '75aaf372',
'rsrc/css/phui/phui-icon.css' => 'bc766998',
@@ -231,7 +231,7 @@
'rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadOnDemandSource.js' => '8b3fd187',
'rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadPreloadedSource.js' => '54f314a0',
'rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadSource.js' => '2818f5ce',
- 'rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadStaticSource.js' => '316b8fa1',
+ 'rsrc/externals/javelin/lib/control/typeahead/source/TypeaheadStaticSource.js' => '6c0e62fa',
'rsrc/externals/raphael/g.raphael.js' => '40dde778',
'rsrc/externals/raphael/g.raphael.line.js' => '40da039e',
'rsrc/externals/raphael/raphael.js' => '51ee6b43',
@@ -331,8 +331,9 @@
'rsrc/js/application/aphlict/behavior-aphlict-listen.js' => 'b1a59974',
'rsrc/js/application/aphlict/behavior-aphlict-status.js' => 'ea681761',
'rsrc/js/application/auth/behavior-persona-login.js' => '9414ff18',
- 'rsrc/js/application/calendar/event-all-day.js' => 'ca5fa62a',
- 'rsrc/js/application/config/behavior-reorder-fields.js' => '14a827de',
+ 'rsrc/js/application/calendar/behavior-day-view.js' => '5c46cff2',
+ 'rsrc/js/application/calendar/behavior-event-all-day.js' => '38dcf3c8',
+ 'rsrc/js/application/config/behavior-reorder-fields.js' => 'b6993408',
'rsrc/js/application/conpherence/ConpherenceThreadManager.js' => '10246726',
'rsrc/js/application/conpherence/behavior-drag-and-drop-photo.js' => 'cf86d16a',
'rsrc/js/application/conpherence/behavior-durable-column.js' => '16c695bf',
@@ -349,10 +350,10 @@
'rsrc/js/application/differential/DifferentialInlineCommentEditor.js' => 'd4c87bf4',
'rsrc/js/application/differential/behavior-add-reviewers-and-ccs.js' => 'e10f8e18',
'rsrc/js/application/differential/behavior-comment-jump.js' => '4fdb476d',
- 'rsrc/js/application/differential/behavior-comment-preview.js' => '8e1389b5',
+ 'rsrc/js/application/differential/behavior-comment-preview.js' => 'b064af76',
'rsrc/js/application/differential/behavior-diff-radios.js' => 'e1ff79b1',
'rsrc/js/application/differential/behavior-dropdown-menus.js' => '2035b9cb',
- 'rsrc/js/application/differential/behavior-edit-inline-comments.js' => 'e723c323',
+ 'rsrc/js/application/differential/behavior-edit-inline-comments.js' => '037b59eb',
'rsrc/js/application/differential/behavior-keyboard-nav.js' => '2c426492',
'rsrc/js/application/differential/behavior-populate.js' => '8694b1df',
'rsrc/js/application/differential/behavior-show-field-details.js' => 'bba9eedf',
@@ -369,7 +370,7 @@
'rsrc/js/application/doorkeeper/behavior-doorkeeper-tag.js' => 'e5822781',
'rsrc/js/application/files/behavior-icon-composer.js' => '8ef9ab58',
'rsrc/js/application/files/behavior-launch-icon-composer.js' => '48086888',
- 'rsrc/js/application/herald/HeraldRuleEditor.js' => '9229e764',
+ 'rsrc/js/application/herald/HeraldRuleEditor.js' => '271ffdd7',
'rsrc/js/application/herald/PathTypeahead.js' => 'f7fc67ec',
'rsrc/js/application/herald/herald-rule-editor.js' => '7ebaeed3',
'rsrc/js/application/maniphest/behavior-batch-editor.js' => 'f5d1233b',
@@ -379,7 +380,7 @@
'rsrc/js/application/maniphest/behavior-subpriorityeditor.js' => '84845b5b',
'rsrc/js/application/maniphest/behavior-transaction-controls.js' => '44168bad',
'rsrc/js/application/maniphest/behavior-transaction-expand.js' => '5fefb143',
- 'rsrc/js/application/maniphest/behavior-transaction-preview.js' => 'f8248bc5',
+ 'rsrc/js/application/maniphest/behavior-transaction-preview.js' => '4c95d29e',
'rsrc/js/application/owners/OwnersPathEditor.js' => 'aa1733d0',
'rsrc/js/application/owners/owners-path-editor.js' => '7a68dda3',
'rsrc/js/application/passphrase/passphrase-credential-control.js' => '3cb0b2fc',
@@ -442,7 +443,7 @@
'rsrc/js/core/behavior-device.js' => 'a205cf28',
'rsrc/js/core/behavior-drag-and-drop-textarea.js' => '6d49590e',
'rsrc/js/core/behavior-error-log.js' => '6882e80a',
- 'rsrc/js/core/behavior-fancy-datepicker.js' => '5c0f680f',
+ 'rsrc/js/core/behavior-fancy-datepicker.js' => '510b5809',
'rsrc/js/core/behavior-file-tree.js' => '88236f00',
'rsrc/js/core/behavior-form.js' => '5c54cbf3',
'rsrc/js/core/behavior-gesture.js' => '3ab51e2c',
@@ -466,6 +467,7 @@
'rsrc/js/core/behavior-scrollbar.js' => '834a1173',
'rsrc/js/core/behavior-search-typeahead.js' => '048330fa',
'rsrc/js/core/behavior-select-on-click.js' => '4e3e79a6',
+ 'rsrc/js/core/behavior-time-typeahead.js' => '8bfbb401',
'rsrc/js/core/behavior-toggle-class.js' => '5d7c9f33',
'rsrc/js/core/behavior-tokenizer.js' => 'b3a4b884',
'rsrc/js/core/behavior-tooltip.js' => '3ee3408b',
@@ -487,7 +489,7 @@
'aphront-multi-column-view-css' => 'fd18389d',
'aphront-pager-view-css' => '2e3539af',
'aphront-panel-view-css' => '8427b78d',
- 'aphront-table-view-css' => '59e2c0f8',
+ 'aphront-table-view-css' => '0b4cd283',
'aphront-tokenizer-control-css' => '86a13f7f',
'aphront-tooltip-css' => '7672b60f',
'aphront-two-column-view-css' => '16ab3ad2',
@@ -524,7 +526,7 @@
'global-drag-and-drop-css' => '697324ad',
'harbormaster-css' => '49d64eb4',
'herald-css' => '826075fa',
- 'herald-rule-editor' => '9229e764',
+ 'herald-rule-editor' => '271ffdd7',
'herald-test-css' => '778b008e',
'homepage-panel-css' => 'e34bf140',
'inline-comment-summary-css' => 'eb5f8e8c',
@@ -541,7 +543,7 @@
'javelin-behavior-audio-source' => '59b251eb',
'javelin-behavior-audit-preview' => 'd835b03a',
'javelin-behavior-choose-control' => '6153c708',
- 'javelin-behavior-config-reorder-fields' => '14a827de',
+ 'javelin-behavior-config-reorder-fields' => 'b6993408',
'javelin-behavior-conpherence-drag-and-drop-photo' => 'cf86d16a',
'javelin-behavior-conpherence-menu' => 'c0348cac',
'javelin-behavior-conpherence-pontificate' => '21ba5861',
@@ -552,13 +554,14 @@
'javelin-behavior-dashboard-move-panels' => '82439934',
'javelin-behavior-dashboard-query-panel-select' => '453c5375',
'javelin-behavior-dashboard-tab-panel' => 'd4eecc63',
+ 'javelin-behavior-day-view' => '5c46cff2',
'javelin-behavior-device' => 'a205cf28',
'javelin-behavior-differential-add-reviewers-and-ccs' => 'e10f8e18',
'javelin-behavior-differential-comment-jump' => '4fdb476d',
'javelin-behavior-differential-diff-radios' => 'e1ff79b1',
'javelin-behavior-differential-dropdown-menus' => '2035b9cb',
- 'javelin-behavior-differential-edit-inline-comments' => 'e723c323',
- 'javelin-behavior-differential-feedback-preview' => '8e1389b5',
+ 'javelin-behavior-differential-edit-inline-comments' => '037b59eb',
+ 'javelin-behavior-differential-feedback-preview' => 'b064af76',
'javelin-behavior-differential-keyboard-navigation' => '2c426492',
'javelin-behavior-differential-populate' => '8694b1df',
'javelin-behavior-differential-show-field-details' => 'bba9eedf',
@@ -572,8 +575,8 @@
'javelin-behavior-doorkeeper-tag' => 'e5822781',
'javelin-behavior-durable-column' => '16c695bf',
'javelin-behavior-error-log' => '6882e80a',
- 'javelin-behavior-event-all-day' => 'ca5fa62a',
- 'javelin-behavior-fancy-datepicker' => '5c0f680f',
+ 'javelin-behavior-event-all-day' => '38dcf3c8',
+ 'javelin-behavior-fancy-datepicker' => '510b5809',
'javelin-behavior-global-drag-and-drop' => 'c8e57404',
'javelin-behavior-herald-rule-editor' => '7ebaeed3',
'javelin-behavior-high-security-warning' => 'a464fe03',
@@ -589,7 +592,7 @@
'javelin-behavior-maniphest-subpriority-editor' => '84845b5b',
'javelin-behavior-maniphest-transaction-controls' => '44168bad',
'javelin-behavior-maniphest-transaction-expand' => '5fefb143',
- 'javelin-behavior-maniphest-transaction-preview' => 'f8248bc5',
+ 'javelin-behavior-maniphest-transaction-preview' => '4c95d29e',
'javelin-behavior-owners-path-editor' => '7a68dda3',
'javelin-behavior-passphrase-credential-control' => '3cb0b2fc',
'javelin-behavior-persona-login' => '9414ff18',
@@ -640,6 +643,7 @@
'javelin-behavior-slowvote-embed' => '887ad43f',
'javelin-behavior-stripe-payment-form' => '3f5d6dbf',
'javelin-behavior-test-payment-form' => 'fc91ab6c',
+ 'javelin-behavior-time-typeahead' => '8bfbb401',
'javelin-behavior-toggle-class' => '5d7c9f33',
'javelin-behavior-typeahead-browse' => '635de1ec',
'javelin-behavior-typeahead-search' => '93d0c9e3',
@@ -677,7 +681,7 @@
'javelin-typeahead-ondemand-source' => '8b3fd187',
'javelin-typeahead-preloaded-source' => '54f314a0',
'javelin-typeahead-source' => '2818f5ce',
- 'javelin-typeahead-static-source' => '316b8fa1',
+ 'javelin-typeahead-static-source' => '6c0e62fa',
'javelin-uri' => '6eff08aa',
'javelin-util' => '93cc50d6',
'javelin-vector' => '2caa8fb8',
@@ -748,7 +752,7 @@
'phabricator-uiexample-reactor-select' => 'a155550f',
'phabricator-uiexample-reactor-sendclass' => '1def2711',
'phabricator-uiexample-reactor-sendproperties' => 'b1f0ccee',
- 'phabricator-zindex-css' => '8414a09b',
+ 'phabricator-zindex-css' => 'c4732d32',
'phame-css' => '88bd4705',
'pholio-css' => '95174bdd',
'pholio-edit-css' => '3ad9d1ee',
@@ -763,22 +767,22 @@
'phui-box-css' => '7b3a2eed',
'phui-button-css' => 'de610129',
'phui-calendar-css' => 'ccabe893',
- 'phui-calendar-day-css' => 'c0cf782a',
+ 'phui-calendar-day-css' => 'd1cf6f93',
'phui-calendar-list-css' => 'c1c7f338',
- 'phui-calendar-month-css' => '94b1750a',
+ 'phui-calendar-month-css' => '476be7e0',
'phui-crumbs-view-css' => '594d719e',
'phui-document-view-css' => '94d5dcd8',
'phui-feed-story-css' => 'c9f3a0b5',
'phui-font-icon-base-css' => '3dad2ae3',
'phui-fontkit-css' => 'dd8ddf27',
'phui-form-css' => 'f535f938',
- 'phui-form-view-css' => '94ae3032',
+ 'phui-form-view-css' => '808329f2',
'phui-header-view-css' => '75aaf372',
'phui-icon-view-css' => 'bc766998',
'phui-image-mask-css' => '5a8b09c8',
'phui-info-panel-css' => '27ea50a1',
'phui-info-view-css' => 'c6f0aef8',
- 'phui-inline-comment-view-css' => '2174771a',
+ 'phui-inline-comment-view-css' => 'aa16f165',
'phui-list-view-css' => '2e25ebfb',
'phui-object-box-css' => '7d160002',
'phui-object-item-list-view-css' => 'f3a22696',
@@ -826,6 +830,14 @@
'029a133d' => array(
'aphront-dialog-view-css',
),
+ '037b59eb' => array(
+ 'javelin-behavior',
+ 'javelin-stratcom',
+ 'javelin-dom',
+ 'javelin-util',
+ 'javelin-vector',
+ 'differential-inline-comment-editor',
+ ),
'048330fa' => array(
'javelin-behavior',
'javelin-typeahead-ondemand-source',
@@ -903,13 +915,6 @@
'javelin-dom',
'javelin-history',
),
- '14a827de' => array(
- 'javelin-behavior',
- 'javelin-stratcom',
- 'javelin-dom',
- 'javelin-json',
- 'phabricator-draggable-list',
- ),
'14ac66f5' => array(
'javelin-install',
'javelin-dom',
@@ -996,6 +1001,15 @@
'phabricator-drag-and-drop-file-upload',
'phabricator-draggable-list',
),
+ '271ffdd7' => array(
+ 'multirow-row-manager',
+ 'javelin-install',
+ 'javelin-util',
+ 'javelin-dom',
+ 'javelin-stratcom',
+ 'javelin-json',
+ 'phabricator-prefab',
+ ),
'2818f5ce' => array(
'javelin-install',
'javelin-util',
@@ -1036,10 +1050,6 @@
'javelin-install',
'javelin-event',
),
- '316b8fa1' => array(
- 'javelin-install',
- 'javelin-typeahead-source',
- ),
'331b1611' => array(
'javelin-install',
),
@@ -1132,6 +1142,14 @@
'javelin-request',
'javelin-util',
),
+ '4c95d29e' => array(
+ 'javelin-behavior',
+ 'javelin-dom',
+ 'javelin-util',
+ 'javelin-json',
+ 'javelin-stratcom',
+ 'phabricator-shaped-request',
+ ),
'4cebc641' => array(
'javelin-install',
),
@@ -1157,6 +1175,13 @@
'javelin-typeahead-source',
'javelin-util',
),
+ '510b5809' => array(
+ 'javelin-behavior',
+ 'javelin-util',
+ 'javelin-dom',
+ 'javelin-stratcom',
+ 'javelin-vector',
+ ),
'519705ea' => array(
'javelin-install',
'javelin-dom',
@@ -1224,13 +1249,6 @@
'javelin-uri',
'javelin-routable',
),
- '5c0f680f' => array(
- 'javelin-behavior',
- 'javelin-util',
- 'javelin-dom',
- 'javelin-stratcom',
- 'javelin-vector',
- ),
'5c54cbf3' => array(
'javelin-behavior',
'javelin-stratcom',
@@ -1307,6 +1325,10 @@
'69adf288' => array(
'javelin-install',
),
+ '6c0e62fa' => array(
+ 'javelin-install',
+ 'javelin-typeahead-source',
+ ),
'6c2b09a2' => array(
'javelin-install',
'javelin-util',
@@ -1477,6 +1499,14 @@
'javelin-request',
'javelin-typeahead-source',
),
+ '8bfbb401' => array(
+ 'javelin-behavior',
+ 'javelin-util',
+ 'javelin-dom',
+ 'javelin-stratcom',
+ 'javelin-vector',
+ 'javelin-typeahead-static-source',
+ ),
'8ce821c5' => array(
'phabricator-notification',
'javelin-stratcom',
@@ -1487,14 +1517,6 @@
'javelin-dom',
'javelin-util',
),
- '8e1389b5' => array(
- 'javelin-behavior',
- 'javelin-stratcom',
- 'javelin-dom',
- 'javelin-request',
- 'javelin-util',
- 'phabricator-shaped-request',
- ),
'8ef9ab58' => array(
'javelin-behavior',
'javelin-dom',
@@ -1505,15 +1527,6 @@
'javelin-dom',
'javelin-stratcom',
),
- '9229e764' => array(
- 'multirow-row-manager',
- 'javelin-install',
- 'javelin-util',
- 'javelin-dom',
- 'javelin-stratcom',
- 'javelin-json',
- 'phabricator-prefab',
- ),
93568464 => array(
'javelin-behavior',
'javelin-dom',
@@ -1653,6 +1666,14 @@
'javelin-stratcom',
'javelin-install',
),
+ 'b064af76' => array(
+ 'javelin-behavior',
+ 'javelin-stratcom',
+ 'javelin-dom',
+ 'javelin-request',
+ 'javelin-util',
+ 'phabricator-shaped-request',
+ ),
'b1a59974' => array(
'javelin-behavior',
'javelin-aphlict',
@@ -1708,6 +1729,13 @@
'javelin-dom',
'javelin-util',
),
+ 'b6993408' => array(
+ 'javelin-behavior',
+ 'javelin-stratcom',
+ 'javelin-dom',
+ 'javelin-json',
+ 'phabricator-draggable-list',
+ ),
'ba4fa35c' => array(
'javelin-behavior',
'javelin-dom',
@@ -1905,14 +1933,6 @@
'e6e25838' => array(
'javelin-install',
),
- 'e723c323' => array(
- 'javelin-behavior',
- 'javelin-stratcom',
- 'javelin-dom',
- 'javelin-util',
- 'javelin-vector',
- 'differential-inline-comment-editor',
- ),
'e9581f08' => array(
'javelin-behavior',
'javelin-stratcom',
@@ -1973,14 +1993,6 @@
'javelin-typeahead-ondemand-source',
'javelin-util',
),
- 'f8248bc5' => array(
- 'javelin-behavior',
- 'javelin-dom',
- 'javelin-util',
- 'javelin-json',
- 'javelin-stratcom',
- 'phabricator-shaped-request',
- ),
'f829edb3' => array(
'javelin-view',
'javelin-install',
diff --git a/resources/sql/autopatches/20140106.macromailkey.2.php b/resources/sql/autopatches/20140106.macromailkey.2.php
index fdca4e4d59..a91e5a2c20 100644
--- a/resources/sql/autopatches/20140106.macromailkey.2.php
+++ b/resources/sql/autopatches/20140106.macromailkey.2.php
@@ -1,6 +1,6 @@
establishConnection('w');
@@ -8,7 +8,7 @@
foreach ($iterator as $macro) {
$id = $macro->getID();
- echo "Populating macro {$id}...\n";
+ echo pht('Populating macro %d...', $id)."\n";
if (!$macro->getMailKey()) {
queryfx(
@@ -20,4 +20,4 @@
}
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/autopatches/20140108.ddbpname.2.php b/resources/sql/autopatches/20140108.ddbpname.2.php
index ca7e3ef8b2..3316f3df1d 100644
--- a/resources/sql/autopatches/20140108.ddbpname.2.php
+++ b/resources/sql/autopatches/20140108.ddbpname.2.php
@@ -1,6 +1,6 @@
establishConnection('w');
@@ -8,7 +8,7 @@
foreach ($iterator as $blueprint) {
$id = $blueprint->getID();
- echo "Populating blueprint {$id}...\n";
+ echo pht('Populating blueprint %d...', $id)."\n";
if (!strlen($blueprint->getBlueprintName())) {
queryfx(
@@ -20,4 +20,4 @@
}
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/autopatches/20140113.legalpadsig.2.php b/resources/sql/autopatches/20140113.legalpadsig.2.php
index 8b244e2480..6c7b0131b2 100644
--- a/resources/sql/autopatches/20140113.legalpadsig.2.php
+++ b/resources/sql/autopatches/20140113.legalpadsig.2.php
@@ -1,6 +1,6 @@
establishConnection('w');
@@ -8,7 +8,7 @@
foreach ($iterator as $sig) {
$id = $sig->getID();
- echo "Populating signature {$id}...\n";
+ echo pht('Populating signature %d...', $id)."\n";
if (!$sig->getSecretKey()) {
queryfx(
@@ -20,4 +20,4 @@
}
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/autopatches/20140115.auth.3.unlimit.php b/resources/sql/autopatches/20140115.auth.3.unlimit.php
index 80c316f64a..9e5bc7fed3 100644
--- a/resources/sql/autopatches/20140115.auth.3.unlimit.php
+++ b/resources/sql/autopatches/20140115.auth.3.unlimit.php
@@ -9,7 +9,7 @@
foreach (new LiskMigrationIterator($session_table) as $session) {
$id = $session->getID();
- echo "Migrating session {$id}...\n";
+ echo pht('Migrating session %d...', $id)."\n";
$old_type = $session->getType();
$new_type = preg_replace('/-.*$/', '', $old_type);
@@ -23,4 +23,4 @@
}
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/autopatches/20140205.cal.3.phid-mig.php b/resources/sql/autopatches/20140205.cal.3.phid-mig.php
index 6ba4ff7c5c..7aff389d17 100644
--- a/resources/sql/autopatches/20140205.cal.3.phid-mig.php
+++ b/resources/sql/autopatches/20140205.cal.3.phid-mig.php
@@ -3,11 +3,11 @@
$table = new PhabricatorCalendarEvent();
$conn_w = $table->establishConnection('w');
-echo "Assigning PHIDs to events...\n";
+echo pht('Assigning PHIDs to events...')."\n";
foreach (new LiskMigrationIterator($table) as $event) {
$id = $event->getID();
- echo "Updating event {$id}...\n";
+ echo pht('Updating event %d...', $id)."\n";
if ($event->getPHID()) {
continue;
}
@@ -19,4 +19,4 @@
$table->generatePHID(),
$id);
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/autopatches/20140210.herald.rule-condition-mig.php b/resources/sql/autopatches/20140210.herald.rule-condition-mig.php
index c653fa9d50..90f8aa0b3e 100644
--- a/resources/sql/autopatches/20140210.herald.rule-condition-mig.php
+++ b/resources/sql/autopatches/20140210.herald.rule-condition-mig.php
@@ -3,7 +3,8 @@
$table = new HeraldCondition();
$conn_w = $table->establishConnection('w');
-echo "Migrating Herald conditions of type Herald rule from IDs to PHIDs...\n";
+echo pht(
+ "Migrating Herald conditions of type Herald rule from IDs to PHIDs...\n");
foreach (new LiskMigrationIterator($table) as $condition) {
if ($condition->getFieldName() != HeraldAdapter::FIELD_RULE) {
continue;
@@ -14,7 +15,7 @@
continue;
}
$id = $condition->getID();
- echo "Updating condition {$id}...\n";
+ echo pht('Updating condition %s...', $id)."\n";
$rule = id(new HeraldRuleQuery())
->setViewer(PhabricatorUser::getOmnipotentUser())
@@ -28,4 +29,4 @@
json_encode($rule->getPHID()),
$id);
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/autopatches/20140210.projcfield.1.blurb.php b/resources/sql/autopatches/20140210.projcfield.1.blurb.php
index 3cb39c5dc1..90c4242e8d 100644
--- a/resources/sql/autopatches/20140210.projcfield.1.blurb.php
+++ b/resources/sql/autopatches/20140210.projcfield.1.blurb.php
@@ -5,10 +5,9 @@
$rows = new LiskRawMigrationIterator($conn_w, 'project_profile');
-echo "Migrating project descriptions to custom storage...\n";
+echo pht('Migrating project descriptions to custom storage...')."\n";
foreach ($rows as $row) {
$phid = $row['projectPHID'];
- echo "Migrating {$phid}...\n";
$desc = $row['blurb'];
if (strlen($desc)) {
@@ -23,4 +22,4 @@
}
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/autopatches/20140211.dx.2.migcommenttext.php b/resources/sql/autopatches/20140211.dx.2.migcommenttext.php
index 8a76690ec5..705e858069 100644
--- a/resources/sql/autopatches/20140211.dx.2.migcommenttext.php
+++ b/resources/sql/autopatches/20140211.dx.2.migcommenttext.php
@@ -7,18 +7,18 @@
PhabricatorContentSource::SOURCE_LEGACY,
array())->serialize();
-echo "Migrating Differential comment text to modern storage...\n";
+echo pht('Migrating Differential comment text to modern storage...')."\n";
foreach ($rows as $row) {
$id = $row['id'];
- echo "Migrating Differential comment {$id}...\n";
+ echo pht('Migrating Differential comment %d...', $id)."\n";
if (!strlen($row['content'])) {
- echo "Comment has no text, continuing.\n";
+ echo pht('Comment has no text, continuing.')."\n";
continue;
}
$revision = id(new DifferentialRevision())->load($row['revisionID']);
if (!$revision) {
- echo "Comment has no valid revision, continuing.\n";
+ echo pht('Comment has no valid revision, continuing.')."\n";
continue;
}
@@ -68,4 +68,4 @@
$row['id']);
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/autopatches/20140212.dx.1.armageddon.php b/resources/sql/autopatches/20140212.dx.1.armageddon.php
index 525bf78318..d2749bd5cf 100644
--- a/resources/sql/autopatches/20140212.dx.1.armageddon.php
+++ b/resources/sql/autopatches/20140212.dx.1.armageddon.php
@@ -7,14 +7,14 @@
PhabricatorContentSource::SOURCE_LEGACY,
array())->serialize();
-echo "Migrating Differential comments to modern storage...\n";
+echo pht('Migrating Differential comments to modern storage...')."\n";
foreach ($rows as $row) {
$id = $row['id'];
- echo "Migrating comment {$id}...\n";
+ echo pht('Migrating comment %d...', $id)."\n";
$revision = id(new DifferentialRevision())->load($row['revisionID']);
if (!$revision) {
- echo "No revision, continuing.\n";
+ echo pht('No revision, continuing.')."\n";
continue;
}
@@ -219,4 +219,4 @@
}
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/autopatches/20140218.passwords.4.vcs.php b/resources/sql/autopatches/20140218.passwords.4.vcs.php
index 5e58c63e86..1030775326 100644
--- a/resources/sql/autopatches/20140218.passwords.4.vcs.php
+++ b/resources/sql/autopatches/20140218.passwords.4.vcs.php
@@ -3,13 +3,13 @@
$table = new PhabricatorRepositoryVCSPassword();
$conn_w = $table->establishConnection('w');
-echo "Upgrading password hashing for VCS passwords.\n";
+echo pht('Upgrading password hashing for VCS passwords.')."\n";
$best_hasher = PhabricatorPasswordHasher::getBestHasher();
foreach (new LiskMigrationIterator($table) as $password) {
$id = $password->getID();
- echo "Migrating VCS password {$id}...\n";
+ echo pht('Migrating VCS password %d...', $id)."\n";
$input_hash = $password->getPasswordHash();
$input_envelope = new PhutilOpaqueEnvelope($input_hash);
@@ -24,4 +24,4 @@
$id);
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/autopatches/20140226.dxcustom.1.fielddata.php b/resources/sql/autopatches/20140226.dxcustom.1.fielddata.php
index aa1adf41be..9b1382f5b9 100644
--- a/resources/sql/autopatches/20140226.dxcustom.1.fielddata.php
+++ b/resources/sql/autopatches/20140226.dxcustom.1.fielddata.php
@@ -3,12 +3,12 @@
$conn_w = id(new DifferentialRevision())->establishConnection('w');
$rows = new LiskRawMigrationIterator($conn_w, 'differential_auxiliaryfield');
-echo "Modernizing Differential auxiliary field storage...\n";
+echo pht('Modernizing Differential auxiliary field storage...')."\n";
$table_name = id(new DifferentialCustomFieldStorage())->getTableName();
foreach ($rows as $row) {
$id = $row['id'];
- echo "Migrating row {$id}...\n";
+ echo pht('Migrating row %d...', $id)."\n";
queryfx(
$conn_w,
'INSERT IGNORE INTO %T (objectPHID, fieldIndex, fieldValue)
@@ -19,4 +19,4 @@
$row['value']);
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/autopatches/20140321.mstatus.2.mig.php b/resources/sql/autopatches/20140321.mstatus.2.mig.php
index 66c13844c3..7f91e00e1b 100644
--- a/resources/sql/autopatches/20140321.mstatus.2.mig.php
+++ b/resources/sql/autopatches/20140321.mstatus.2.mig.php
@@ -11,10 +11,10 @@
$conn_w = id(new ManiphestTask())->establishConnection('w');
-echo "Migrating tasks to new status constants...\n";
+echo pht('Migrating tasks to new status constants...')."\n";
foreach (new LiskMigrationIterator(new ManiphestTask()) as $task) {
$id = $task->getID();
- echo "Migrating T{$id}...\n";
+ echo pht('Migrating %s...', "T{$id}")."\n";
$status = $task->getStatus();
if (isset($status_map[$status])) {
@@ -27,13 +27,13 @@
}
}
-echo "Done.\n";
+echo pht('Done.')."\n";
-echo "Migrating task transactions to new status constants...\n";
+echo pht('Migrating task transactions to new status constants...')."\n";
foreach (new LiskMigrationIterator(new ManiphestTransaction()) as $xaction) {
$id = $xaction->getID();
- echo "Migrating {$id}...\n";
+ echo pht('Migrating %d...', $id)."\n";
if ($xaction->getTransactionType() == ManiphestTransaction::TYPE_STATUS) {
$old = $xaction->getOldValue();
@@ -55,14 +55,14 @@
$id);
}
}
-echo "Done.\n";
+echo pht('Done.')."\n";
$conn_w = id(new PhabricatorSavedQuery())->establishConnection('w');
-echo "Migrating searches to new status constants...\n";
+echo pht('Migrating searches to new status constants...')."\n";
foreach (new LiskMigrationIterator(new PhabricatorSavedQuery()) as $query) {
$id = $query->getID();
- echo "Migrating {$id}...\n";
+ echo pht('Migrating %d...', $id)."\n";
if ($query->getEngineClassName() !== 'ManiphestTaskSearchEngine') {
continue;
@@ -91,4 +91,4 @@
}
}
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/autopatches/20140323.harbor.1.renames.php b/resources/sql/autopatches/20140323.harbor.1.renames.php
index 892402bf80..8aab25d876 100644
--- a/resources/sql/autopatches/20140323.harbor.1.renames.php
+++ b/resources/sql/autopatches/20140323.harbor.1.renames.php
@@ -14,14 +14,14 @@
id(new HarbormasterBuildTarget())->getTableName(),
);
-echo "Renaming Harbormaster classes...\n";
+echo pht('Renaming Harbormaster classes...')."\n";
$conn_w = id(new HarbormasterBuildStep())->establishConnection('w');
foreach ($names as $name) {
$old = $name;
$new = 'Harbormaster'.$name;
- echo "Renaming {$old} -> {$new}...\n";
+ echo pht('Renaming %s -> %s...', $old, $new)."\n";
foreach ($tables as $table) {
queryfx(
$conn_w,
@@ -32,4 +32,4 @@
}
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/autopatches/20140325.push.3.groups.php b/resources/sql/autopatches/20140325.push.3.groups.php
index b6a33ad4d8..8706da306a 100644
--- a/resources/sql/autopatches/20140325.push.3.groups.php
+++ b/resources/sql/autopatches/20140325.push.3.groups.php
@@ -2,7 +2,7 @@
$conn_w = id(new PhabricatorRepository())->establishConnection('w');
-echo "Adding transaction log event groups...\n";
+echo pht('Adding transaction log event groups...')."\n";
$logs = queryfx_all(
$conn_w,
@@ -10,7 +10,7 @@
'repository_pushlog');
foreach ($logs as $log) {
$id = $log['id'];
- echo "Migrating log {$id}...\n";
+ echo pht('Migrating log %d...', $id)."\n";
if ($log['pushEventPHID']) {
continue;
}
@@ -40,4 +40,4 @@
$log['transactionKey']);
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/autopatches/20140410.accountsecret.2.php b/resources/sql/autopatches/20140410.accountsecret.2.php
index bd8fd3968a..7d0cf7ad88 100644
--- a/resources/sql/autopatches/20140410.accountsecret.2.php
+++ b/resources/sql/autopatches/20140410.accountsecret.2.php
@@ -1,12 +1,10 @@
getID();
- echo "Updating {$id}...\n";
+ echo pht('Updating %d...', $id)."\n";
if (strlen($user->getAccountSecret())) {
continue;
@@ -20,4 +18,4 @@
$id);
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/autopatches/20140420.rel.2.objectmig.php b/resources/sql/autopatches/20140420.rel.2.objectmig.php
index 6441f7c009..f54416a5b0 100644
--- a/resources/sql/autopatches/20140420.rel.2.objectmig.php
+++ b/resources/sql/autopatches/20140420.rel.2.objectmig.php
@@ -4,11 +4,11 @@
$table_name = $pull_table->getTableName();
$conn_w = $pull_table->establishConnection('w');
-echo "Setting object PHIDs for requests...\n";
+echo pht('Setting object PHIDs for requests...')."\n";
foreach (new LiskMigrationIterator($pull_table) as $pull) {
$id = $pull->getID();
- echo "Migrating pull request {$id}...\n";
+ echo pht('Migrating pull request %d...', $id)."\n";
if ($pull->getRequestedObjectPHID()) {
// We already have a valid PHID, so skip this request.
continue;
@@ -42,4 +42,4 @@
$id);
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/autopatches/20140521.projectslug.2.mig.php b/resources/sql/autopatches/20140521.projectslug.2.mig.php
index ad086e10bc..ca6ccf886a 100644
--- a/resources/sql/autopatches/20140521.projectslug.2.mig.php
+++ b/resources/sql/autopatches/20140521.projectslug.2.mig.php
@@ -6,16 +6,16 @@
$slug_table_name = id(new PhabricatorProjectSlug())->getTableName();
$time = time();
-echo "Migrating project phriction slugs...\n";
+echo pht('Migrating project phriction slugs...')."\n";
foreach (new LiskMigrationIterator($project_table) as $project) {
$id = $project->getID();
- echo "Migrating project {$id}...\n";
+ echo pht('Migrating project %d...', $id)."\n";
$phriction_slug = rtrim($project->getPhrictionSlug(), '/');
$slug = id(new PhabricatorProjectSlug())
->loadOneWhere('slug = %s', $phriction_slug);
if ($slug) {
- echo "Already migrated {$id}... Continuing.\n";
+ echo pht('Already migrated %d... Continuing.', $id)."\n";
continue;
}
queryfx(
@@ -27,7 +27,7 @@
$phriction_slug,
$time,
$time);
- echo "Migrated {$id}.\n";
+ echo pht('Migrated %d.', $id)."\n";
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/autopatches/20140711.pnames.2.php b/resources/sql/autopatches/20140711.pnames.2.php
index ee3658384f..16030b5853 100644
--- a/resources/sql/autopatches/20140711.pnames.2.php
+++ b/resources/sql/autopatches/20140711.pnames.2.php
@@ -1,11 +1,11 @@
getName();
- echo "Updating project '{$name}'...\n";
+ echo pht("Updating project '%d'...", $name)."\n";
$project->updateDatasourceTokens();
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/autopatches/20140722.appname.php b/resources/sql/autopatches/20140722.appname.php
index fca11bb4b5..8c3e5918b2 100644
--- a/resources/sql/autopatches/20140722.appname.php
+++ b/resources/sql/autopatches/20140722.appname.php
@@ -74,7 +74,7 @@
/* -( User preferences )--------------------------------------------------- */
-echo "Migrating user preferences...\n";
+echo pht('Migrating user preferences...')."\n";
$table = new PhabricatorUserPreferences();
$conn_w = $table->establishConnection('w');
$pref_pinned = PhabricatorUserPreferences::PREFERENCE_APP_PINNED;
@@ -107,7 +107,7 @@
/* -( Dashboard installs )------------------------------------------------- */
-echo "Migrating dashboard installs...\n";
+echo pht('Migrating dashboard installs...')."\n";
$table = new PhabricatorDashboardInstall();
$conn_w = $table->establishConnection('w');
@@ -126,7 +126,7 @@
/* -( Phabricator configuration )------------------------------------------ */
$config_key = 'phabricator.uninstalled-applications';
-echo "Migrating `{$config_key}` config...\n";
+echo pht('Migrating `%s` config...', $config_key)."\n";
$config = PhabricatorConfigEntry::loadConfigEntry($config_key);
$old_config = $config->getValue();
@@ -147,7 +147,7 @@
/* -( phabricator.application-settings )----------------------------------- */
$config_key = 'phabricator.application-settings';
-echo "Migrating `{$config_key}` config...\n";
+echo pht('Migrating `%s` config...', $config_key)."\n";
$config = PhabricatorConfigEntry::loadConfigEntry($config_key);
$old_config = $config->getValue();
diff --git a/resources/sql/autopatches/20140722.audit.3.miginlines.php b/resources/sql/autopatches/20140722.audit.3.miginlines.php
index 30d9b1c797..c6778fa659 100644
--- a/resources/sql/autopatches/20140722.audit.3.miginlines.php
+++ b/resources/sql/autopatches/20140722.audit.3.miginlines.php
@@ -7,7 +7,7 @@
$src_table = 'audit_inlinecomment';
$dst_table = 'audit_transaction_comment';
-echo "Migrating Audit inline comments to new format...\n";
+echo pht('Migrating Audit inline comments to new format...')."\n";
$content_source = PhabricatorContentSource::newForSource(
PhabricatorContentSource::SOURCE_LEGACY,
@@ -17,7 +17,7 @@
foreach ($rows as $row) {
$id = $row['id'];
- echo "Migrating inline #{$id}...\n";
+ echo pht('Migrating inline #%d...', $id);
if ($row['auditCommentID']) {
$xaction_phid = PhabricatorPHID::generateNewPHID(
@@ -74,4 +74,4 @@
}
$conn_w->saveTransaction();
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/autopatches/20140722.audit.4.migtext.php b/resources/sql/autopatches/20140722.audit.4.migtext.php
index 1bcd3d36b8..2da4e2683e 100644
--- a/resources/sql/autopatches/20140722.audit.4.migtext.php
+++ b/resources/sql/autopatches/20140722.audit.4.migtext.php
@@ -7,12 +7,12 @@
PhabricatorContentSource::SOURCE_LEGACY,
array())->serialize();
-echo "Migrating Audit comment text to modern storage...\n";
+echo pht('Migrating Audit comment text to modern storage...')."\n";
foreach ($rows as $row) {
$id = $row['id'];
- echo "Migrating Audit comment {$id}...\n";
+ echo pht('Migrating Audit comment %d...', $id)."\n";
if (!strlen($row['content'])) {
- echo "Comment has no text, continuing.\n";
+ echo pht('Comment has no text, continuing.')."\n";
continue;
}
@@ -58,4 +58,4 @@
$row['id']);
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/autopatches/20140722.renameauth.php b/resources/sql/autopatches/20140722.renameauth.php
index 8a021c834d..225031d2f1 100644
--- a/resources/sql/autopatches/20140722.renameauth.php
+++ b/resources/sql/autopatches/20140722.renameauth.php
@@ -18,7 +18,7 @@
'PhabricatorAuthProviderOAuthWordPress' => 'PhabricatorWordPressAuthProvider',
);
-echo "Migrating auth providers...\n";
+echo pht('Migrating auth providers...')."\n";
$table = new PhabricatorAuthProviderConfig();
$conn_w = $table->establishConnection('w');
diff --git a/resources/sql/autopatches/20140725.audit.1.migxactions.php b/resources/sql/autopatches/20140725.audit.1.migxactions.php
index 064ac92202..e0e14e439b 100644
--- a/resources/sql/autopatches/20140725.audit.1.migxactions.php
+++ b/resources/sql/autopatches/20140725.audit.1.migxactions.php
@@ -7,10 +7,10 @@
PhabricatorContentSource::SOURCE_LEGACY,
array())->serialize();
-echo "Migrating Audit comments to modern storage...\n";
+echo pht('Migrating Audit comments to modern storage...')."\n";
foreach ($rows as $row) {
$id = $row['id'];
- echo "Migrating comment {$id}...\n";
+ echo pht('Migrating comment %d...', $id)."\n";
$comments = queryfx_all(
$conn_w,
@@ -147,4 +147,4 @@
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/autopatches/20140731.audit.1.subscribers.php b/resources/sql/autopatches/20140731.audit.1.subscribers.php
index c648ce3c00..b452275295 100644
--- a/resources/sql/autopatches/20140731.audit.1.subscribers.php
+++ b/resources/sql/autopatches/20140731.audit.1.subscribers.php
@@ -3,11 +3,11 @@
$table = new PhabricatorRepositoryAuditRequest();
$conn_w = $table->establishConnection('w');
-echo "Migrating Audit subscribers to subscriptions...\n";
+echo pht('Migrating Audit subscribers to subscriptions...')."\n";
foreach (new LiskMigrationIterator($table) as $request) {
$id = $request->getID();
- echo "Migrating auditor {$id}...\n";
+ echo pht("Migrating audit %d...\n", $id);
if ($request->getAuditStatus() != 'cc') {
// This isn't a "subscriber", so skip it.
@@ -27,4 +27,4 @@
$request->delete();
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/autopatches/20140731.cancdn.php b/resources/sql/autopatches/20140731.cancdn.php
index 7994d88abf..f4090b092c 100644
--- a/resources/sql/autopatches/20140731.cancdn.php
+++ b/resources/sql/autopatches/20140731.cancdn.php
@@ -4,7 +4,7 @@
$conn_w = $table->establishConnection('w');
foreach (new LiskMigrationIterator($table) as $file) {
$id = $file->getID();
- echo "Updating flags for file {$id}...\n";
+ echo pht('Updating flags for file %d...', $id)."\n";
$meta = $file->getMetadata();
if (!idx($meta, 'canCDN')) {
diff --git a/resources/sql/autopatches/20140805.boardcol.2.php b/resources/sql/autopatches/20140805.boardcol.2.php
index b8a78278d8..317de4e370 100644
--- a/resources/sql/autopatches/20140805.boardcol.2.php
+++ b/resources/sql/autopatches/20140805.boardcol.2.php
@@ -19,12 +19,12 @@
$sql = array();
foreach ($cols as $col_phid => $obj_phids) {
- echo "Migrating column '{$col_phid}'...\n";
+ echo pht("Migrating column '%s'...", $col_phid)."\n";
$column = id(new PhabricatorProjectColumn())->loadOneWhere(
'phid = %s',
$col_phid);
if (!$column) {
- echo "Column '{$col_phid}' does not exist.\n";
+ echo pht("Column '%s' does not exist.", $col_phid)."\n";
continue;
}
@@ -40,7 +40,7 @@
}
}
-echo "Inserting rows...\n";
+echo pht('Inserting rows...')."\n";
foreach (PhabricatorLiskDAO::chunkSQL($sql) as $chunk) {
queryfx(
$conn_w,
@@ -50,4 +50,4 @@
$chunk);
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/autopatches/20140808.boardprop.3.php b/resources/sql/autopatches/20140808.boardprop.3.php
index 116cc773a3..947ce85f60 100644
--- a/resources/sql/autopatches/20140808.boardprop.3.php
+++ b/resources/sql/autopatches/20140808.boardprop.3.php
@@ -6,7 +6,7 @@
foreach (new LiskMigrationIterator($table) as $column) {
$id = $column->getID();
- echo "Adjusting column {$id}...\n";
+ echo pht('Adjusting column %d...', $id)."\n";
if ($column->getSequence() == 0) {
$properties = $column->getProperties();
@@ -21,4 +21,4 @@
}
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/autopatches/20140815.cancdncase.php b/resources/sql/autopatches/20140815.cancdncase.php
index 400fdbb01a..0e9cafaabd 100644
--- a/resources/sql/autopatches/20140815.cancdncase.php
+++ b/resources/sql/autopatches/20140815.cancdncase.php
@@ -7,7 +7,10 @@
$conn_w = $table->establishConnection('w');
foreach (new LiskMigrationIterator($table) as $file) {
$id = $file->getID();
- echo "Updating capitalization of canCDN property for file {$id}...\n";
+ echo pht(
+ "Updating capitalization of %s property for file %d...\n",
+ 'canCDN',
+ $id);
$meta = $file->getMetadata();
if (isset($meta['cancdn'])) {
diff --git a/resources/sql/autopatches/20140904.macroattach.php b/resources/sql/autopatches/20140904.macroattach.php
index 5e82f3aa5f..4761964758 100644
--- a/resources/sql/autopatches/20140904.macroattach.php
+++ b/resources/sql/autopatches/20140904.macroattach.php
@@ -4,7 +4,7 @@
foreach (new LiskMigrationIterator($table) as $macro) {
$name = $macro->getName();
- echo "Linking macro '{$name}'...\n";
+ echo pht("Linking macro '%s'...", $name)."\n";
$editor = new PhabricatorEdgeEditor();
@@ -16,11 +16,11 @@
foreach ($phids as $phid) {
$editor->addEdge(
$macro->getPHID(),
- PhabricatorObjectHasFileEdgeType::EDGECONST ,
+ PhabricatorObjectHasFileEdgeType::EDGECONST,
$phid);
}
$editor->save();
}
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/autopatches/20140914.betaproto.php b/resources/sql/autopatches/20140914.betaproto.php
index 4471d47fee..849c5acb3b 100644
--- a/resources/sql/autopatches/20140914.betaproto.php
+++ b/resources/sql/autopatches/20140914.betaproto.php
@@ -3,16 +3,16 @@
$old_key = 'phabricator.show-beta-applications';
$new_key = 'phabricator.show-prototypes';
-echo "Migrating '{$old_key}' to '{$new_key}'...\n";
+echo pht("Migrating '%s' to '%s'...", $old_key, $new_key)."\n";
if (PhabricatorEnv::getEnvConfig($new_key)) {
- echo "Skipping migration, new data is already set.\n";
+ echo pht('Skipping migration, new data is already set.')."\n";
return;
}
$old = PhabricatorEnv::getEnvConfigIfExists($old_key);
if (!$old) {
- echo "Skipping migration, old data does not exist.\n";
+ echo pht('Skipping migration, old data does not exist.')."\n";
return;
}
@@ -21,4 +21,4 @@
->setValue($old)
->save();
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/autopatches/20141107.phriction.policy.2.php b/resources/sql/autopatches/20141107.phriction.policy.2.php
index 9391173c6a..a7cc6ca3e4 100644
--- a/resources/sql/autopatches/20141107.phriction.policy.2.php
+++ b/resources/sql/autopatches/20141107.phriction.policy.2.php
@@ -3,7 +3,7 @@
$table = new PhrictionDocument();
$conn_w = $table->establishConnection('w');
-echo "Populating Phriction policies.\n";
+echo pht('Populating Phriction policies.')."\n";
$default_view_policy = PhabricatorPolicies::POLICY_USER;
$default_edit_policy = PhabricatorPolicies::POLICY_USER;
@@ -12,7 +12,7 @@
$id = $doc->getID();
if ($doc->getViewPolicy() && $doc->getEditPolicy()) {
- echo "Skipping doc $id; already has policy set.\n";
+ echo pht('Skipping document %d; already has policy set.', $id)."\n";
continue;
}
@@ -38,7 +38,10 @@
$edit_policy = nonempty($project->getEditPolicy(), $default_edit_policy);
$project_name = $project->getName();
- echo "Migrating doc $id to project policy $project_name...\n";
+ echo pht(
+ "Migrating document %d to project policy %s...\n",
+ $id,
+ $project_name);
$doc->setViewPolicy($view_policy);
$doc->setEditPolicy($edit_policy);
$doc->save();
@@ -46,10 +49,10 @@
}
}
- echo "Migrating doc $id to default install policy...\n";
+ echo pht('Migrating document %d to default install policy...', $id)."\n";
$doc->setViewPolicy($default_view_policy);
$doc->setEditPolicy($default_edit_policy);
$doc->save();
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/autopatches/20141107.phriction.popkeys.php b/resources/sql/autopatches/20141107.phriction.popkeys.php
index 9af7e3a952..31629c7fea 100644
--- a/resources/sql/autopatches/20141107.phriction.popkeys.php
+++ b/resources/sql/autopatches/20141107.phriction.popkeys.php
@@ -3,7 +3,7 @@
$table = new PhrictionDocument();
$conn_w = $table->establishConnection('w');
-echo "Populating Phriction mailkeys.\n";
+echo pht('Populating Phriction mailkeys.')."\n";
foreach (new LiskMigrationIterator($table) as $doc) {
$id = $doc->getID();
@@ -12,10 +12,10 @@
if ((strlen($key) == 20) && (strpos($key, "\0") === false)) {
// To be valid, keys must have length 20 and not contain any null bytes.
// See T6487.
- echo "Document has valid mailkey.\n";
+ echo pht('Document has valid mailkey.')."\n";
continue;
} else {
- echo "Populating mailkey for document {$id}...\n";
+ echo pht('Populating mailkey for document %d...', $id)."\n";
$mail_key = Filesystem::readRandomCharacters(20);
queryfx(
$conn_w,
@@ -26,4 +26,4 @@
}
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/autopatches/20141107.ssh.4.keymig.php b/resources/sql/autopatches/20141107.ssh.4.keymig.php
index 2388a282cc..f3e2d3f098 100644
--- a/resources/sql/autopatches/20141107.ssh.4.keymig.php
+++ b/resources/sql/autopatches/20141107.ssh.4.keymig.php
@@ -3,18 +3,18 @@
$table = new PhabricatorAuthSSHKey();
$conn_w = $table->establishConnection('w');
-echo "Updating SSH public key indexes...\n";
+echo pht('Updating SSH public key indexes...')."\n";
$keys = new LiskMigrationIterator($table);
foreach ($keys as $key) {
$id = $key->getID();
- echo "Updating key {$id}...\n";
+ echo pht('Updating key %d...', $id)."\n";
try {
$hash = $key->toPublicKey()->getHash();
} catch (Exception $ex) {
- echo "Key has bad format! Removing key.\n";
+ echo pht('Key has bad format! Removing key.')."\n";
queryfx(
$conn_w,
'DELETE FROM %T WHERE id = %d',
@@ -30,7 +30,7 @@
$hash,
$key->getID());
if ($collision) {
- echo "Key is a duplicate! Removing key.\n";
+ echo pht('Key is a duplicate! Removing key.')."\n";
queryfx(
$conn_w,
'DELETE FROM %T WHERE id = %d',
@@ -47,4 +47,4 @@
$key->getID());
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/autopatches/20141113.auditdupes.php b/resources/sql/autopatches/20141113.auditdupes.php
index 2cc7b9bab4..32a6586ca5 100644
--- a/resources/sql/autopatches/20141113.auditdupes.php
+++ b/resources/sql/autopatches/20141113.auditdupes.php
@@ -3,7 +3,7 @@
$table = new PhabricatorRepositoryAuditRequest();
$conn_w = $table->establishConnection('w');
-echo "Removing duplicate Audit requests...\n";
+echo pht('Removing duplicate Audit requests...')."\n";
$seen_audit_map = array();
foreach (new LiskMigrationIterator($table) as $request) {
$commit_phid = $request->getCommitPHID();
@@ -19,4 +19,4 @@
$seen_audit_map[$commit_phid][$auditor_phid] = 1;
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/autopatches/20141218.maniphestcctxn.php b/resources/sql/autopatches/20141218.maniphestcctxn.php
index fb1a67a41d..4ac3c62101 100644
--- a/resources/sql/autopatches/20141218.maniphestcctxn.php
+++ b/resources/sql/autopatches/20141218.maniphestcctxn.php
@@ -3,8 +3,9 @@
$table = new ManiphestTransaction();
$conn_w = $table->establishConnection('w');
-echo "Converting Maniphest CC transactions to modern SUBSCRIBER ".
- "transactions...\n";
+echo pht(
+ "Converting Maniphest CC transactions to modern ".
+ "subscriber transactions...\n");
foreach (new LiskMigrationIterator($table) as $txn) {
// ManiphestTransaction::TYPE_CCS
if ($txn->getTransactionType() == 'ccs') {
@@ -17,4 +18,4 @@
}
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/autopatches/20141222.maniphestprojtxn.php b/resources/sql/autopatches/20141222.maniphestprojtxn.php
index 1fa5726fa4..ba7a8f2f1f 100644
--- a/resources/sql/autopatches/20141222.maniphestprojtxn.php
+++ b/resources/sql/autopatches/20141222.maniphestprojtxn.php
@@ -3,8 +3,8 @@
$table = new ManiphestTransaction();
$conn_w = $table->establishConnection('w');
-echo "Converting Maniphest project transactions to modern EDGE ".
- "transactions...\n";
+echo pht(
+ "Converting Maniphest project transactions to modern edge transactions...\n");
$metadata = array(
'edge:type' => PhabricatorProjectObjectHasProjectEdgeType::EDGECONST,
);
@@ -31,7 +31,7 @@
}
}
-echo "Done.\n";
+echo pht('Done.')."\n";
function mig20141222_build_edge_data(array $project_phids, $task_phid) {
$edge_data = array();
diff --git a/resources/sql/autopatches/20150102.policyname.php b/resources/sql/autopatches/20150102.policyname.php
index a76143527e..cf94b918e7 100644
--- a/resources/sql/autopatches/20150102.policyname.php
+++ b/resources/sql/autopatches/20150102.policyname.php
@@ -15,7 +15,7 @@
$map[$old_name] = $new_name;
}
-echo "Migrating policies...\n";
+echo pht('Migrating policies...')."\n";
$table = new PhabricatorPolicy();
$conn_w = $table->establishConnection('w');
diff --git a/resources/sql/autopatches/20150116.maniphestapplicationemails.php b/resources/sql/autopatches/20150116.maniphestapplicationemails.php
index c3e1f53eee..91430568ca 100644
--- a/resources/sql/autopatches/20150116.maniphestapplicationemails.php
+++ b/resources/sql/autopatches/20150116.maniphestapplicationemails.php
@@ -1,7 +1,7 @@
setApplicationPHID($maniphest->getPHID())
->save();
} catch (AphrontDuplicateKeyQueryException $ex) {
- // already migrated?
+ // Already migrated?
}
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/autopatches/20150120.maniphestdefaultauthor.php b/resources/sql/autopatches/20150120.maniphestdefaultauthor.php
index ae064544f2..352dd4cbbd 100644
--- a/resources/sql/autopatches/20150120.maniphestdefaultauthor.php
+++ b/resources/sql/autopatches/20150120.maniphestdefaultauthor.php
@@ -1,7 +1,7 @@
setApplicationPHID($files_app->getPHID())
->save();
} catch (AphrontDuplicateKeyQueryException $ex) {
- // already migrated?
+ // Already migrated?
}
}
@@ -31,8 +33,8 @@
->setApplicationPHID($paste_app->getPHID())
->save();
} catch (AphrontDuplicateKeyQueryException $ex) {
- // already migrated?
+ // Already migrated?
}
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/autopatches/20150501.calendar.2.reply.php b/resources/sql/autopatches/20150501.calendar.2.reply.php
index 0b448e79cf..2dab8268a6 100644
--- a/resources/sql/autopatches/20150501.calendar.2.reply.php
+++ b/resources/sql/autopatches/20150501.calendar.2.reply.php
@@ -1,6 +1,6 @@
establishConnection('w');
@@ -8,7 +8,7 @@
foreach ($iterator as $event) {
$id = $event->getID();
- echo "Populating event {$id}...\n";
+ echo pht('Populating event %d...', $id)."\n";
queryfx(
$conn_w,
@@ -18,4 +18,4 @@
$id);
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/autopatches/20150506.calendarunnamedevents.1.php b/resources/sql/autopatches/20150506.calendarunnamedevents.1.php
index 0b8c029584..00512de9ed 100644
--- a/resources/sql/autopatches/20150506.calendarunnamedevents.1.php
+++ b/resources/sql/autopatches/20150506.calendarunnamedevents.1.php
@@ -1,6 +1,6 @@
establishConnection('w');
@@ -9,7 +9,7 @@
$id = $event->getID();
if (strlen($event->getName()) == 0) {
- echo "Renaming event {$id}...\n";
+ echo pht('Renaming event %d...', $id)."\n";
$viewer = PhabricatorUser::getOmnipotentUser();
// NOTE: This uses PeopleQuery directly, instead of HandleQuery, to avoid
@@ -35,4 +35,4 @@
}
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/autopatches/20150521.releephrepository.sql b/resources/sql/autopatches/20150521.releephrepository.sql
new file mode 100644
index 0000000000..6626cb8730
--- /dev/null
+++ b/resources/sql/autopatches/20150521.releephrepository.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_releeph.releeph_project
+ MODIFY arcanistProjectID int(10) unsigned NULL;
diff --git a/resources/sql/autopatches/20150525.diff.hidden.1.sql b/resources/sql/autopatches/20150525.diff.hidden.1.sql
new file mode 100644
index 0000000000..d6b3df6440
--- /dev/null
+++ b/resources/sql/autopatches/20150525.diff.hidden.1.sql
@@ -0,0 +1,7 @@
+CREATE TABLE {$NAMESPACE}_differential.differential_hiddencomment (
+ id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ userPHID VARBINARY(64) NOT NULL,
+ commentID INT UNSIGNED NOT NULL,
+ UNIQUE KEY `key_user` (userPHID, commentID),
+ KEY `key_comment` (commentID)
+) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};
diff --git a/resources/sql/autopatches/20150526.owners.mailkey.1.sql b/resources/sql/autopatches/20150526.owners.mailkey.1.sql
new file mode 100644
index 0000000000..6e83129ec3
--- /dev/null
+++ b/resources/sql/autopatches/20150526.owners.mailkey.1.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_owners.owners_package
+ ADD mailKey binary(20) NOT NULL;
diff --git a/resources/sql/autopatches/20150526.owners.mailkey.2.php b/resources/sql/autopatches/20150526.owners.mailkey.2.php
new file mode 100644
index 0000000000..c6bb5f8266
--- /dev/null
+++ b/resources/sql/autopatches/20150526.owners.mailkey.2.php
@@ -0,0 +1,18 @@
+establishConnection('w');
+$iterator = new LiskMigrationIterator($table);
+foreach ($iterator as $package) {
+ $id = $package->getID();
+
+ echo pht('Adding mail key for package %d...', $id);
+ echo "\n";
+
+ queryfx(
+ $conn_w,
+ 'UPDATE %T SET mailKey = %s WHERE id = %d',
+ $table->getTableName(),
+ Filesystem::readRandomCharacters(20),
+ $id);
+}
diff --git a/resources/sql/autopatches/20150526.owners.xaction.sql b/resources/sql/autopatches/20150526.owners.xaction.sql
new file mode 100644
index 0000000000..f25b3dfdb6
--- /dev/null
+++ b/resources/sql/autopatches/20150526.owners.xaction.sql
@@ -0,0 +1,19 @@
+CREATE TABLE {$NAMESPACE}_owners.owners_packagetransaction (
+ id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ phid VARBINARY(64) NOT NULL,
+ authorPHID VARBINARY(64) NOT NULL,
+ objectPHID VARBINARY(64) NOT NULL,
+ viewPolicy VARBINARY(64) NOT NULL,
+ editPolicy VARBINARY(64) NOT NULL,
+ commentPHID VARBINARY(64) DEFAULT NULL,
+ commentVersion INT UNSIGNED NOT NULL,
+ transactionType VARCHAR(32) COLLATE {$COLLATE_TEXT} NOT NULL,
+ oldValue LONGTEXT COLLATE {$COLLATE_TEXT} NOT NULL,
+ newValue LONGTEXT COLLATE {$COLLATE_TEXT} NOT NULL,
+ contentSource LONGTEXT COLLATE {$COLLATE_TEXT} NOT NULL,
+ metadata LONGTEXT COLLATE {$COLLATE_TEXT} NOT NULL,
+ dateCreated INT UNSIGNED NOT NULL,
+ dateModified INT UNSIGNED NOT NULL,
+ UNIQUE KEY `key_phid` (`phid`),
+ KEY `key_object` (`objectPHID`)
+) ENGINE=InnoDB, COLLATE {$COLLATE_TEXT};
diff --git a/resources/sql/patches/059.engines.php b/resources/sql/patches/059.engines.php
index 8c1c7bc8e3..96e28b7a31 100644
--- a/resources/sql/patches/059.engines.php
+++ b/resources/sql/patches/059.engines.php
@@ -15,17 +15,18 @@
return;
}
-echo "There are ".count($tables)." tables using the MyISAM engine. These will ".
- "now be converted to InnoDB. This process may take a few minutes, please ".
- "be patient.\n";
+echo pht(
+ "There are %d tables using the MyISAM engine. These will now be converted ".
+ "to InnoDB. This process may take a few minutes, please be patient.\n",
+ count($tables));
foreach ($tables as $table) {
$name = $table['db'].'.'.$table['tbl'];
- echo "Converting {$name}...\n";
+ echo pht('Converting %s...', $name)."\n";
queryfx(
$conn,
'ALTER TABLE %T.%T ENGINE=InnoDB',
$table['db'],
$table['tbl']);
}
-echo "Done!\n";
+echo pht('Done!')."\n";
diff --git a/resources/sql/patches/079.nametokenindex.php b/resources/sql/patches/079.nametokenindex.php
index 931a850bf0..e0f607e0b7 100644
--- a/resources/sql/patches/079.nametokenindex.php
+++ b/resources/sql/patches/079.nametokenindex.php
@@ -1,13 +1,13 @@
openTransaction();
$table->beginReadLocking();
$users = $table->loadAll();
-echo count($users).' users to index';
+echo pht('%d users to index', count($users));
foreach ($users as $user) {
$user->updateNameTokens();
echo '.';
@@ -15,4 +15,4 @@
$table->endReadLocking();
$table->saveTransaction();
-echo "\nDone.\n";
+echo "\n".pht('Done.')."\n";
diff --git a/resources/sql/patches/081.filekeys.php b/resources/sql/patches/081.filekeys.php
index 1a4a3851fe..c129e80918 100644
--- a/resources/sql/patches/081.filekeys.php
+++ b/resources/sql/patches/081.filekeys.php
@@ -1,12 +1,12 @@
openTransaction();
$table->beginReadLocking();
$files = $table->loadAllWhere('secretKey IS NULL');
-echo count($files).' files to generate keys for';
+echo pht('%d files to generate keys for', count($files));
foreach ($files as $file) {
queryfx(
$file->establishConnection('w'),
@@ -19,4 +19,4 @@
$table->endReadLocking();
$table->saveTransaction();
-echo "\nDone.\n";
+echo "\n".pht('Done.')."\n";
diff --git a/resources/sql/patches/090.forceuniqueprojectnames.php b/resources/sql/patches/090.forceuniqueprojectnames.php
index c3881ad011..a12de8ecfd 100644
--- a/resources/sql/patches/090.forceuniqueprojectnames.php
+++ b/resources/sql/patches/090.forceuniqueprojectnames.php
@@ -1,6 +1,6 @@
openTransaction();
$table->beginReadLocking();
@@ -14,8 +14,8 @@
$slug = $project->getPhrictionSlug();
if ($slug == '/') {
$project_id = $project->getID();
- echo "Project #{$project_id} doesn't have a meaningful name...\n";
- $project->setName(trim('Unnamed Project '.$project->getName()));
+ echo pht("Project #%d doesn't have a meaningful name...", $project_id)."\n";
+ $project->setName(trim(pht('Unnamed Project %s', $project->getName())));
}
$slug_map[$slug][] = $project->getID();
}
@@ -25,15 +25,18 @@
if (count($similar) <= 1) {
continue;
}
- echo "Too many projects are similar to '{$slug}'...\n";
+ echo pht("Too many projects are similar to '%s'...", $slug)."\n";
foreach (array_slice($similar, 1, null, true) as $key => $project_id) {
$project = $projects[$project_id];
$old_name = $project->getName();
$new_name = rename_project($project, $projects);
- echo "Renaming project #{$project_id} ".
- "from '{$old_name}' to '{$new_name}'.\n";
+ echo pht(
+ "Renaming project #%d from '%s' to '%s'.\n",
+ $project_id,
+ $old_name,
+ $new_name);
$project->setName($new_name);
}
}
@@ -47,7 +50,7 @@
$project->setPhrictionSlug($name);
$slug = $project->getPhrictionSlug();
- echo "Updating project #{$id} '{$name}' ({$slug})...";
+ echo pht("Updating project #%d '%s' (%s)... ", $id, $name, $slug);
try {
queryfx(
$project->establishConnection('w'),
@@ -57,22 +60,23 @@
$slug,
$project->getID());
unset($update[$key]);
- echo "okay.\n";
+ echo pht('OKAY')."\n";
} catch (AphrontDuplicateKeyQueryException $ex) {
- echo "failed, will retry.\n";
+ echo pht('Failed, will retry.')."\n";
}
}
if (count($update) == $size) {
throw new Exception(
- 'Failed to make any progress while updating projects. Schema upgrade '.
- 'has failed. Go manually fix your project names to be unique (they are '.
- 'probably ridiculous?) and then try again.');
+ pht(
+ 'Failed to make any progress while updating projects. Schema upgrade '.
+ 'has failed. Go manually fix your project names to be unique '.
+ '(they are probably ridiculous?) and then try again.'));
}
}
$table->endReadLocking();
$table->saveTransaction();
-echo "Done.\n";
+echo pht('Done.')."\n";
/**
diff --git a/resources/sql/patches/093.gitremotes.php b/resources/sql/patches/093.gitremotes.php
index 7af320bf89..5817919e24 100644
--- a/resources/sql/patches/093.gitremotes.php
+++ b/resources/sql/patches/093.gitremotes.php
@@ -1,6 +1,6 @@
openTransaction();
@@ -30,8 +30,13 @@
$id = $repo['id'];
$name = $repo['name'];
- echo "Updating default branch for repository #{$id} '{$name}' from ".
- "'{$old}' to '{$new}' to remove the explicit remote.\n";
+ echo pht(
+ "Updating default branch for repository #%d '%s' from ".
+ "'%s' to '%s' to remove the explicit remote.\n",
+ $id,
+ $name,
+ $old,
+ $new);
queryfx(
$conn_w,
'UPDATE %T SET details = %s WHERE id = %d',
@@ -41,4 +46,4 @@
}
$table->saveTransaction();
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/patches/098.heraldruletypemigration.php b/resources/sql/patches/098.heraldruletypemigration.php
index 0efc8c7e94..896f2353f3 100644
--- a/resources/sql/patches/098.heraldruletypemigration.php
+++ b/resources/sql/patches/098.heraldruletypemigration.php
@@ -1,6 +1,6 @@
openTransaction();
$table->beginReadLocking();
@@ -41,11 +41,11 @@
$rule->getRuleType(),
$rule->getID());
- echo "Setting rule '".$rule->getName()."' to personal. ";
+ echo pht("Setting rule '%s' to personal.", $rule->getName())."\n";
}
}
}
$table->endReadLocking();
$table->saveTransaction();
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/patches/102.heraldcleanup.php b/resources/sql/patches/102.heraldcleanup.php
index 24bf382c09..5b885bd670 100644
--- a/resources/sql/patches/102.heraldcleanup.php
+++ b/resources/sql/patches/102.heraldcleanup.php
@@ -1,6 +1,6 @@
openTransaction();
$table->beginReadLocking();
@@ -24,7 +24,7 @@
mpull($rules, 'getID'));
}
-echo 'This may take a moment';
+echo pht('This may take a moment')."\n";
do {
queryfx(
$conn_w,
@@ -36,4 +36,4 @@
$table->endReadLocking();
$table->saveTransaction();
-echo "\nDone.\n";
+echo "\n".pht('Done.')."\n";
diff --git a/resources/sql/patches/111.commitauditmigration.php b/resources/sql/patches/111.commitauditmigration.php
index 489a07d789..935317b577 100644
--- a/resources/sql/patches/111.commitauditmigration.php
+++ b/resources/sql/patches/111.commitauditmigration.php
@@ -1,6 +1,6 @@
openTransaction();
@@ -31,10 +31,10 @@
}
$table->saveTransaction();
-echo "Done.\n";
+echo pht('Done.')."\n";
-echo "Updating old commit mailKeys...\n";
+echo pht('Updating old commit %s...', 'mailKeys')."\n";
$table->openTransaction();
$commits = queryfx_all(
@@ -55,4 +55,4 @@
}
$table->saveTransaction();
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/patches/131.migraterevisionquery.php b/resources/sql/patches/131.migraterevisionquery.php
index cf505b6295..316c7cdee2 100644
--- a/resources/sql/patches/131.migraterevisionquery.php
+++ b/resources/sql/patches/131.migraterevisionquery.php
@@ -5,7 +5,7 @@
$table->beginReadLocking();
$conn_w = $table->establishConnection('w');
-echo 'Migrating revisions';
+echo pht('Migrating revisions')."\n";
do {
$revisions = $table->loadAllWhere('branchName IS NULL LIMIT 1000');
@@ -32,4 +32,4 @@
$table->endReadLocking();
$table->saveTransaction();
-echo "\nDone.\n";
+echo "\n".pht('Done.')."\n";
diff --git a/resources/sql/patches/20121209.xmacromigrate.php b/resources/sql/patches/20121209.xmacromigrate.php
index df52cb317c..bdd9fc1276 100644
--- a/resources/sql/patches/20121209.xmacromigrate.php
+++ b/resources/sql/patches/20121209.xmacromigrate.php
@@ -1,6 +1,6 @@
openTransaction();
@@ -20,4 +20,4 @@
}
$table->saveTransaction();
-echo "\nDone.\n";
+echo "\n".pht('Done.')."\n";
diff --git a/resources/sql/patches/20130201.revisionunsubscribed.php b/resources/sql/patches/20130201.revisionunsubscribed.php
index 0f01e1d129..904fe1cc86 100644
--- a/resources/sql/patches/20130201.revisionunsubscribed.php
+++ b/resources/sql/patches/20130201.revisionunsubscribed.php
@@ -1,6 +1,6 @@
openTransaction();
@@ -29,4 +29,4 @@
}
$table->saveTransaction();
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/patches/20130218.updatechannelid.php b/resources/sql/patches/20130218.updatechannelid.php
index b8b6d8c416..cf60544a3b 100644
--- a/resources/sql/patches/20130218.updatechannelid.php
+++ b/resources/sql/patches/20130218.updatechannelid.php
@@ -1,6 +1,6 @@
saveTransaction();
$channel_table->saveTransaction();
-echo "\nDone.\n";
+echo "\n".pht('Done.')."\n";
diff --git a/resources/sql/patches/20130219.commitsummarymig.php b/resources/sql/patches/20130219.commitsummarymig.php
index 85ed6e34f4..60bdd1542c 100644
--- a/resources/sql/patches/20130219.commitsummarymig.php
+++ b/resources/sql/patches/20130219.commitsummarymig.php
@@ -1,12 +1,12 @@
establishConnection('w');
$commits = new LiskMigrationIterator($table);
foreach ($commits as $commit) {
- echo 'Filling Commit #'.$commit->getID()."\n";
+ echo pht('Filling Commit #%d', $commit->getID())."\n";
if (strlen($commit->getSummary())) {
continue;
@@ -28,4 +28,4 @@
$commit->getID());
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/patches/20130403.conpherencecachemig.php b/resources/sql/patches/20130403.conpherencecachemig.php
index ffc50006c0..cad9fc626d 100644
--- a/resources/sql/patches/20130403.conpherencecachemig.php
+++ b/resources/sql/patches/20130403.conpherencecachemig.php
@@ -1,6 +1,7 @@
openTransaction();
@@ -10,7 +11,7 @@
$conpherences = new LiskMigrationIterator($table);
foreach ($conpherences as $conpherence) {
- echo 'Migrating conpherence #'.$conpherence->getID()."\n";
+ echo pht('Migrating conpherence #%d', $conpherence->getID())."\n";
$participants = id(new ConpherenceParticipant())
->loadAllWhere('conpherencePHID = %s', $conpherence->getPHID());
@@ -61,4 +62,4 @@
}
$table->saveTransaction();
-echo "\nDone.\n";
+echo "\n".pht('Done.')."\n";
diff --git a/resources/sql/patches/20130409.commitdrev.php b/resources/sql/patches/20130409.commitdrev.php
index d3a2faefbd..fb556f1846 100644
--- a/resources/sql/patches/20130409.commitdrev.php
+++ b/resources/sql/patches/20130409.commitdrev.php
@@ -1,6 +1,6 @@
save();
-echo "\nDone.\n";
+echo "\n".pht('Done.')."\n";
diff --git a/resources/sql/patches/20130502.countdownrevamp2.php b/resources/sql/patches/20130502.countdownrevamp2.php
index 6f7e41e1d2..04d998dab9 100644
--- a/resources/sql/patches/20130502.countdownrevamp2.php
+++ b/resources/sql/patches/20130502.countdownrevamp2.php
@@ -1,6 +1,6 @@
openTransaction();
@@ -20,4 +20,4 @@
}
$table->saveTransaction();
-echo "\nDone.\n";
+echo "\n".pht('Done.')."\n";
diff --git a/resources/sql/patches/20130507.releephrqmailkeypop.php b/resources/sql/patches/20130507.releephrqmailkeypop.php
index 4acf3a5383..016381dc58 100644
--- a/resources/sql/patches/20130507.releephrqmailkeypop.php
+++ b/resources/sql/patches/20130507.releephrqmailkeypop.php
@@ -1,6 +1,6 @@
openTransaction();
@@ -17,11 +17,11 @@
$rq->getTableName(),
Filesystem::readRandomCharacters(20),
$id);
- echo "Generated Key\n";
+ echo pht('Generated Key')."\n";
} else {
echo "-\n";
}
}
$table->saveTransaction();
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/patches/20130529.macroauthormig.php b/resources/sql/patches/20130529.macroauthormig.php
index 89f10e29c8..f642f392c8 100644
--- a/resources/sql/patches/20130529.macroauthormig.php
+++ b/resources/sql/patches/20130529.macroauthormig.php
@@ -1,8 +1,8 @@
getID()."\n";
+ echo pht('Macro #%d', $macro->getID())."\n";
if ($macro->getAuthorPHID()) {
// Already have an author; skip it.
@@ -36,4 +36,4 @@
$macro->getID());
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/patches/20130611.migrateoauth.php b/resources/sql/patches/20130611.migrateoauth.php
index 468ee78ff4..3622b2772e 100644
--- a/resources/sql/patches/20130611.migrateoauth.php
+++ b/resources/sql/patches/20130611.migrateoauth.php
@@ -9,7 +9,7 @@
$xaccount = new PhabricatorExternalAccount();
-echo "Migrating OAuth to ExternalAccount...\n";
+echo pht('Migrating OAuth to %s...', 'ExternalAccount')."\n";
$domain_map = array(
'disqus' => 'disqus.com',
@@ -31,18 +31,18 @@
$conn_w,
'SELECT * FROM user_oauthinfo');
foreach ($rows as $row) {
- echo "Migrating row ID #".$row['id'].".\n";
+ echo pht('Migrating row ID #%d.', $row['id'])."\n";
$user = id(new PhabricatorUser())->loadOneWhere(
'id = %d',
$row['userID']);
if (!$user) {
- echo "Bad user ID!\n";
+ echo pht('Bad user ID!')."\n";
continue;
}
$domain = idx($domain_map, $row['oauthProvider']);
if (empty($domain)) {
- echo "Unknown OAuth provider!\n";
+ echo pht('Unknown OAuth provider!')."\n";
continue;
}
@@ -63,4 +63,4 @@
}
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/patches/20130611.nukeldap.php b/resources/sql/patches/20130611.nukeldap.php
index ee97bb64ab..3f225cfa84 100644
--- a/resources/sql/patches/20130611.nukeldap.php
+++ b/resources/sql/patches/20130611.nukeldap.php
@@ -9,16 +9,16 @@
$xaccount = new PhabricatorExternalAccount();
-echo "Migrating LDAP to ExternalAccount...\n";
+echo pht('Migrating LDAP to %s...', 'ExternalAccount')."\n";
$rows = queryfx_all($conn_w, 'SELECT * FROM %T', $table_name);
foreach ($rows as $row) {
- echo "Migrating row ID #".$row['id'].".\n";
+ echo pht('Migrating row ID #%d.', $row['id'])."\n";
$user = id(new PhabricatorUser())->loadOneWhere(
'id = %d',
$row['userID']);
if (!$user) {
- echo "Bad user ID!\n";
+ echo pht('Bad user ID!')."\n";
continue;
}
@@ -38,4 +38,4 @@
}
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/patches/20130619.authconf.php b/resources/sql/patches/20130619.authconf.php
index 0b56735521..ab0378ee64 100644
--- a/resources/sql/patches/20130619.authconf.php
+++ b/resources/sql/patches/20130619.authconf.php
@@ -60,11 +60,11 @@
$enabled_default);
if (!$enabled) {
- echo pht("Skipping %s (not enabled).\n", $provider_class);
+ echo pht('Skipping %s (not enabled).', $provider_class)."\n";
// This provider was not previously enabled, so we can skip migrating it.
continue;
} else {
- echo pht("Migrating %s...\n", $provider_class);
+ echo pht('Migrating %s...', $provider_class)."\n";
}
$registration_key = idx($spec, 'registration');
@@ -161,4 +161,4 @@
$config->save();
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/patches/20130703.legalpaddocdenorm.php b/resources/sql/patches/20130703.legalpaddocdenorm.php
index 9cb6ef1979..61056ceb23 100644
--- a/resources/sql/patches/20130703.legalpaddocdenorm.php
+++ b/resources/sql/patches/20130703.legalpaddocdenorm.php
@@ -1,7 +1,9 @@
openTransaction();
@@ -9,14 +11,14 @@
$updated = false;
$id = $document->getID();
- echo "Document {$id}: ";
+ echo pht('Document %d: ', $id);
if (!$document->getTitle()) {
$document_body = id(new LegalpadDocumentBody())
->loadOneWhere('phid = %s', $document->getDocumentBodyPHID());
$title = $document_body->getTitle();
$document->setTitle($title);
$updated = true;
- echo "Added title: $title\n";
+ echo pht('Added title: %s', $title)."\n";
} else {
echo "-\n";
}
@@ -29,9 +31,9 @@
$document->getPHID(),
$type);
$document->setRecentContributorPHIDs(array_slice($contributors, 0, 3));
- echo "Added recent contributor phids.\n";
+ echo pht('Added recent contributor PHIDs.')."\n";
$document->setContributorCount(count($contributors));
- echo "Added contributor count.\n";
+ echo pht('Added contributor count.')."\n";
}
if (!$updated) {
@@ -43,4 +45,4 @@
}
$table->saveTransaction();
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/patches/20130711.pholioimageobsolete.php b/resources/sql/patches/20130711.pholioimageobsolete.php
index eae9a479d8..a0f805c69b 100644
--- a/resources/sql/patches/20130711.pholioimageobsolete.php
+++ b/resources/sql/patches/20130711.pholioimageobsolete.php
@@ -1,6 +1,6 @@
openTransaction();
@@ -20,4 +20,4 @@
}
$table->saveTransaction();
-echo "\nDone.\n";
+echo "\n".pht('Done.')."\n";
diff --git a/resources/sql/patches/20130711.trimrealnames.php b/resources/sql/patches/20130711.trimrealnames.php
index c422565b32..a5d2ef2c40 100644
--- a/resources/sql/patches/20130711.trimrealnames.php
+++ b/resources/sql/patches/20130711.trimrealnames.php
@@ -3,18 +3,18 @@
$table = new PhabricatorUser();
$conn_w = $table->establishConnection('w');
-echo "Trimming trailing whitespace from user real names...\n";
+echo pht('Trimming trailing whitespace from user real names...')."\n";
foreach (new LiskMigrationIterator($table) as $user) {
$id = $user->getID();
$real = $user->getRealName();
$trim = rtrim($real);
if ($trim == $real) {
- echo "User {$id} is already trim.\n";
+ echo pht('User %d is already trim.', $id)."\n";
continue;
}
- echo "Trimming user {$id} from '{$real}' to '{$trim}'.\n";
+ echo pht("Trimming user %d from '%s' to '%s'.", $id, $real, $trim)."\n";
qsprintf(
$conn_w,
'UPDATE %T SET realName = %s WHERE id = %d',
@@ -23,4 +23,4 @@
$id);
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/patches/20130715.votecomments.php b/resources/sql/patches/20130715.votecomments.php
index c60b13bb37..0d540596b3 100644
--- a/resources/sql/patches/20130715.votecomments.php
+++ b/resources/sql/patches/20130715.votecomments.php
@@ -1,6 +1,6 @@
setViewer($viewer)
->withIDs(array($poll_id))
->executeOne();
if (!$poll) {
- echo "No poll.\n";
+ echo pht('No poll.')."\n";
continue;
}
@@ -36,7 +36,7 @@
->withPHIDs(array($author_phid))
->executeOne();
if (!$user) {
- echo "No user.\n";
+ echo pht('No user.')."\n";
continue;
}
@@ -98,4 +98,4 @@
$conn_w->saveTransaction();
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/patches/20130716.archivememberlessprojects.php b/resources/sql/patches/20130716.archivememberlessprojects.php
index 259c564cec..bd5671cba3 100644
--- a/resources/sql/patches/20130716.archivememberlessprojects.php
+++ b/resources/sql/patches/20130716.archivememberlessprojects.php
@@ -1,18 +1,17 @@
openTransaction();
foreach (new LiskMigrationIterator($table) as $project) {
-
$members = PhabricatorEdgeQuery::loadDestinationPHIDs(
$project->getPHID(),
PhabricatorProjectProjectHasMemberEdgeType::EDGECONST);
if (count($members)) {
- echo sprintf(
+ echo pht(
'Project "%s" has %d members; skipping.',
$project->getName(),
count($members)), "\n";
@@ -20,13 +19,13 @@
}
if ($project->getStatus() == PhabricatorProjectStatus::STATUS_ARCHIVED) {
- echo sprintf(
+ echo pht(
'Project "%s" already archived; skipping.',
$project->getName()), "\n";
continue;
}
- echo sprintf('Archiving project "%s"...', $project->getName()), "\n";
+ echo pht('Archiving project "%s"...', $project->getName())."\n";
queryfx(
$table->establishConnection('w'),
'UPDATE %T SET status = %s WHERE id = %d',
@@ -36,4 +35,4 @@
}
$table->saveTransaction();
-echo "\nDone.\n";
+echo "\n".pht('Done.')."\n";
diff --git a/resources/sql/patches/20130728.ponderunique.php b/resources/sql/patches/20130728.ponderunique.php
index 94a45ae786..2facd4e3f0 100644
--- a/resources/sql/patches/20130728.ponderunique.php
+++ b/resources/sql/patches/20130728.ponderunique.php
@@ -2,7 +2,7 @@
$map = array();
-echo "Merging duplicate answers by authors...\n";
+echo pht('Merging duplicate answers by authors...')."\n";
$atable = new PonderAnswer();
$conn_w = $atable->establishConnection('w');
@@ -14,14 +14,14 @@
$qid = $answer->getQuestionID();
$author_phid = $answer->getAuthorPHID();
- echo "Processing answer ID #{$aid}...\n";
+ echo pht('Processing answer ID #%d...', $aid)."\n";
if (empty($map[$qid][$author_phid])) {
- echo "Answer is unique.\n";
+ echo pht('Answer is unique.')."\n";
$map[$qid][$author_phid] = $answer;
continue;
} else {
- echo "Merging answer.\n";
+ echo pht('Merging answer.')."\n";
$target = $map[$qid][$author_phid];
queryfx(
$conn_w,
@@ -55,4 +55,4 @@
}
$conn_w->saveTransaction();
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/patches/20130728.ponderxcomment.php b/resources/sql/patches/20130728.ponderxcomment.php
index 1fb65ade76..92e858f95e 100644
--- a/resources/sql/patches/20130728.ponderxcomment.php
+++ b/resources/sql/patches/20130728.ponderxcomment.php
@@ -6,13 +6,13 @@
$conn_w = $qtable->establishConnection('w');
$conn_w->openTransaction();
-echo "Migrating Ponder comments to ApplicationTransactions...\n";
+echo pht('Migrating Ponder comments to %s...', 'ApplicationTransactions')."\n";
$rows = new LiskRawMigrationIterator($conn_w, 'ponder_comment');
foreach ($rows as $row) {
$id = $row['id'];
- echo "Migrating {$id}...\n";
+ echo pht('Migrating %d...', $id)."\n";
$type = phid_get_type($row['targetPHID']);
switch ($type) {
@@ -83,4 +83,4 @@
$conn_w->saveTransaction();
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/patches/20130801.pastexactions.php b/resources/sql/patches/20130801.pastexactions.php
index 52d5a081da..1977eb984e 100644
--- a/resources/sql/patches/20130801.pastexactions.php
+++ b/resources/sql/patches/20130801.pastexactions.php
@@ -6,13 +6,13 @@
$conn_w = $table->establishConnection('w');
$conn_w->openTransaction();
-echo "Adding transactions for existing paste objects...\n";
+echo pht('Adding transactions for existing paste objects...')."\n";
$rows = new LiskRawMigrationIterator($conn_w, 'pastebin_paste');
foreach ($rows as $row) {
$id = $row['id'];
- echo "Adding transactions for paste id {$id}...\n";
+ echo pht('Adding transactions for paste id %d...', $id)."\n";
$xaction_phid = PhabricatorPHID::generateNewPHID(
PhabricatorApplicationTransactionTransactionPHIDType::TYPECONST);
@@ -45,4 +45,4 @@
$conn_w->saveTransaction();
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/patches/20130802.heraldphids.php b/resources/sql/patches/20130802.heraldphids.php
index 814bbddef1..726a335d1f 100644
--- a/resources/sql/patches/20130802.heraldphids.php
+++ b/resources/sql/patches/20130802.heraldphids.php
@@ -3,11 +3,11 @@
$table = new HeraldRule();
$conn_w = $table->establishConnection('w');
-echo "Assigning PHIDs to Herald Rules...\n";
+echo pht('Assigning PHIDs to Herald Rules...')."\n";
foreach (new LiskMigrationIterator(new HeraldRule()) as $rule) {
$id = $rule->getID();
- echo "Rule {$id}.\n";
+ echo pht('Rule %d.', $id)."\n";
if ($rule->getPHID()) {
continue;
@@ -21,4 +21,4 @@
$rule->getID());
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/patches/20130805.pastemailkeypop.php b/resources/sql/patches/20130805.pastemailkeypop.php
index 5354453b6d..bb2d51ded5 100644
--- a/resources/sql/patches/20130805.pastemailkeypop.php
+++ b/resources/sql/patches/20130805.pastemailkeypop.php
@@ -1,6 +1,6 @@
openTransaction();
@@ -17,11 +17,11 @@
$paste->getTableName(),
Filesystem::readRandomCharacters(20),
$id);
- echo "Generated Key\n";
+ echo pht('Generated Key')."\n";
} else {
echo "-\n";
}
}
$table->saveTransaction();
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/patches/20130820.file-mailkey-populate.php b/resources/sql/patches/20130820.file-mailkey-populate.php
index de1a920d97..ba4d6d1606 100644
--- a/resources/sql/patches/20130820.file-mailkey-populate.php
+++ b/resources/sql/patches/20130820.file-mailkey-populate.php
@@ -1,6 +1,6 @@
getTableName();
@@ -35,4 +35,4 @@
}
$table->saveTransaction();
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/patches/20130915.maniphestmigrate.php b/resources/sql/patches/20130915.maniphestmigrate.php
index a9013662e3..c1c4bcaf5d 100644
--- a/resources/sql/patches/20130915.maniphestmigrate.php
+++ b/resources/sql/patches/20130915.maniphestmigrate.php
@@ -5,12 +5,12 @@
$rows = new LiskRawMigrationIterator($conn_w, 'maniphest_taskauxiliarystorage');
-echo "Migrating custom storage for Maniphest fields...\n";
+echo pht('Migrating custom storage for Maniphest fields...')."\n";
foreach ($rows as $row) {
$phid = $row['taskPHID'];
$name = $row['name'];
- echo "Migrating {$phid} / {$name}...\n";
+ echo pht('Migrating %s / %s...', $phid, $name)."\n";
queryfx(
$conn_w,
@@ -22,4 +22,4 @@
$row['value']);
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/patches/20130919.mfieldconf.php b/resources/sql/patches/20130919.mfieldconf.php
index 099e7c0813..c79521acbc 100644
--- a/resources/sql/patches/20130919.mfieldconf.php
+++ b/resources/sql/patches/20130919.mfieldconf.php
@@ -1,18 +1,18 @@
setValue($new)
->save();
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/patches/20130921.xmigratemaniphest.php b/resources/sql/patches/20130921.xmigratemaniphest.php
index 24614867f8..2f7f5952ce 100644
--- a/resources/sql/patches/20130921.xmigratemaniphest.php
+++ b/resources/sql/patches/20130921.xmigratemaniphest.php
@@ -14,7 +14,7 @@
$row_id = $row['id'];
$task_id = $row['taskID'];
- echo "Migrating row {$row_id} (T{$task_id})...\n";
+ echo pht('Migrating row %d (%s)...', $row_id, "T{$task_id}")."\n";
$task_row = queryfx_one(
$conn_w,
@@ -22,7 +22,7 @@
$task_table->getTableName(),
$task_id);
if (!$task_row) {
- echo "Skipping, no such task.\n";
+ echo pht('Skipping, no such task.')."\n";
continue;
}
@@ -145,4 +145,4 @@
}
$conn_w->saveTransaction();
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/patches/20130926.dinline.php b/resources/sql/patches/20130926.dinline.php
index 36632d9103..f2d9e9f205 100644
--- a/resources/sql/patches/20130926.dinline.php
+++ b/resources/sql/patches/20130926.dinline.php
@@ -7,7 +7,7 @@
$src_table = 'differential_inlinecomment';
$dst_table = 'differential_transaction_comment';
-echo "Migrating Differential inline comments to new format...\n";
+echo pht('Migrating Differential inline comments to new format...')."\n";
$content_source = PhabricatorContentSource::newForSource(
PhabricatorContentSource::SOURCE_LEGACY,
@@ -19,7 +19,7 @@
$revision_id = $row['revisionID'];
- echo "Migrating inline #{$id} (D{$revision_id})...\n";
+ echo pht('Migrating inline #%d (%s)...', $id, "D{$revision_id}")."\n";
$revision_row = queryfx_one(
$conn_w,
@@ -87,4 +87,4 @@
}
$conn_w->saveTransaction();
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/patches/20131004.dxreviewers.php b/resources/sql/patches/20131004.dxreviewers.php
index b117048a1e..4f853f5ddc 100644
--- a/resources/sql/patches/20131004.dxreviewers.php
+++ b/resources/sql/patches/20131004.dxreviewers.php
@@ -10,7 +10,7 @@
$revision_id = $revision->getID();
$revision_phid = $revision->getPHID();
- echo "Migrating reviewers for D{$revision_id}...\n";
+ echo pht('Migrating reviewers for %s...', "D{$revision_id}")."\n";
$reviewer_phids = queryfx_all(
$conn_w,
@@ -48,4 +48,4 @@
$editor->save();
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/patches/20131020.pxactionmig.php b/resources/sql/patches/20131020.pxactionmig.php
index eb7c706e1f..7bf4416cd0 100644
--- a/resources/sql/patches/20131020.pxactionmig.php
+++ b/resources/sql/patches/20131020.pxactionmig.php
@@ -7,7 +7,7 @@
$src_table = 'project_legacytransaction';
$dst_table = 'project_transaction';
-echo "Migrating Project transactions to new format...\n";
+echo pht('Migrating Project transactions to new format...')."\n";
$content_source = PhabricatorContentSource::newForSource(
PhabricatorContentSource::SOURCE_LEGACY,
@@ -19,7 +19,7 @@
$project_id = $row['projectID'];
- echo "Migrating transaction #{$id} (Project {$project_id})...\n";
+ echo pht('Migrating transaction #%d (Project %d)...', $id, $project_id)."\n";
$project_row = queryfx_one(
$conn_w,
@@ -89,4 +89,4 @@
}
$conn_w->saveTransaction();
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/patches/20131106.diffphid.2.mig.php b/resources/sql/patches/20131106.diffphid.2.mig.php
index b7f502f47a..67fd14aad0 100644
--- a/resources/sql/patches/20131106.diffphid.2.mig.php
+++ b/resources/sql/patches/20131106.diffphid.2.mig.php
@@ -13,7 +13,7 @@
foreach ($chunk as $diff) {
$id = $diff->getID();
- echo "Migrating diff ID {$id}...\n";
+ echo pht('Migrating diff ID %d...', $id)."\n";
$phid = $diff->getPHID();
if (strlen($phid)) {
@@ -44,4 +44,4 @@
}
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/patches/20131112.userverified.2.mig.php b/resources/sql/patches/20131112.userverified.2.mig.php
index 381fc966ab..a8c231ec20 100644
--- a/resources/sql/patches/20131112.userverified.2.mig.php
+++ b/resources/sql/patches/20131112.userverified.2.mig.php
@@ -5,7 +5,7 @@
foreach (new LiskMigrationIterator($table) as $user) {
$username = $user->getUsername();
- echo "Migrating {$username}...\n";
+ echo pht('Migrating %s...', $username)."\n";
if ($user->getIsEmailVerified()) {
// Email already verified.
continue;
@@ -30,4 +30,4 @@
$user->getID());
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/patches/20131118.ownerorder.php b/resources/sql/patches/20131118.ownerorder.php
index 35433f8e12..a3a5659946 100644
--- a/resources/sql/patches/20131118.ownerorder.php
+++ b/resources/sql/patches/20131118.ownerorder.php
@@ -9,7 +9,7 @@
foreach (new LiskMigrationIterator($table) as $task) {
$id = $task->getID();
- echo "Checking task T{$id}...\n";
+ echo pht('Checking task %s...', "T{$id}")."\n";
$owner_phid = $task->getOwnerPHID();
if (!$owner_phid && !$task->getOwnerOrdering()) {
@@ -39,4 +39,4 @@
}
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/patches/20131121.repocredentials.2.mig.php b/resources/sql/patches/20131121.repocredentials.2.mig.php
index acb7f2f01d..3953b8416f 100644
--- a/resources/sql/patches/20131121.repocredentials.2.mig.php
+++ b/resources/sql/patches/20131121.repocredentials.2.mig.php
@@ -7,16 +7,16 @@
$map = array();
foreach (new LiskMigrationIterator($table) as $repository) {
$callsign = $repository->getCallsign();
- echo "Examining repository {$callsign}...\n";
+ echo pht('Examining repository %s...', $callsign)."\n";
if ($repository->getCredentialPHID()) {
- echo "...already has a Credential.\n";
+ echo pht('...already has a Credential.')."\n";
continue;
}
$raw_uri = $repository->getRemoteURI();
if (!$raw_uri) {
- echo "...no remote URI.\n";
+ echo pht('...no remote URI.')."\n";
continue;
}
@@ -50,12 +50,12 @@
}
if (!$username || !$secret) {
- echo "...no credentials set.\n";
+ echo pht('...no credentials set.')."\n";
continue;
}
$map[$type][$username][$secret][] = $repository;
- echo "...will migrate.\n";
+ echo pht('...will migrate.')."\n";
}
$passphrase = new PassphraseSecret();
@@ -76,7 +76,7 @@
->setMaximumGlyphs(128)
->truncateString($signs));
- echo "Creating: {$name}...\n";
+ echo pht('Creating: %s...', $name)."\n";
$secret = id(new PassphraseSecret())
->setSecretData($secret_plaintext)
@@ -136,4 +136,4 @@
$table->saveTransaction();
$passphrase->saveTransaction();
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/patches/20131205.buildstepordermig.php b/resources/sql/patches/20131205.buildstepordermig.php
index b17724252a..2216fe50b4 100644
--- a/resources/sql/patches/20131205.buildstepordermig.php
+++ b/resources/sql/patches/20131205.buildstepordermig.php
@@ -9,7 +9,7 @@
foreach (new LiskMigrationIterator($table) as $plan) {
$planname = $plan->getName();
- echo "Migrating steps in {$planname}...\n";
+ echo pht('Migrating steps in %s...', $planname)."\n";
$rows = queryfx_all(
$conn_w,
@@ -23,10 +23,10 @@
$id = $row['id'];
$existing = $row['sequence'];
if ($existing != 0) {
- echo " - {$id} (already migrated)...\n";
+ echo " - ".pht('%d (already migrated)...', $id)."\n";
continue;
}
- echo " - {$id} to position {$sequence}...\n";
+ echo " - ".pht('%d to position %s...', $id, $sequence)."\n";
queryfx(
$conn_w,
'UPDATE harbormaster_buildstep '.
@@ -38,4 +38,4 @@
}
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/patches/20131217.pushlogphid.2.mig.php b/resources/sql/patches/20131217.pushlogphid.2.mig.php
index edda8d346d..5b253e2289 100644
--- a/resources/sql/patches/20131217.pushlogphid.2.mig.php
+++ b/resources/sql/patches/20131217.pushlogphid.2.mig.php
@@ -3,12 +3,12 @@
$table = new PhabricatorRepositoryPushLog();
$conn_w = $table->establishConnection('w');
-echo "Assigning PHIDs to push logs...\n";
+echo pht('Assigning PHIDs to push logs...')."\n";
$logs = new LiskMigrationIterator($table);
foreach ($logs as $log) {
$id = $log->getID();
- echo "Updating {$id}...\n";
+ echo pht('Updating %s...', $id)."\n";
queryfx(
$conn_w,
'UPDATE %T SET phid = %s WHERE id = %d',
@@ -17,4 +17,4 @@
$id);
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/patches/emailtableport.php b/resources/sql/patches/emailtableport.php
index ba46e70916..d70f3341ff 100644
--- a/resources/sql/patches/emailtableport.php
+++ b/resources/sql/patches/emailtableport.php
@@ -1,6 +1,6 @@
openTransaction();
@@ -19,7 +19,7 @@
// NOTE: Grandfather all existing email in as primary / verified. We generate
// verification codes because they are used for password resets, etc.
- echo "Migrating '{$phid}'...\n";
+ echo pht("Migrating '%s'...", $phid)."\n";
queryfx(
$conn,
'INSERT INTO %T (userPHID, address, verificationCode, isVerified, isPrimary)
@@ -31,4 +31,4 @@
}
$table->saveTransaction();
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/patches/legalpad-mailkey-populate.php b/resources/sql/patches/legalpad-mailkey-populate.php
index e754ab2757..8aa2c593df 100644
--- a/resources/sql/patches/legalpad-mailkey-populate.php
+++ b/resources/sql/patches/legalpad-mailkey-populate.php
@@ -1,13 +1,13 @@
openTransaction();
foreach (new LiskMigrationIterator($table) as $document) {
$id = $document->getID();
- echo "Document {$id}: ";
+ echo pht('Document %s: ', $id);
if (!$document->getMailKey()) {
queryfx(
$document->establishConnection('w'),
@@ -15,11 +15,11 @@
$document->getTableName(),
Filesystem::readRandomCharacters(20),
$id);
- echo "Generated Key\n";
+ echo pht('Generated Key')."\n";
} else {
echo "-\n";
}
}
$table->saveTransaction();
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/patches/liskcounters.php b/resources/sql/patches/liskcounters.php
index 489747575f..198ed13742 100644
--- a/resources/sql/patches/liskcounters.php
+++ b/resources/sql/patches/liskcounters.php
@@ -1,6 +1,6 @@
openTransaction();
foreach (new LiskMigrationIterator($table) as $rev) {
$id = $rev->getID();
- echo "Revision {$id}: ";
+ echo pht('Revision %d: ', $id);
$deps = $rev->getAttachedPHIDs(DifferentialRevisionPHIDType::TYPECONST);
if (!$deps) {
@@ -22,8 +22,8 @@
$dep);
}
$editor->save();
- echo "OKAY\n";
+ echo pht('OKAY')."\n";
}
$table->saveTransaction();
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/patches/migrate-maniphest-dependencies.php b/resources/sql/patches/migrate-maniphest-dependencies.php
index 394c98a95f..074018264c 100644
--- a/resources/sql/patches/migrate-maniphest-dependencies.php
+++ b/resources/sql/patches/migrate-maniphest-dependencies.php
@@ -1,12 +1,12 @@
openTransaction();
foreach (new LiskMigrationIterator($table) as $task) {
$id = $task->getID();
- echo "Task {$id}: ";
+ echo pht('Task %d: ', $id);
$deps = $task->getAttachedPHIDs(ManiphestTaskPHIDType::TYPECONST);
if (!$deps) {
@@ -22,8 +22,8 @@
$dep);
}
$editor->save();
- echo "OKAY\n";
+ echo pht('OKAY')."\n";
}
$table->saveTransaction();
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/patches/migrate-maniphest-revisions.php b/resources/sql/patches/migrate-maniphest-revisions.php
index 0658cfda69..2a8f8061b4 100644
--- a/resources/sql/patches/migrate-maniphest-revisions.php
+++ b/resources/sql/patches/migrate-maniphest-revisions.php
@@ -1,12 +1,12 @@
establishConnection('w');
foreach (new LiskMigrationIterator($table) as $task) {
$id = $task->getID();
- echo "Task {$id}: ";
+ echo pht('Task %d: ', $id);
$revs = $task->getAttachedPHIDs(DifferentialRevisionPHIDType::TYPECONST);
if (!$revs) {
@@ -22,7 +22,7 @@
$rev);
}
$editor->save();
- echo "OKAY\n";
+ echo pht('OKAY')."\n";
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/patches/migrate-project-edges.php b/resources/sql/patches/migrate-project-edges.php
index 855b52b14b..277cf8b155 100644
--- a/resources/sql/patches/migrate-project-edges.php
+++ b/resources/sql/patches/migrate-project-edges.php
@@ -1,12 +1,12 @@
establishConnection('w');
foreach (new LiskMigrationIterator($table) as $proj) {
$id = $proj->getID();
- echo "Project {$id}: ";
+ echo pht('Project %d: ', $id);
$members = queryfx_all(
$proj->establishConnection('w'),
@@ -29,7 +29,7 @@
$user_phid);
}
$editor->save();
- echo "OKAY\n";
+ echo pht('OKAY')."\n";
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/resources/sql/patches/ponder-mailkey-populate.php b/resources/sql/patches/ponder-mailkey-populate.php
index bdae8f83a0..5d2c77fff4 100644
--- a/resources/sql/patches/ponder-mailkey-populate.php
+++ b/resources/sql/patches/ponder-mailkey-populate.php
@@ -1,13 +1,13 @@
openTransaction();
foreach (new LiskMigrationIterator($table) as $question) {
$id = $question->getID();
- echo "Question {$id}: ";
+ echo pht('Question %d: ', $id);
if (!$question->getMailKey()) {
queryfx(
$question->establishConnection('w'),
@@ -15,11 +15,11 @@
$question->getTableName(),
Filesystem::readRandomCharacters(20),
$id);
- echo "Generated Key\n";
+ echo pht('Generated Key')."\n";
} else {
echo "-\n";
}
}
$table->saveTransaction();
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/scripts/__init_script__.php b/scripts/__init_script__.php
index c0a198a145..57ada96e64 100644
--- a/scripts/__init_script__.php
+++ b/scripts/__init_script__.php
@@ -11,7 +11,7 @@ function init_phabricator_script() {
@include_once 'libphutil/scripts/__init_script__.php';
if (!@constant('__LIBPHUTIL__')) {
echo "ERROR: Unable to load libphutil. Update your PHP 'include_path' to ".
- "include the parent directory of libphutil/.\n";
+ "include the parent directory of libphutil/.\n";
exit(1);
}
diff --git a/scripts/almanac/manage_almanac.php b/scripts/almanac/manage_almanac.php
index e18b67d74a..933d1b7229 100755
--- a/scripts/almanac/manage_almanac.php
+++ b/scripts/almanac/manage_almanac.php
@@ -5,7 +5,7 @@
require_once $root.'/scripts/__init_script__.php';
$args = new PhutilArgumentParser($argv);
-$args->setTagline('manage host directory');
+$args->setTagline(pht('manage host directory'));
$args->setSynopsis(<<\n";
- echo "Purpose: Print controller which will process passed .\n";
+ echo pht('Usage: %s', 'aphrontpath.php ')."\n";
+ echo pht(
+ "Purpose: Print controller which will process passed %s.\n",
+ '');
exit(1);
}
diff --git a/scripts/cache/manage_cache.php b/scripts/cache/manage_cache.php
index c50efca606..80e8e80819 100755
--- a/scripts/cache/manage_cache.php
+++ b/scripts/cache/manage_cache.php
@@ -5,7 +5,7 @@
require_once $root.'/scripts/__init_script__.php';
$args = new PhutilArgumentParser($argv);
-$args->setTagline('manage cache');
+$args->setTagline(pht('manage cache'));
$args->setSynopsis(<<setTagline('regenerate CSS sprite sheets');
+$args->setTagline(pht('regenerate CSS sprite sheets'));
$args->setSynopsis(<< 'force',
- 'help' => 'Force regeneration even if sources have not changed.',
+ 'help' => pht('Force regeneration even if sources have not changed.'),
),
));
@@ -39,8 +39,10 @@
if ($err) {
$have_optipng = false;
echo phutil_console_format(
- " WARNING `optipng` not found in PATH.\n".
- "Sprites will not be optimized! Install `optipng`!\n");
+ " %s %s\n%s\n",
+ pht('WARNING'),
+ pht('`%s` not found in PATH.', 'optipng'),
+ pht('Sprites will not be optimized! Install `%s`!', 'optipng'));
} else {
$have_optipng = true;
}
@@ -75,10 +77,10 @@
$sheet->generateImage($full_path, $scale);
if ($have_optipng) {
- echo "Optimizing...\n";
+ echo pht('Optimizing...')."\n";
phutil_passthru('optipng -o7 -clobber %s', $full_path);
}
}
}
-echo "Done.\n";
+echo pht('Done.')."\n";
diff --git a/scripts/daemon/manage_daemons.php b/scripts/daemon/manage_daemons.php
index 2d4b58dbb2..087c925b81 100755
--- a/scripts/daemon/manage_daemons.php
+++ b/scripts/daemon/manage_daemons.php
@@ -7,7 +7,7 @@
PhabricatorDaemonManagementWorkflow::requireExtensions();
$args = new PhutilArgumentParser($argv);
-$args->setTagline('manage daemons');
+$args->setTagline(pht('manage daemons'));
$args->setSynopsis(<<setTagline('documentation generator');
+$args->setTagline(pht('documentation generator'));
$args->setSynopsis(<<setTagline('manage drydock software resources');
+$args->setTagline(pht('manage drydock software resources'));
$args->setSynopsis(<<setTagline('manage fact configuration');
+$args->setTagline(pht('manage fact configuration'));
$args->setSynopsis(<<setTagline('manage files');
+$args->setTagline(pht('manage files'));
$args->setSynopsis(<<setTagline('manage lipsum');
+$args->setTagline(pht('manage lipsum'));
$args->setSynopsis(<<processReceivedMail();
} catch (Exception $e) {
$received
- ->setMessage('EXCEPTION: '.$e->getMessage())
+ ->setMessage(pht('EXCEPTION: %s', $e->getMessage()))
->save();
throw $e;
diff --git a/scripts/mail/manage_mail.php b/scripts/mail/manage_mail.php
index 9822565175..7f73303fdb 100755
--- a/scripts/mail/manage_mail.php
+++ b/scripts/mail/manage_mail.php
@@ -5,7 +5,7 @@
require_once $root.'/scripts/__init_script__.php';
$args = new PhutilArgumentParser($argv);
-$args->setTagline('manage mail');
+$args->setTagline(pht('manage mail'));
$args->setSynopsis(<<isHg()) {
diff --git a/scripts/repository/manage_repositories.php b/scripts/repository/manage_repositories.php
index b3ebac0842..ae0395e663 100755
--- a/scripts/repository/manage_repositories.php
+++ b/scripts/repository/manage_repositories.php
@@ -5,7 +5,7 @@
require_once $root.'/scripts/__init_script__.php';
$args = new PhutilArgumentParser($argv);
-$args->setTagline('manage repositories');
+$args->setTagline(pht('manage repositories'));
$args->setSynopsis(<<setTagline('save lint errors to database')
+ ->setTagline(pht('save lint errors to database'))
->setSynopsis($synopsis)
->parseStandardArguments()
->parse(array(
diff --git a/scripts/search/manage_search.php b/scripts/search/manage_search.php
index b07ff54bad..4b119f28cc 100755
--- a/scripts/search/manage_search.php
+++ b/scripts/search/manage_search.php
@@ -5,7 +5,7 @@
require_once $root.'/scripts/__init_script__.php';
$args = new PhutilArgumentParser($argv);
-$args->setTagline('manage search');
+$args->setTagline(pht('manage search'));
$args->setSynopsis(<<setTagline('manage audits');
+$args->setTagline(pht('manage audits'));
$args->setSynopsis(<<setTagline('manage authentication');
+$args->setTagline(pht('manage authentication'));
$args->setSynopsis(<<setTagline('manage celerity');
+$args->setTagline(pht('manage celerity'));
$args->setSynopsis(<<setTagline('manage configuration');
+$args->setTagline(pht('manage configuration'));
$args->setSynopsis(<<setTagline('manage feed');
+$args->setTagline(pht('manage feed'));
$args->setSynopsis(<<setTagline('manage Harbormaster');
+$args->setTagline(pht('manage Harbormaster'));
$args->setSynopsis(<<setTagline('manage hunks');
+$args->setTagline(pht('manage hunks'));
$args->setSynopsis(<<setTagline('manage internationalization');
+$args->setTagline(pht('manage internationalization'));
$args->setSynopsis(<<setTagline('manage billing');
+$args->setTagline(pht('manage billing'));
$args->setSynopsis(<<setTagline('manage policies');
+$args->setTagline(pht('manage policies'));
$args->setSynopsis(<<setTagline('remove objects');
+$args->setTagline(pht('remove objects'));
$args->setSynopsis(<<setTagline('manage triggers');
+$args->setTagline(pht('manage triggers'));
$args->setSynopsis(<<setTagline('manage task queue');
+$args->setTagline(pht('manage task queue'));
$args->setSynopsis(<<setTagline('manage SMS');
+$args->setTagline(pht('manage SMS'));
$args->setSynopsis(<<setTagline('manage Phabricator storage and schemata');
+$args->setTagline(pht('manage Phabricator storage and schemata'));
$args->setSynopsis(<< 'force',
'short' => 'f',
- 'help' => 'Do not prompt before performing dangerous operations.',
+ 'help' => pht(
+ 'Do not prompt before performing dangerous operations.'),
),
array(
'name' => 'user',
'short' => 'u',
'param' => 'username',
'default' => $default_user,
- 'help' => "Connect with __username__ instead of the configured ".
- "default ('{$default_user}').",
+ 'help' => pht(
+ "Connect with __username__ instead of the configured default ('%s').",
+ $default_user),
),
array(
'name' => 'password',
'short' => 'p',
'param' => 'password',
- 'help' => 'Use __password__ instead of the configured default.',
+ 'help' => pht('Use __password__ instead of the configured default.'),
),
array(
'name' => 'namespace',
'param' => 'name',
'default' => $default_namespace,
- 'help' => "Use namespace __namespace__ instead of the configured ".
- "default ('{$default_namespace}'). This is an advanced ".
- "feature used by unit tests; you should not normally ".
- "use this flag.",
+ 'help' => pht(
+ "Use namespace __namespace__ instead of the configured ".
+ "default ('%s'). This is an advanced feature used by unit tests; ".
+ "you should not normally use this flag.",
+ $default_namespace),
),
array(
'name' => 'dryrun',
- 'help' => 'Do not actually change anything, just show what would be '.
- 'changed.',
+ 'help' => pht(
+ 'Do not actually change anything, just show what would be changed.'),
),
array(
'name' => 'disable-utf8mb4',
@@ -93,23 +96,23 @@
'SELECT 1');
} catch (AphrontQueryException $ex) {
$message = phutil_console_format(
+ "**%s**\n\n%s\n\n%s\n\n%s\n\n**%s**: %s\n",
+ pht('MySQL Credentials Not Configured'),
pht(
- "**MySQL Credentials Not Configured**\n\n".
- "Unable to connect to MySQL using the configured credentials. ".
- "You must configure standard credentials before you can upgrade ".
- "storage. Run these commands to set up credentials:\n".
- "\n".
- " phabricator/ $ ./bin/config set mysql.host __host__\n".
- " phabricator/ $ ./bin/config set mysql.user __username__\n".
- " phabricator/ $ ./bin/config set mysql.pass __password__\n".
- "\n".
- "These standard credentials are separate from any administrative ".
- "credentials provided to this command with __--user__ or ".
- "__--password__, and must be configured correctly before you can ".
- "proceed.\n".
- "\n".
- "**Raw MySQL Error**: %s\n",
- $ex->getMessage()));
+ 'Unable to connect to MySQL using the configured credentials. '.
+ 'You must configure standard credentials before you can upgrade '.
+ 'storage. Run these commands to set up credentials:'),
+ " phabricator/ $ ./bin/config set mysql.host __host__\n".
+ " phabricator/ $ ./bin/config set mysql.user __username__\n".
+ " phabricator/ $ ./bin/config set mysql.pass __password__",
+ pht(
+ 'These standard credentials are separate from any administrative '.
+ 'credentials provided to this command with __%s__ or '.
+ '__%s__, and must be configured correctly before you can proceed.',
+ '--user',
+ '--password'),
+ pht('Raw MySQL Error'),
+ $ex->getMessage());
echo phutil_console_wrap($message);
@@ -141,14 +144,16 @@
'SELECT 1');
} catch (AphrontQueryException $ex) {
$message = phutil_console_format(
+ "**%s**\n\n%s\n\n**%s**: %s\n",
+ pht('Bad Administrative Credentials'),
pht(
- "**Bad Administrative Credentials**\n\n".
- "Unable to connnect to MySQL using the administrative credentials ".
- "provided with the __--user__ and __--password__ flags. Check that ".
- "you have entered them correctly.\n".
- "\n".
- "**Raw MySQL Error**: %s\n",
- $ex->getMessage()));
+ 'Unable to connect to MySQL using the administrative credentials '.
+ 'provided with the __%s__ and __%s__ flags. Check that '.
+ 'you have entered them correctly.',
+ '--user',
+ '--password'),
+ pht('Raw MySQL Error'),
+ $ex->getMessage());
echo phutil_console_wrap($message);
diff --git a/scripts/ssh/ssh-exec.php b/scripts/ssh/ssh-exec.php
index 93b808be92..0eb9b4a3ad 100755
--- a/scripts/ssh/ssh-exec.php
+++ b/scripts/ssh/ssh-exec.php
@@ -9,7 +9,7 @@
$ssh_log = PhabricatorSSHLog::getLog();
$args = new PhutilArgumentParser($argv);
-$args->setTagline('execute SSH requests');
+$args->setTagline(pht('execute SSH requests'));
$args->setSynopsis(<< pht(
'Provide a command to execute. This makes testing this script '.
'easier. When running normally, the command is read from the '.
- 'environment (SSH_ORIGINAL_COMMAND), which is populated by sshd.'),
+ 'environment (%s), which is populated by sshd.',
+ 'SSH_ORIGINAL_COMMAND'),
),
));
@@ -84,9 +85,11 @@
if ($user_name && $device_name) {
throw new Exception(
pht(
- 'The --phabricator-ssh-user and --phabricator-ssh-device flags are '.
- 'mutually exclusive. You can not authenticate as both a user ("%s") '.
- 'and a device ("%s"). Specify one or the other, but not both.',
+ 'The %s and %s flags are mutually exclusive. You can not '.
+ 'authenticate as both a user ("%s") and a device ("%s"). '.
+ 'Specify one or the other, but not both.',
+ '--phabricator-ssh-user',
+ '--phabricator-ssh-device',
$user_name,
$device_name));
} else if (strlen($user_name)) {
@@ -104,9 +107,10 @@
if (!$remote_address) {
throw new Exception(
pht(
- 'Unable to identify remote address from the SSH_CLIENT environment '.
+ 'Unable to identify remote address from the %s environment '.
'variable. Device authentication is accepted only from trusted '.
- 'sources.'));
+ 'sources.',
+ 'SSH_CLIENT'));
}
if (!PhabricatorEnv::isClusterAddress($remote_address)) {
@@ -134,8 +138,9 @@
} else {
throw new Exception(
pht(
- 'This script must be invoked with either the --phabricator-ssh-user '.
- 'or --phabricator-ssh-device flag.'));
+ 'This script must be invoked with either the %s or %s flag.',
+ '--phabricator-ssh-user',
+ '--phabricator-ssh-device'));
}
if ($args->getArg('ssh-command')) {
@@ -199,10 +204,12 @@
"You haven't specified a command to run. This means you're requesting ".
"an interactive shell, but Phabricator does not provide an ".
"interactive shell over SSH.\n\n".
- "Usually, you should run a command like `git clone` or `hg push` ".
+ "Usually, you should run a command like `%s` or `%s` ".
"rather than connecting directly with SSH.\n\n".
"Supported commands are: %s.",
$user->getUsername(),
+ 'git clone',
+ 'hg push',
implode(', ', $workflow_names)));
}
@@ -225,7 +232,7 @@
$parsed_args = new PhutilArgumentParser($parseable_argv);
if (empty($workflow_names[$command])) {
- throw new Exception('Invalid command.');
+ throw new Exception(pht('Invalid command.'));
}
$workflow = $parsed_args->parseWorkflows($workflows);
@@ -235,17 +242,17 @@
$sock_stdin = fopen('php://stdin', 'r');
if (!$sock_stdin) {
- throw new Exception('Unable to open stdin.');
+ throw new Exception(pht('Unable to open stdin.'));
}
$sock_stdout = fopen('php://stdout', 'w');
if (!$sock_stdout) {
- throw new Exception('Unable to open stdout.');
+ throw new Exception(pht('Unable to open stdout.'));
}
$sock_stderr = fopen('php://stderr', 'w');
if (!$sock_stderr) {
- throw new Exception('Unable to open stderr.');
+ throw new Exception(pht('Unable to open stderr.'));
}
$socket_channel = new PhutilSocketChannel(
diff --git a/scripts/symbols/import_repository_symbols.php b/scripts/symbols/import_repository_symbols.php
index 14a83dda0c..94cf601a34 100755
--- a/scripts/symbols/import_repository_symbols.php
+++ b/scripts/symbols/import_repository_symbols.php
@@ -170,11 +170,11 @@ function check_string_value($value, $field_name, $line_no, $max_length) {
$line_number = $matches['line'];
$path = $matches['path'];
- check_string_value($context, 'Symbol context', $line_no, 128);
- check_string_value($name, 'Symbol name', $line_no, 128);
- check_string_value($type, 'Symbol type', $line_no, 12);
- check_string_value($lang, 'Symbol language', $line_no, 32);
- check_string_value($path, 'Path', $line_no, 512);
+ check_string_value($context, pht('Symbol context'), $line_no, 128);
+ check_string_value($name, pht('Symbol name'), $line_no, 128);
+ check_string_value($type, pht('Symbol type'), $line_no, 12);
+ check_string_value($lang, pht('Symbol language'), $line_no, 32);
+ check_string_value($path, pht('Path'), $line_no, 512);
if (!strlen($path) || $path[0] != '/') {
throw new Exception(
@@ -226,4 +226,4 @@ function check_string_value($value, $field_name, $line_no, $max_length) {
commit_symbols($symbols, $repository, $no_purge);
}
-echo pht('Done.'), "\n";
+echo pht('Done.')."\n";
diff --git a/scripts/user/account_admin.php b/scripts/user/account_admin.php
index 3d18c16ac7..dc1cb50190 100755
--- a/scripts/user/account_admin.php
+++ b/scripts/user/account_admin.php
@@ -13,31 +13,32 @@
if ($is_first_user) {
echo pht(
- "WARNING\n\n".
- "You're about to create the first account on this install. Normally, you ".
- "should use the web interface to create the first account, not this ".
- "script.\n\n".
- "If you use the web interface, it will drop you into a nice UI workflow ".
- "which gives you more help setting up your install. If you create an ".
- "account with this script instead, you will skip the setup help and you ".
- "will not be able to access it later.");
+ "WARNING\n\n".
+ "You're about to create the first account on this install. Normally, ".
+ "you should use the web interface to create the first account, not ".
+ "this script.\n\n".
+ "If you use the web interface, it will drop you into a nice UI workflow ".
+ "which gives you more help setting up your install. If you create an ".
+ "account with this script instead, you will skip the setup help and you ".
+ "will not be able to access it later.");
if (!phutil_console_confirm(pht('Skip easy setup and create account?'))) {
echo pht('Cancelled.')."\n";
exit(1);
}
}
-echo 'Enter a username to create a new account or edit an existing account.';
+echo pht(
+ 'Enter a username to create a new account or edit an existing account.');
-$username = phutil_console_prompt('Enter a username:');
+$username = phutil_console_prompt(pht('Enter a username:'));
if (!strlen($username)) {
- echo "Cancelled.\n";
+ echo pht('Cancelled.')."\n";
exit(1);
}
if (!PhabricatorUser::validateUsername($username)) {
$valid = PhabricatorUser::describeValidUsername();
- echo "The username '{$username}' is invalid. {$valid}\n";
+ echo pht("The username '%s' is invalid. %s", $username, $valid)."\n";
exit(1);
}
@@ -49,12 +50,12 @@
if (!$user) {
$original = new PhabricatorUser();
- echo "There is no existing user account '{$username}'.\n";
+ echo pht("There is no existing user account '%s'.", $username)."\n";
$ok = phutil_console_confirm(
- "Do you want to create a new '{$username}' account?",
+ pht("Do you want to create a new '%s' account?", $username),
$default_no = false);
if (!$ok) {
- echo "Cancelled.\n";
+ echo pht('Cancelled.')."\n";
exit(1);
}
$user = new PhabricatorUser();
@@ -64,12 +65,12 @@
} else {
$original = clone $user;
- echo "There is an existing user account '{$username}'.\n";
+ echo pht("There is an existing user account '%s'.", $username)."\n";
$ok = phutil_console_confirm(
- "Do you want to edit the existing '{$username}' account?",
+ pht("Do you want to edit the existing '%s' account?", $username),
$default_no = false);
if (!$ok) {
- echo "Cancelled.\n";
+ echo pht('Cancelled.')."\n";
exit(1);
}
@@ -78,12 +79,12 @@
$user_realname = $user->getRealName();
if (strlen($user_realname)) {
- $realname_prompt = ' ['.$user_realname.']';
+ $realname_prompt = ' ['.$user_realname.']:';
} else {
- $realname_prompt = '';
+ $realname_prompt = ':';
}
$realname = nonempty(
- phutil_console_prompt("Enter user real name{$realname_prompt}:"),
+ phutil_console_prompt(pht('Enter user real name').$realname_prompt),
$user_realname);
$user->setRealName($realname);
@@ -95,13 +96,14 @@
$create_email = null;
if ($is_new) {
do {
- $email = phutil_console_prompt('Enter user email address:');
+ $email = phutil_console_prompt(pht('Enter user email address:'));
$duplicate = id(new PhabricatorUserEmail())->loadOneWhere(
'address = %s',
$email);
if ($duplicate) {
- echo "ERROR: There is already a user with that email address. ".
- "Each user must have a unique email address.\n";
+ echo pht(
+ "ERROR: There is already a user with that email address. ".
+ "Each user must have a unique email address.\n");
} else {
break;
}
@@ -115,7 +117,7 @@
// it.
phutil_passthru('stty -echo');
$password = phutil_console_prompt(
- 'Enter a password for this user [blank to leave unchanged]:');
+ pht('Enter a password for this user [blank to leave unchanged]:'));
phutil_passthru('stty echo');
if (strlen($password)) {
$changed_pass = $password;
@@ -123,7 +125,7 @@
$is_system_agent = $user->getIsSystemAgent();
$set_system_agent = phutil_console_confirm(
- 'Is this user a bot/script?',
+ pht('Is this user a bot/script?'),
$default_no = !$is_system_agent);
$verify_email = null;
@@ -135,56 +137,56 @@
$verify_email = $user->loadPrimaryEmail();
if (!$verify_email->getIsVerified()) {
$set_verified = phutil_console_confirm(
- 'Should the primary email address be verified?',
+ pht('Should the primary email address be verified?'),
$default_no = true);
} else {
- // already verified so let's not make a fuss
+ // Already verified so let's not make a fuss.
$verify_email = null;
}
}
$is_admin = $user->getIsAdmin();
$set_admin = phutil_console_confirm(
- 'Should this user be an administrator?',
+ pht('Should this user be an administrator?'),
$default_no = !$is_admin);
-echo "\n\nACCOUNT SUMMARY\n\n";
+echo "\n\n".pht('ACCOUNT SUMMARY')."\n\n";
$tpl = "%12s %-30s %-30s\n";
-printf($tpl, null, 'OLD VALUE', 'NEW VALUE');
-printf($tpl, 'Username', $original->getUsername(), $user->getUsername());
-printf($tpl, 'Real Name', $original->getRealName(), $user->getRealName());
+printf($tpl, null, pht('OLD VALUE'), pht('NEW VALUE'));
+printf($tpl, pht('Username'), $original->getUsername(), $user->getUsername());
+printf($tpl, pht('Real Name'), $original->getRealName(), $user->getRealName());
if ($is_new) {
- printf($tpl, 'Email', '', $create_email);
+ printf($tpl, pht('Email'), '', $create_email);
}
-printf($tpl, 'Password', null,
+printf($tpl, pht('Password'), null,
($changed_pass !== false)
- ? 'Updated'
- : 'Unchanged');
+ ? pht('Updated')
+ : pht('Unchanged'));
printf(
$tpl,
- 'Bot/Script',
+ pht('Bot/Script'),
$original->getIsSystemAgent() ? 'Y' : 'N',
$set_system_agent ? 'Y' : 'N');
if ($verify_email) {
printf(
$tpl,
- 'Verify Email',
+ pht('Verify Email'),
$verify_email->getIsVerified() ? 'Y' : 'N',
$set_verified ? 'Y' : 'N');
}
printf(
$tpl,
- 'Admin',
+ pht('Admin'),
$original->getIsAdmin() ? 'Y' : 'N',
$set_admin ? 'Y' : 'N');
echo "\n";
-if (!phutil_console_confirm('Save these changes?', $default_no = false)) {
- echo "Cancelled.\n";
+if (!phutil_console_confirm(pht('Save these changes?'), $default_no = false)) {
+ echo pht('Cancelled.')."\n";
exit(1);
}
@@ -223,4 +225,4 @@
$user->saveTransaction();
-echo "Saved changes.\n";
+echo pht('Saved changes.')."\n";
diff --git a/scripts/user/add_user.php b/scripts/user/add_user.php
index f2cdac396b..4c598e47e2 100755
--- a/scripts/user/add_user.php
+++ b/scripts/user/add_user.php
@@ -5,7 +5,9 @@
require_once $root.'/scripts/__init_script__.php';
if ($argc !== 5) {
- echo "usage: add_user.php \n";
+ echo pht(
+ "Usage: %s\n",
+ 'add_user.php ');
exit(1);
}
@@ -19,8 +21,9 @@
$argv[4]);
if (!$admin) {
throw new Exception(
- 'Admin user must be the username of a valid Phabricator account, used '.
- 'to send the new user a welcome email.');
+ pht(
+ 'Admin user must be the username of a valid Phabricator account, used '.
+ 'to send the new user a welcome email.'));
}
$existing_user = id(new PhabricatorUser())->loadOneWhere(
@@ -28,7 +31,9 @@
$username);
if ($existing_user) {
throw new Exception(
- "There is already a user with the username '{$username}'!");
+ pht(
+ "There is already a user with the username '%s'!",
+ $username));
}
$existing_email = id(new PhabricatorUserEmail())->loadOneWhere(
@@ -36,7 +41,9 @@
$email);
if ($existing_email) {
throw new Exception(
- "There is already a user with the email '{$email}'!");
+ pht(
+ "There is already a user with the email '%s'!",
+ $email));
}
$user = new PhabricatorUser();
@@ -54,4 +61,8 @@
$user->sendWelcomeEmail($admin);
-echo "Created user '{$username}' (realname='{$realname}', email='{$email}').\n";
+echo pht(
+ "Created user '%s' (realname='%s', email='%s').\n",
+ $username,
+ $realname,
+ $email);
diff --git a/scripts/util/add_macro.php b/scripts/util/add_macro.php
index cbfe8480f6..03566cfb76 100755
--- a/scripts/util/add_macro.php
+++ b/scripts/util/add_macro.php
@@ -5,7 +5,7 @@
require_once $root.'/scripts/__init_script__.php';
$args = new PhutilArgumentParser($argv);
-$args->setTagline('load files as image macros');
+$args->setTagline(pht('load files as image macros'));
$args->setSynopsis(<< 'as',
'param' => 'name',
- 'help' => 'Use a specific name instead of the first part of the image '.
- 'name.',
+ 'help' => pht(
+ 'Use a specific name instead of the first part of the image name.'),
),
array(
'name' => 'more',
@@ -45,7 +45,7 @@
'name = %s',
$name);
if ($existing) {
- throw new Exception("A macro already exists with the name '{$name}'!");
+ throw new Exception(pht("A macro already exists with the name '%s'!", $name));
}
$file = PhabricatorFile::newFromFileData(
@@ -62,4 +62,4 @@
$id = $file->getID();
-echo "Added macro '{$name}' (F{$id}).\n";
+echo pht("Added macro '%s' (%s).", $name, "F{$id}")."\n";
diff --git a/scripts/util/emit_test_event.php b/scripts/util/emit_test_event.php
index 500e8390e4..c8502d0fe6 100755
--- a/scripts/util/emit_test_event.php
+++ b/scripts/util/emit_test_event.php
@@ -5,7 +5,7 @@
require_once $root.'/scripts/__init_script__.php';
$args = new PhutilArgumentParser($argv);
-$args->setTagline('emit a test event');
+$args->setTagline(pht('emit a test event'));
$args->setSynopsis(<<getArg('listen') as $listener) {
- $console->writeOut("Installing '%s'...\n", $listener);
+ $console->writeOut("%s\n", pht("Installing '%s'...", $listener));
newv($listener, array())->register();
}
-$console->writeOut("Emitting event...\n");
+$console->writeOut("%s\n", pht('Emitting event...'));
PhutilEventEngine::dispatchEvent(
new PhabricatorEvent(
@@ -37,5 +37,5 @@
'time' => time(),
)));
-$console->writeOut("Done.\n");
+$console->writeOut("%s\n", pht('Done.'));
exit(0);
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
index cbc2e27de1..1b918a08b0 100644
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -374,6 +374,7 @@
'DifferentialGetWorkingCopy' => 'applications/differential/DifferentialGetWorkingCopy.php',
'DifferentialGitHubLandingStrategy' => 'applications/differential/landing/DifferentialGitHubLandingStrategy.php',
'DifferentialGitSVNIDField' => 'applications/differential/customfield/DifferentialGitSVNIDField.php',
+ 'DifferentialHiddenComment' => 'applications/differential/storage/DifferentialHiddenComment.php',
'DifferentialHostField' => 'applications/differential/customfield/DifferentialHostField.php',
'DifferentialHostedGitLandingStrategy' => 'applications/differential/landing/DifferentialHostedGitLandingStrategy.php',
'DifferentialHostedMercurialLandingStrategy' => 'applications/differential/landing/DifferentialHostedMercurialLandingStrategy.php',
@@ -461,7 +462,6 @@
'DifferentialUpdateRevisionConduitAPIMethod' => 'applications/differential/conduit/DifferentialUpdateRevisionConduitAPIMethod.php',
'DifferentialUpdateUnitResultsConduitAPIMethod' => 'applications/differential/conduit/DifferentialUpdateUnitResultsConduitAPIMethod.php',
'DifferentialViewPolicyField' => 'applications/differential/customfield/DifferentialViewPolicyField.php',
- 'DiffusionArcanistProjectDatasource' => 'applications/diffusion/typeahead/DiffusionArcanistProjectDatasource.php',
'DiffusionAuditorDatasource' => 'applications/diffusion/typeahead/DiffusionAuditorDatasource.php',
'DiffusionBranchQueryConduitAPIMethod' => 'applications/diffusion/conduit/DiffusionBranchQueryConduitAPIMethod.php',
'DiffusionBranchTableController' => 'applications/diffusion/controller/DiffusionBranchTableController.php',
@@ -596,6 +596,7 @@
'DiffusionRepositoryEditEncodingController' => 'applications/diffusion/controller/DiffusionRepositoryEditEncodingController.php',
'DiffusionRepositoryEditHostingController' => 'applications/diffusion/controller/DiffusionRepositoryEditHostingController.php',
'DiffusionRepositoryEditMainController' => 'applications/diffusion/controller/DiffusionRepositoryEditMainController.php',
+ 'DiffusionRepositoryEditStagingController' => 'applications/diffusion/controller/DiffusionRepositoryEditStagingController.php',
'DiffusionRepositoryEditStorageController' => 'applications/diffusion/controller/DiffusionRepositoryEditStorageController.php',
'DiffusionRepositoryEditSubversionController' => 'applications/diffusion/controller/DiffusionRepositoryEditSubversionController.php',
'DiffusionRepositoryEditUpdateController' => 'applications/diffusion/controller/DiffusionRepositoryEditUpdateController.php',
@@ -1178,6 +1179,7 @@
'PHUIDiffInlineCommentUndoView' => 'infrastructure/diff/view/PHUIDiffInlineCommentUndoView.php',
'PHUIDiffInlineCommentView' => 'infrastructure/diff/view/PHUIDiffInlineCommentView.php',
'PHUIDiffOneUpInlineCommentRowScaffold' => 'infrastructure/diff/view/PHUIDiffOneUpInlineCommentRowScaffold.php',
+ 'PHUIDiffRevealIconView' => 'infrastructure/diff/view/PHUIDiffRevealIconView.php',
'PHUIDiffTwoUpInlineCommentRowScaffold' => 'infrastructure/diff/view/PHUIDiffTwoUpInlineCommentRowScaffold.php',
'PHUIDocumentExample' => 'applications/uiexample/examples/PHUIDocumentExample.php',
'PHUIDocumentView' => 'view/phui/PHUIDocumentView.php',
@@ -1228,10 +1230,6 @@
'PHUITypeaheadExample' => 'applications/uiexample/examples/PHUITypeaheadExample.php',
'PHUIWorkboardView' => 'view/phui/PHUIWorkboardView.php',
'PHUIWorkpanelView' => 'view/phui/PHUIWorkpanelView.php',
- 'PackageCreateMail' => 'applications/owners/mail/PackageCreateMail.php',
- 'PackageDeleteMail' => 'applications/owners/mail/PackageDeleteMail.php',
- 'PackageMail' => 'applications/owners/mail/PackageMail.php',
- 'PackageModifyMail' => 'applications/owners/mail/PackageModifyMail.php',
'PassphraseAbstractKey' => 'applications/passphrase/keys/PassphraseAbstractKey.php',
'PassphraseConduitAPIMethod' => 'applications/passphrase/conduit/PassphraseConduitAPIMethod.php',
'PassphraseController' => 'applications/passphrase/controller/PassphraseController.php',
@@ -1498,6 +1496,7 @@
'PhabricatorCalendarEvent' => 'applications/calendar/storage/PhabricatorCalendarEvent.php',
'PhabricatorCalendarEventCancelController' => 'applications/calendar/controller/PhabricatorCalendarEventCancelController.php',
'PhabricatorCalendarEventCommentController' => 'applications/calendar/controller/PhabricatorCalendarEventCommentController.php',
+ 'PhabricatorCalendarEventDragController' => 'applications/calendar/controller/PhabricatorCalendarEventDragController.php',
'PhabricatorCalendarEventEditController' => 'applications/calendar/controller/PhabricatorCalendarEventEditController.php',
'PhabricatorCalendarEventEditIconController' => 'applications/calendar/controller/PhabricatorCalendarEventEditIconController.php',
'PhabricatorCalendarEventEditor' => 'applications/calendar/editor/PhabricatorCalendarEventEditor.php',
@@ -1540,6 +1539,8 @@
'PhabricatorClusterConfigOptions' => 'applications/config/option/PhabricatorClusterConfigOptions.php',
'PhabricatorCommitBranchesField' => 'applications/repository/customfield/PhabricatorCommitBranchesField.php',
'PhabricatorCommitCustomField' => 'applications/repository/customfield/PhabricatorCommitCustomField.php',
+ 'PhabricatorCommitMergedCommitsField' => 'applications/repository/customfield/PhabricatorCommitMergedCommitsField.php',
+ 'PhabricatorCommitRepositoryField' => 'applications/repository/customfield/PhabricatorCommitRepositoryField.php',
'PhabricatorCommitSearchEngine' => 'applications/audit/query/PhabricatorCommitSearchEngine.php',
'PhabricatorCommitTagsField' => 'applications/repository/customfield/PhabricatorCommitTagsField.php',
'PhabricatorCommonPasswords' => 'applications/auth/constants/PhabricatorCommonPasswords.php',
@@ -2162,19 +2163,21 @@
'PhabricatorOwnersConfigOptions' => 'applications/owners/config/PhabricatorOwnersConfigOptions.php',
'PhabricatorOwnersController' => 'applications/owners/controller/PhabricatorOwnersController.php',
'PhabricatorOwnersDAO' => 'applications/owners/storage/PhabricatorOwnersDAO.php',
- 'PhabricatorOwnersDeleteController' => 'applications/owners/controller/PhabricatorOwnersDeleteController.php',
'PhabricatorOwnersDetailController' => 'applications/owners/controller/PhabricatorOwnersDetailController.php',
'PhabricatorOwnersEditController' => 'applications/owners/controller/PhabricatorOwnersEditController.php',
'PhabricatorOwnersListController' => 'applications/owners/controller/PhabricatorOwnersListController.php',
'PhabricatorOwnersOwner' => 'applications/owners/storage/PhabricatorOwnersOwner.php',
'PhabricatorOwnersPackage' => 'applications/owners/storage/PhabricatorOwnersPackage.php',
'PhabricatorOwnersPackageDatasource' => 'applications/owners/typeahead/PhabricatorOwnersPackageDatasource.php',
- 'PhabricatorOwnersPackageEditor' => 'applications/owners/editor/PhabricatorOwnersPackageEditor.php',
'PhabricatorOwnersPackagePHIDType' => 'applications/owners/phid/PhabricatorOwnersPackagePHIDType.php',
- 'PhabricatorOwnersPackagePathValidator' => 'applications/repository/worker/commitchangeparser/PhabricatorOwnersPackagePathValidator.php',
'PhabricatorOwnersPackageQuery' => 'applications/owners/query/PhabricatorOwnersPackageQuery.php',
+ 'PhabricatorOwnersPackageSearchEngine' => 'applications/owners/query/PhabricatorOwnersPackageSearchEngine.php',
'PhabricatorOwnersPackageTestCase' => 'applications/owners/storage/__tests__/PhabricatorOwnersPackageTestCase.php',
+ 'PhabricatorOwnersPackageTransaction' => 'applications/owners/storage/PhabricatorOwnersPackageTransaction.php',
+ 'PhabricatorOwnersPackageTransactionEditor' => 'applications/owners/editor/PhabricatorOwnersPackageTransactionEditor.php',
+ 'PhabricatorOwnersPackageTransactionQuery' => 'applications/owners/query/PhabricatorOwnersPackageTransactionQuery.php',
'PhabricatorOwnersPath' => 'applications/owners/storage/PhabricatorOwnersPath.php',
+ 'PhabricatorOwnersPathsController' => 'applications/owners/controller/PhabricatorOwnersPathsController.php',
'PhabricatorPHDConfigOptions' => 'applications/config/option/PhabricatorPHDConfigOptions.php',
'PhabricatorPHID' => 'applications/phid/storage/PhabricatorPHID.php',
'PhabricatorPHIDConstants' => 'applications/phid/PhabricatorPHIDConstants.php',
@@ -2385,8 +2388,6 @@
'PhabricatorRepositoriesSetupCheck' => 'applications/config/check/PhabricatorRepositoriesSetupCheck.php',
'PhabricatorRepository' => 'applications/repository/storage/PhabricatorRepository.php',
'PhabricatorRepositoryArcanistProject' => 'applications/repository/storage/PhabricatorRepositoryArcanistProject.php',
- 'PhabricatorRepositoryArcanistProjectDeleteController' => 'applications/repository/controller/PhabricatorRepositoryArcanistProjectDeleteController.php',
- 'PhabricatorRepositoryArcanistProjectEditController' => 'applications/repository/controller/PhabricatorRepositoryArcanistProjectEditController.php',
'PhabricatorRepositoryArcanistProjectPHIDType' => 'applications/repository/phid/PhabricatorRepositoryArcanistProjectPHIDType.php',
'PhabricatorRepositoryArcanistProjectQuery' => 'applications/repository/query/PhabricatorRepositoryArcanistProjectQuery.php',
'PhabricatorRepositoryAuditRequest' => 'applications/repository/storage/PhabricatorRepositoryAuditRequest.php',
@@ -3148,7 +3149,6 @@
'ReleephProductTransactionQuery' => 'applications/releeph/query/ReleephProductTransactionQuery.php',
'ReleephProductViewController' => 'applications/releeph/controller/product/ReleephProductViewController.php',
'ReleephProject' => 'applications/releeph/storage/ReleephProject.php',
- 'ReleephProjectInfoConduitAPIMethod' => 'applications/releeph/conduit/ReleephProjectInfoConduitAPIMethod.php',
'ReleephQueryBranchesConduitAPIMethod' => 'applications/releeph/conduit/ReleephQueryBranchesConduitAPIMethod.php',
'ReleephQueryProductsConduitAPIMethod' => 'applications/releeph/conduit/ReleephQueryProductsConduitAPIMethod.php',
'ReleephQueryRequestsConduitAPIMethod' => 'applications/releeph/conduit/ReleephQueryRequestsConduitAPIMethod.php',
@@ -3616,6 +3616,7 @@
'DifferentialGetRevisionConduitAPIMethod' => 'DifferentialConduitAPIMethod',
'DifferentialGitHubLandingStrategy' => 'DifferentialLandingStrategy',
'DifferentialGitSVNIDField' => 'DifferentialCustomField',
+ 'DifferentialHiddenComment' => 'DifferentialDAO',
'DifferentialHostField' => 'DifferentialCustomField',
'DifferentialHostedGitLandingStrategy' => 'DifferentialLandingStrategy',
'DifferentialHostedMercurialLandingStrategy' => 'DifferentialLandingStrategy',
@@ -3708,7 +3709,6 @@
'DifferentialUpdateRevisionConduitAPIMethod' => 'DifferentialConduitAPIMethod',
'DifferentialUpdateUnitResultsConduitAPIMethod' => 'DifferentialConduitAPIMethod',
'DifferentialViewPolicyField' => 'DifferentialCoreCustomField',
- 'DiffusionArcanistProjectDatasource' => 'PhabricatorTypeaheadDatasource',
'DiffusionAuditorDatasource' => 'PhabricatorTypeaheadCompositeDatasource',
'DiffusionBranchQueryConduitAPIMethod' => 'DiffusionQueryConduitAPIMethod',
'DiffusionBranchTableController' => 'DiffusionController',
@@ -3833,6 +3833,7 @@
'DiffusionRepositoryEditEncodingController' => 'DiffusionRepositoryEditController',
'DiffusionRepositoryEditHostingController' => 'DiffusionRepositoryEditController',
'DiffusionRepositoryEditMainController' => 'DiffusionRepositoryEditController',
+ 'DiffusionRepositoryEditStagingController' => 'DiffusionRepositoryEditController',
'DiffusionRepositoryEditStorageController' => 'DiffusionRepositoryEditController',
'DiffusionRepositoryEditSubversionController' => 'DiffusionRepositoryEditController',
'DiffusionRepositoryEditUpdateController' => 'DiffusionRepositoryEditController',
@@ -4506,6 +4507,7 @@
'PHUIDiffInlineCommentUndoView' => 'PHUIDiffInlineCommentView',
'PHUIDiffInlineCommentView' => 'AphrontView',
'PHUIDiffOneUpInlineCommentRowScaffold' => 'PHUIDiffInlineCommentRowScaffold',
+ 'PHUIDiffRevealIconView' => 'AphrontView',
'PHUIDiffTwoUpInlineCommentRowScaffold' => 'PHUIDiffInlineCommentRowScaffold',
'PHUIDocumentExample' => 'PhabricatorUIExample',
'PHUIDocumentView' => 'AphrontTagView',
@@ -4556,10 +4558,6 @@
'PHUITypeaheadExample' => 'PhabricatorUIExample',
'PHUIWorkboardView' => 'AphrontTagView',
'PHUIWorkpanelView' => 'AphrontTagView',
- 'PackageCreateMail' => 'PackageMail',
- 'PackageDeleteMail' => 'PackageMail',
- 'PackageMail' => 'PhabricatorMail',
- 'PackageModifyMail' => 'PackageMail',
'PassphraseAbstractKey' => 'Phobject',
'PassphraseConduitAPIMethod' => 'ConduitAPIMethod',
'PassphraseController' => 'PhabricatorController',
@@ -4853,6 +4851,7 @@
),
'PhabricatorCalendarEventCancelController' => 'PhabricatorCalendarController',
'PhabricatorCalendarEventCommentController' => 'PhabricatorCalendarController',
+ 'PhabricatorCalendarEventDragController' => 'PhabricatorCalendarController',
'PhabricatorCalendarEventEditController' => 'PhabricatorCalendarController',
'PhabricatorCalendarEventEditIconController' => 'PhabricatorCalendarController',
'PhabricatorCalendarEventEditor' => 'PhabricatorApplicationTransactionEditor',
@@ -4904,6 +4903,8 @@
'PhabricatorClusterConfigOptions' => 'PhabricatorApplicationConfigOptions',
'PhabricatorCommitBranchesField' => 'PhabricatorCommitCustomField',
'PhabricatorCommitCustomField' => 'PhabricatorCustomField',
+ 'PhabricatorCommitMergedCommitsField' => 'PhabricatorCommitCustomField',
+ 'PhabricatorCommitRepositoryField' => 'PhabricatorCommitCustomField',
'PhabricatorCommitSearchEngine' => 'PhabricatorApplicationSearchEngine',
'PhabricatorCommitTagsField' => 'PhabricatorCommitCustomField',
'PhabricatorCommonPasswords' => 'Phobject',
@@ -5564,7 +5565,6 @@
'PhabricatorOwnersConfigOptions' => 'PhabricatorApplicationConfigOptions',
'PhabricatorOwnersController' => 'PhabricatorController',
'PhabricatorOwnersDAO' => 'PhabricatorLiskDAO',
- 'PhabricatorOwnersDeleteController' => 'PhabricatorOwnersController',
'PhabricatorOwnersDetailController' => 'PhabricatorOwnersController',
'PhabricatorOwnersEditController' => 'PhabricatorOwnersController',
'PhabricatorOwnersListController' => 'PhabricatorOwnersController',
@@ -5572,13 +5572,18 @@
'PhabricatorOwnersPackage' => array(
'PhabricatorOwnersDAO',
'PhabricatorPolicyInterface',
+ 'PhabricatorApplicationTransactionInterface',
),
'PhabricatorOwnersPackageDatasource' => 'PhabricatorTypeaheadDatasource',
- 'PhabricatorOwnersPackageEditor' => 'PhabricatorEditor',
'PhabricatorOwnersPackagePHIDType' => 'PhabricatorPHIDType',
'PhabricatorOwnersPackageQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
+ 'PhabricatorOwnersPackageSearchEngine' => 'PhabricatorApplicationSearchEngine',
'PhabricatorOwnersPackageTestCase' => 'PhabricatorTestCase',
+ 'PhabricatorOwnersPackageTransaction' => 'PhabricatorApplicationTransaction',
+ 'PhabricatorOwnersPackageTransactionEditor' => 'PhabricatorApplicationTransactionEditor',
+ 'PhabricatorOwnersPackageTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'PhabricatorOwnersPath' => 'PhabricatorOwnersDAO',
+ 'PhabricatorOwnersPathsController' => 'PhabricatorOwnersController',
'PhabricatorPHDConfigOptions' => 'PhabricatorApplicationConfigOptions',
'PhabricatorPHPASTApplication' => 'PhabricatorApplication',
'PhabricatorPHPConfigSetupCheck' => 'PhabricatorSetupCheck',
@@ -5829,8 +5834,6 @@
'PhabricatorPolicyInterface',
'PhabricatorDestructibleInterface',
),
- 'PhabricatorRepositoryArcanistProjectDeleteController' => 'PhabricatorRepositoryController',
- 'PhabricatorRepositoryArcanistProjectEditController' => 'PhabricatorRepositoryController',
'PhabricatorRepositoryArcanistProjectPHIDType' => 'PhabricatorPHIDType',
'PhabricatorRepositoryArcanistProjectQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhabricatorRepositoryAuditRequest' => array(
@@ -6728,7 +6731,6 @@
'PhabricatorApplicationTransactionInterface',
'PhabricatorPolicyInterface',
),
- 'ReleephProjectInfoConduitAPIMethod' => 'ReleephConduitAPIMethod',
'ReleephQueryBranchesConduitAPIMethod' => 'ReleephConduitAPIMethod',
'ReleephQueryProductsConduitAPIMethod' => 'ReleephConduitAPIMethod',
'ReleephQueryRequestsConduitAPIMethod' => 'ReleephConduitAPIMethod',
diff --git a/src/__tests__/PhabricatorCelerityTestCase.php b/src/__tests__/PhabricatorCelerityTestCase.php
index 957664f009..a91b214502 100644
--- a/src/__tests__/PhabricatorCelerityTestCase.php
+++ b/src/__tests__/PhabricatorCelerityTestCase.php
@@ -28,7 +28,8 @@ public function testCelerityMaps() {
$maps_are_identical,
pht(
'When this test fails, it means the Celerity resource map is out '.
- 'of date. Run `bin/celerity map` to rebuild it.'));
+ 'of date. Run `%s` to rebuild it.',
+ 'bin/celerity map'));
}
}
diff --git a/src/__tests__/PhabricatorInfrastructureTestCase.php b/src/__tests__/PhabricatorInfrastructureTestCase.php
index 896a506ed3..19d034eb34 100644
--- a/src/__tests__/PhabricatorInfrastructureTestCase.php
+++ b/src/__tests__/PhabricatorInfrastructureTestCase.php
@@ -15,7 +15,7 @@ public function testApplicationsInstalled() {
$this->assertEqual(
count($all),
count($installed),
- 'In test cases, all applications should default to installed.');
+ pht('In test cases, all applications should default to installed.'));
}
public function testRejectMySQLNonUTF8Queries() {
diff --git a/src/aphront/AphrontRequest.php b/src/aphront/AphrontRequest.php
index 4aa52c1fcb..f4a1ee2cff 100644
--- a/src/aphront/AphrontRequest.php
+++ b/src/aphront/AphrontRequest.php
@@ -249,21 +249,24 @@ public function validateCSRF() {
// in developer mode.
if (PhabricatorEnv::getEnvConfig('phabricator.developer-mode')) {
// TODO: Clean this up, see T1921.
- $more_info[] =
- "To avoid this error, use phabricator_form() to construct forms. ".
- "If you are already using phabricator_form(), make sure the form ".
- "'action' uses a relative URI (i.e., begins with a '/'). Forms ".
- "using absolute URIs do not include CSRF tokens, to prevent ".
- "leaking tokens to external sites.\n\n".
- "If this page performs writes which do not require CSRF ".
- "protection (usually, filling caches or logging), you can use ".
- "AphrontWriteGuard::beginScopedUnguardedWrites() to temporarily ".
- "bypass CSRF protection while writing. You should use this only ".
- "for writes which can not be protected with normal CSRF ".
+ $more_info[] = pht(
+ "To avoid this error, use %s to construct forms. If you are already ".
+ "using %s, make sure the form 'action' uses a relative URI (i.e., ".
+ "begins with a '%s'). Forms using absolute URIs do not include CSRF ".
+ "tokens, to prevent leaking tokens to external sites.\n\n".
+ "If this page performs writes which do not require CSRF protection ".
+ "(usually, filling caches or logging), you can use %s to ".
+ "temporarily bypass CSRF protection while writing. You should use ".
+ "this only for writes which can not be protected with normal CSRF ".
"mechanisms.\n\n".
- "Some UI elements (like PhabricatorActionListView) also have ".
- "methods which will allow you to render links as forms (like ".
- "setRenderAsForm(true)).";
+ "Some UI elements (like %s) also have methods which will allow you ".
+ "to render links as forms (like %s).",
+ 'phabricator_form()',
+ 'phabricator_form()',
+ '/',
+ 'AphrontWriteGuard::beginScopedUnguardedWrites()',
+ 'PhabricatorActionListView',
+ 'setRenderAsForm(true)');
}
// This should only be able to happen if you load a form, pull your
@@ -272,10 +275,10 @@ public function validateCSRF() {
// is incredibly confusing otherwise.
throw new AphrontCSRFException(
pht(
- "You are trying to save some data to Phabricator, but the request ".
- "your browser made included an incorrect token. Reload the page ".
- "and try again. You may need to clear your cookies.\n\n%s",
- implode("\n", $more_info)));
+ 'You are trying to save some data to Phabricator, but the request '.
+ 'your browser made included an incorrect token. Reload the page '.
+ 'and try again. You may need to clear your cookies.')."\n\n".
+ implode("\n", $more_info));
}
return true;
diff --git a/src/aphront/__tests__/AphrontRequestTestCase.php b/src/aphront/__tests__/AphrontRequestTestCase.php
index 151343ef0b..88fe97761f 100644
--- a/src/aphront/__tests__/AphrontRequestTestCase.php
+++ b/src/aphront/__tests__/AphrontRequestTestCase.php
@@ -75,7 +75,7 @@ public function testHostAttacks() {
$this->assertEqual(
$expect,
$r->getHost(),
- 'Host: '.$input);
+ pht('Host: %s', $input));
}
}
diff --git a/src/aphront/configuration/AphrontApplicationConfiguration.php b/src/aphront/configuration/AphrontApplicationConfiguration.php
index d828b9a8ce..a3821f18b5 100644
--- a/src/aphront/configuration/AphrontApplicationConfiguration.php
+++ b/src/aphront/configuration/AphrontApplicationConfiguration.php
@@ -328,13 +328,14 @@ final public function buildController() {
// test) so it's fine that we don't have SERVER_ADDR defined.
} else {
throw new AphrontUsageException(
- pht('No SERVER_ADDR'),
+ pht('No %s', 'SERVER_ADDR'),
pht(
'Phabricator is configured to operate in cluster mode, but '.
- 'SERVER_ADDR is not defined in the request context. Your '.
- 'webserver configuration needs to forward SERVER_ADDR to '.
- 'PHP so Phabricator can reject requests received on '.
- 'external interfaces.'));
+ '%s is not defined in the request context. Your webserver '.
+ 'configuration needs to forward %s to PHP so Phabricator can '.
+ 'reject requests received on external interfaces.',
+ 'SERVER_ADDR',
+ 'SERVER_ADDR'));
}
} else {
if (!PhabricatorEnv::isClusterAddress($server_addr)) {
@@ -413,20 +414,23 @@ final public function buildController() {
->executeOne();
} catch (PhabricatorPolicyException $ex) {
throw new Exception(
- 'This blog is not visible to logged out users, so it can not be '.
- 'visited from a custom domain.');
+ pht(
+ 'This blog is not visible to logged out users, so it can not be '.
+ 'visited from a custom domain.'));
}
if (!$blog) {
if ($prod_uri && $prod_uri != $base_uri) {
- $prod_str = ' or '.$prod_uri;
+ $prod_str = pht('%s or %s', $base_uri, $prod_uri);
} else {
- $prod_str = '';
+ $prod_str = $base_uri;
}
throw new Exception(
- 'Specified domain '.$host.' is not configured for Phabricator '.
- 'requests. Please use '.$base_uri.$prod_str.' to visit this instance.'
- );
+ pht(
+ 'Specified domain %s is not configured for Phabricator '.
+ 'requests. Please use %s to visit this instance.',
+ $host,
+ $prod_str));
}
// TODO: Make this more flexible and modular so any application can
diff --git a/src/aphront/configuration/AphrontDefaultApplicationConfiguration.php b/src/aphront/configuration/AphrontDefaultApplicationConfiguration.php
index 063ee365d6..3d5bfffd2d 100644
--- a/src/aphront/configuration/AphrontDefaultApplicationConfiguration.php
+++ b/src/aphront/configuration/AphrontDefaultApplicationConfiguration.php
@@ -229,11 +229,10 @@ public function handleException(Exception $ex) {
$message = $ex->getMessage();
if ($ex instanceof AphrontSchemaQueryException) {
- $message .=
- "\n\n".
+ $message .= "\n\n".pht(
"NOTE: This usually indicates that the MySQL schema has not been ".
- "properly upgraded. Run 'bin/storage upgrade' to ensure your ".
- "schema is up to date.";
+ "properly upgraded. Run '%s' to ensure your schema is up to date.",
+ 'bin/storage upgrade');
}
if (PhabricatorEnv::getEnvConfig('phabricator.developer-mode')) {
@@ -254,13 +253,13 @@ public function handleException(Exception $ex) {
$dialog = new AphrontDialogView();
$dialog
- ->setTitle('Unhandled Exception ("'.$class.'")')
+ ->setTitle(pht('Unhandled Exception ("%s")', $class))
->setClass('aphront-exception-dialog')
->setUser($user)
->appendChild($content);
if ($this->getRequest()->isAjax()) {
- $dialog->addCancelButton('/', 'Close');
+ $dialog->addCancelButton('/', pht('Close'));
}
$response = new AphrontDialogResponse();
diff --git a/src/aphront/response/Aphront404Response.php b/src/aphront/response/Aphront404Response.php
index 85dec30555..1284cb62e6 100644
--- a/src/aphront/response/Aphront404Response.php
+++ b/src/aphront/response/Aphront404Response.php
@@ -14,12 +14,13 @@ public function buildResponseString() {
->setUser($user)
->setTitle(pht('404 Not Found'))
->addCancelButton('/', pht('Focus'))
- ->appendParagraph(pht(
- 'Do not dwell in the past, do not dream of the future, '.
- 'concentrate the mind on the present moment.'));
+ ->appendParagraph(
+ pht(
+ 'Do not dwell in the past, do not dream of the future, '.
+ 'concentrate the mind on the present moment.'));
$view = id(new PhabricatorStandardPageView())
- ->setTitle('404 Not Found')
+ ->setTitle(pht('404 Not Found'))
->setRequest($request)
->setDeviceReady(true)
->appendChild($dialog);
diff --git a/src/aphront/sink/AphrontHTTPSink.php b/src/aphront/sink/AphrontHTTPSink.php
index 72bf4244f9..6ed2edff9c 100644
--- a/src/aphront/sink/AphrontHTTPSink.php
+++ b/src/aphront/sink/AphrontHTTPSink.php
@@ -25,7 +25,7 @@ abstract class AphrontHTTPSink {
*/
final public function writeHTTPStatus($code, $message = '') {
if (!preg_match('/^\d{3}$/', $code)) {
- throw new Exception("Malformed HTTP status code '{$code}'!");
+ throw new Exception(pht("Malformed HTTP status code '%s'!", $code));
}
$code = (int)$code;
@@ -42,14 +42,15 @@ final public function writeHTTPStatus($code, $message = '') {
final public function writeHeaders(array $headers) {
foreach ($headers as $header) {
if (!is_array($header) || count($header) !== 2) {
- throw new Exception('Malformed header.');
+ throw new Exception(pht('Malformed header.'));
}
list($name, $value) = $header;
if (strpos($name, ':') !== false) {
throw new Exception(
- 'Declining to emit response with malformed HTTP header name: '.
- $name);
+ pht(
+ 'Declining to emit response with malformed HTTP header name: %s',
+ $name));
}
// Attackers may perform an "HTTP response splitting" attack by making
@@ -64,8 +65,9 @@ final public function writeHeaders(array $headers) {
if (preg_match('/[\r\n\0]/', $name.$value)) {
throw new Exception(
- "Declining to emit response with unsafe HTTP header: ".
- "<'".$name."', '".$value."'>.");
+ pht(
+ 'Declining to emit response with unsafe HTTP header: %s',
+ "<'".$name."', '".$value."'>."));
}
}
diff --git a/src/applications/almanac/controller/AlmanacConsoleController.php b/src/applications/almanac/controller/AlmanacConsoleController.php
index 60fa4e010e..156bd14b78 100644
--- a/src/applications/almanac/controller/AlmanacConsoleController.php
+++ b/src/applications/almanac/controller/AlmanacConsoleController.php
@@ -18,27 +18,21 @@ public function handleRequest(AphrontRequest $request) {
->setHeader(pht('Services'))
->setHref($this->getApplicationURI('service/'))
->setFontIcon('fa-plug')
- ->addAttribute(
- pht(
- 'Manage Almanac services.')));
+ ->addAttribute(pht('Manage Almanac services.')));
$menu->addItem(
id(new PHUIObjectItemView())
->setHeader(pht('Devices'))
->setHref($this->getApplicationURI('device/'))
->setFontIcon('fa-server')
- ->addAttribute(
- pht(
- 'Manage Almanac devices.')));
+ ->addAttribute(pht('Manage Almanac devices.')));
$menu->addItem(
id(new PHUIObjectItemView())
->setHeader(pht('Networks'))
->setHref($this->getApplicationURI('network/'))
->setFontIcon('fa-globe')
- ->addAttribute(
- pht(
- 'Manage Almanac networks.')));
+ ->addAttribute(pht('Manage Almanac networks.')));
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Console'));
diff --git a/src/applications/almanac/controller/AlmanacServiceEditController.php b/src/applications/almanac/controller/AlmanacServiceEditController.php
index 13f31430e7..be3fe02009 100644
--- a/src/applications/almanac/controller/AlmanacServiceEditController.php
+++ b/src/applications/almanac/controller/AlmanacServiceEditController.php
@@ -250,8 +250,4 @@ private function buildServiceTypeResponse(array $service_types, $cancel_uri) {
));
}
-
-
-
-
}
diff --git a/src/applications/aphlict/management/PhabricatorAphlictManagementStatusWorkflow.php b/src/applications/aphlict/management/PhabricatorAphlictManagementStatusWorkflow.php
index 145a5fcff2..85f80bfad4 100644
--- a/src/applications/aphlict/management/PhabricatorAphlictManagementStatusWorkflow.php
+++ b/src/applications/aphlict/management/PhabricatorAphlictManagementStatusWorkflow.php
@@ -15,11 +15,11 @@ public function execute(PhutilArgumentParser $args) {
$pid = $this->getPID();
if (!$pid) {
- $console->writeErr(pht("Aphlict is not running.\n"));
+ $console->writeErr("%s\n", pht('Aphlict is not running.'));
return 1;
}
- $console->writeOut(pht("Aphlict (%s) is running.\n", $pid));
+ $console->writeOut("%s\n", pht('Aphlict (%s) is running.', $pid));
return 0;
}
diff --git a/src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php b/src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php
index 1c8d855a86..d5d751363b 100644
--- a/src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php
+++ b/src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php
@@ -97,8 +97,10 @@ public static function requireExtensions() {
private static function mustHaveExtension($ext) {
if (!extension_loaded($ext)) {
- echo "ERROR: The PHP extension '{$ext}' is not installed. You must ".
- "install it to run aphlict on this machine.\n";
+ echo pht(
+ "ERROR: The PHP extension '%s' is not installed. You must ".
+ "install it to run Aphlict on this machine.",
+ $ext)."\n";
exit(1);
}
@@ -106,8 +108,10 @@ private static function mustHaveExtension($ext) {
foreach ($extension->getFunctions() as $function) {
$function = $function->name;
if (!function_exists($function)) {
- echo "ERROR: The PHP function {$function}() is disabled. You must ".
- "enable it to run aphlict on this machine.\n";
+ echo pht(
+ 'ERROR: The PHP function %s is disabled. You must '.
+ 'enable it to run Aphlict on this machine.',
+ $function.'()')."\n";
exit(1);
}
}
@@ -121,7 +125,8 @@ final protected function willLaunch() {
throw new PhutilArgumentUsageException(
pht(
'Unable to start notifications server because it is already '.
- 'running. Use `aphlict restart` to restart it.'));
+ 'running. Use `%s` to restart it.',
+ 'aphlict restart'));
}
if (posix_getuid() == 0) {
@@ -195,7 +200,9 @@ final protected function launch() {
$console = PhutilConsole::getConsole();
if ($this->debug) {
- $console->writeOut(pht("Starting Aphlict server in foreground...\n"));
+ $console->writeOut(
+ "%s\n",
+ pht('Starting Aphlict server in foreground...'));
} else {
Filesystem::writeFile($this->getPIDPath(), getmypid());
}
@@ -214,10 +221,13 @@ final protected function launch() {
register_shutdown_function(array($this, 'cleanup'));
if ($this->debug) {
- $console->writeOut("Launching server:\n\n $ ".$command."\n\n");
+ $console->writeOut(
+ "%s\n\n $ %s\n\n",
+ pht('Launching server:'),
+ $command);
$err = phutil_passthru('%C', $command);
- $console->writeOut(">>> Server exited!\n");
+ $console->writeOut(">>> %s\n", pht('Server exited!'));
exit($err);
} else {
while (true) {
@@ -242,9 +252,12 @@ final protected function executeStartCommand() {
$pid = pcntl_fork();
if ($pid < 0) {
- throw new Exception('Failed to fork()!');
+ throw new Exception(
+ pht(
+ 'Failed to %s!',
+ 'fork()'));
} else if ($pid) {
- $console->writeErr(pht("Aphlict Server started.\n"));
+ $console->writeErr("%s\n", pht('Aphlict Server started.'));
exit(0);
}
@@ -267,11 +280,11 @@ final protected function executeStopCommand() {
$pid = $this->getPID();
if (!$pid) {
- $console->writeErr(pht("Aphlict is not running.\n"));
+ $console->writeErr("%s\n", pht('Aphlict is not running.'));
return 0;
}
- $console->writeErr(pht("Stopping Aphlict Server (%s)...\n", $pid));
+ $console->writeErr("%s\n", pht('Stopping Aphlict Server (%s)...', $pid));
posix_kill($pid, SIGINT);
$start = time();
@@ -287,7 +300,7 @@ final protected function executeStopCommand() {
} while (time() < $start + 5);
if ($pid) {
- $console->writeErr(pht('Sending %s a SIGKILL.', $pid)."\n");
+ $console->writeErr("%s\n", pht('Sending %s a SIGKILL.', $pid));
posix_kill($pid, SIGKILL);
unset($pid);
}
@@ -307,8 +320,11 @@ private function getNodeBinary() {
throw new PhutilArgumentUsageException(
pht(
- 'No `nodejs` or `node` binary was found in $PATH. You must install '.
- 'Node.js to start the Aphlict server.'));
+ 'No `%s` or `%s` binary was found in %s. You must install '.
+ 'Node.js to start the Aphlict server.',
+ 'nodejs',
+ 'node',
+ '$PATH'));
}
}
diff --git a/src/applications/aphlict/query/AphlictDropdownDataQuery.php b/src/applications/aphlict/query/AphlictDropdownDataQuery.php
index 91ce3ad41f..4f360f28cc 100644
--- a/src/applications/aphlict/query/AphlictDropdownDataQuery.php
+++ b/src/applications/aphlict/query/AphlictDropdownDataQuery.php
@@ -22,7 +22,7 @@ private function setNotificationData(array $data) {
public function getNotificationData() {
if ($this->notificationData === null) {
- throw new Exception('You must execute() first!');
+ throw new Exception(pht('You must %s first!', 'execute()'));
}
return $this->notificationData;
}
@@ -34,7 +34,7 @@ private function setConpherenceData(array $data) {
public function getConpherenceData() {
if ($this->conpherenceData === null) {
- throw new Exception('You must execute() first!');
+ throw new Exception(pht('You must %s first!', 'execute()'));
}
return $this->conpherenceData;
}
diff --git a/src/applications/arcanist/conduit/ArcanistProjectInfoConduitAPIMethod.php b/src/applications/arcanist/conduit/ArcanistProjectInfoConduitAPIMethod.php
index 677c4985aa..c89bcf7845 100644
--- a/src/applications/arcanist/conduit/ArcanistProjectInfoConduitAPIMethod.php
+++ b/src/applications/arcanist/conduit/ArcanistProjectInfoConduitAPIMethod.php
@@ -7,8 +7,12 @@ public function getAPIMethodName() {
return 'arcanist.projectinfo';
}
+ public function getMethodStatus() {
+ return self::METHOD_STATUS_DEPRECATED;
+ }
+
public function getMethodDescription() {
- return 'Get information about Arcanist projects.';
+ return pht('Arcanist projects are deprecated.');
}
protected function defineParamTypes() {
@@ -23,7 +27,7 @@ protected function defineReturnType() {
protected function defineErrorTypes() {
return array(
- 'ERR-BAD-ARCANIST-PROJECT' => 'No such project exists.',
+ 'ERR-BAD-ARCANIST-PROJECT' => pht('No such project exists.'),
);
}
diff --git a/src/applications/audit/conduit/AuditQueryConduitAPIMethod.php b/src/applications/audit/conduit/AuditQueryConduitAPIMethod.php
index d5a02810f8..2fc9ca47ee 100644
--- a/src/applications/audit/conduit/AuditQueryConduitAPIMethod.php
+++ b/src/applications/audit/conduit/AuditQueryConduitAPIMethod.php
@@ -7,7 +7,7 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return 'Query audit requests.';
+ return pht('Query audit requests.');
}
protected function defineParamTypes() {
diff --git a/src/applications/audit/constants/PhabricatorAuditActionConstants.php b/src/applications/audit/constants/PhabricatorAuditActionConstants.php
index 95dd8cdbf0..afecd0bf8f 100644
--- a/src/applications/audit/constants/PhabricatorAuditActionConstants.php
+++ b/src/applications/audit/constants/PhabricatorAuditActionConstants.php
@@ -14,12 +14,12 @@ final class PhabricatorAuditActionConstants {
public static function getActionNameMap() {
$map = array(
- self::COMMENT => pht('Comment'),
- self::CONCERN => pht("Raise Concern \xE2\x9C\x98"),
- self::ACCEPT => pht("Accept Commit \xE2\x9C\x94"),
- self::RESIGN => pht('Resign from Audit'),
- self::CLOSE => pht('Close Audit'),
- self::ADD_CCS => pht('Add CCs'),
+ self::COMMENT => pht('Comment'),
+ self::CONCERN => pht("Raise Concern \xE2\x9C\x98"),
+ self::ACCEPT => pht("Accept Commit \xE2\x9C\x94"),
+ self::RESIGN => pht('Resign from Audit'),
+ self::CLOSE => pht('Close Audit'),
+ self::ADD_CCS => pht('Add CCs'),
self::ADD_AUDITORS => pht('Add Auditors'),
);
@@ -28,20 +28,20 @@ public static function getActionNameMap() {
public static function getActionName($constant) {
$map = self::getActionNameMap();
- return idx($map, $constant, 'Unknown');
+ return idx($map, $constant, pht('Unknown'));
}
public static function getActionPastTenseVerb($action) {
- static $map = array(
- self::COMMENT => 'commented on',
- self::CONCERN => 'raised a concern with',
- self::ACCEPT => 'accepted',
- self::RESIGN => 'resigned from',
- self::CLOSE => 'closed',
- self::ADD_CCS => 'added CCs to',
- self::ADD_AUDITORS => 'added auditors to',
+ $map = array(
+ self::COMMENT => pht('commented on'),
+ self::CONCERN => pht('raised a concern with'),
+ self::ACCEPT => pht('accepted'),
+ self::RESIGN => pht('resigned from'),
+ self::CLOSE => pht('closed'),
+ self::ADD_CCS => pht('added CCs to'),
+ self::ADD_AUDITORS => pht('added auditors to'),
);
- return idx($map, $action, 'updated');
+ return idx($map, $action, pht('updated'));
}
}
diff --git a/src/applications/audit/constants/PhabricatorAuditCommitStatusConstants.php b/src/applications/audit/constants/PhabricatorAuditCommitStatusConstants.php
index aef3c7e224..1bc07aaa56 100644
--- a/src/applications/audit/constants/PhabricatorAuditCommitStatusConstants.php
+++ b/src/applications/audit/constants/PhabricatorAuditCommitStatusConstants.php
@@ -21,7 +21,7 @@ public static function getStatusNameMap() {
}
public static function getStatusName($code) {
- return idx(self::getStatusNameMap(), $code, 'Unknown');
+ return idx(self::getStatusNameMap(), $code, pht('Unknown'));
}
public static function getOpenStatusConstants() {
diff --git a/src/applications/audit/editor/PhabricatorAuditEditor.php b/src/applications/audit/editor/PhabricatorAuditEditor.php
index b2fd9d84b2..24bc342f05 100644
--- a/src/applications/audit/editor/PhabricatorAuditEditor.php
+++ b/src/applications/audit/editor/PhabricatorAuditEditor.php
@@ -28,7 +28,7 @@ private function getAuditReasons($phid) {
} else {
$name = $this->getActor()->getUsername();
}
- return array('Added by '.$name.'.');
+ return array(pht('Added by %s.', $name));
}
public function setRawPatch($patch) {
@@ -432,7 +432,7 @@ private function createAuditRequestTransactionFromCommitMessage(
}
foreach ($phids as $phid) {
- $this->addAuditReason($phid, 'Requested by Author');
+ $this->addAuditReason($phid, pht('Requested by Author'));
}
return id(new PhabricatorAuditTransaction())
->setTransactionType(PhabricatorAuditActionConstants::ADD_AUDITORS)
diff --git a/src/applications/audit/mail/PhabricatorAuditMailReceiver.php b/src/applications/audit/mail/PhabricatorAuditMailReceiver.php
index 2e0a2725ab..29b1748264 100644
--- a/src/applications/audit/mail/PhabricatorAuditMailReceiver.php
+++ b/src/applications/audit/mail/PhabricatorAuditMailReceiver.php
@@ -3,8 +3,8 @@
final class PhabricatorAuditMailReceiver extends PhabricatorObjectMailReceiver {
public function isEnabled() {
- $app_class = 'PhabricatorAuditApplication';
- return PhabricatorApplication::isClassInstalled($app_class);
+ return PhabricatorApplication::isClassInstalled(
+ 'PhabricatorAuditApplication');
}
protected function getObjectPattern() {
diff --git a/src/applications/audit/mail/PhabricatorAuditReplyHandler.php b/src/applications/audit/mail/PhabricatorAuditReplyHandler.php
index 6aafbd772a..c1eb562bfa 100644
--- a/src/applications/audit/mail/PhabricatorAuditReplyHandler.php
+++ b/src/applications/audit/mail/PhabricatorAuditReplyHandler.php
@@ -5,7 +5,10 @@ final class PhabricatorAuditReplyHandler
public function validateMailReceiver($mail_receiver) {
if (!($mail_receiver instanceof PhabricatorRepositoryCommit)) {
- throw new Exception('Mail receiver is not a commit!');
+ throw new Exception(
+ pht(
+ 'Mail receiver is not a %s!',
+ 'PhabricatorRepositoryCommit'));
}
}
diff --git a/src/applications/audit/management/PhabricatorAuditManagementDeleteWorkflow.php b/src/applications/audit/management/PhabricatorAuditManagementDeleteWorkflow.php
index 2d9438dd4e..fa9dbff635 100644
--- a/src/applications/audit/management/PhabricatorAuditManagementDeleteWorkflow.php
+++ b/src/applications/audit/management/PhabricatorAuditManagementDeleteWorkflow.php
@@ -7,51 +7,54 @@ protected function didConstruct() {
$this
->setName('delete')
->setExamples('**delete** [--dry-run] ...')
- ->setSynopsis('Delete audit requests matching parameters.')
+ ->setSynopsis(pht('Delete audit requests matching parameters.'))
->setArguments(
array(
array(
'name' => 'dry-run',
- 'help' => 'Show what would be deleted, but do not actually delete '.
- 'anything.',
+ 'help' => pht(
+ 'Show what would be deleted, but do not actually delete '.
+ 'anything.'),
),
array(
'name' => 'users',
'param' => 'names',
- 'help' => 'Select only audits by a given list of users.',
+ 'help' => pht('Select only audits by a given list of users.'),
),
array(
'name' => 'repositories',
'param' => 'repos',
- 'help' => 'Select only audits in a given list of repositories.',
+ 'help' => pht(
+ 'Select only audits in a given list of repositories.'),
),
array(
'name' => 'commits',
'param' => 'commits',
- 'help' => 'Select only audits for the given commits.',
+ 'help' => pht('Select only audits for the given commits.'),
),
array(
'name' => 'min-commit-date',
'param' => 'date',
- 'help' => 'Select only audits for commits on or after the given '.
- 'date.',
+ 'help' => pht(
+ 'Select only audits for commits on or after the given date.'),
),
array(
'name' => 'max-commit-date',
'param' => 'date',
- 'help' => 'Select only audits for commits on or before the given '.
- 'date.',
+ 'help' => pht(
+ 'Select only audits for commits on or before the given date.'),
),
array(
'name' => 'status',
'param' => 'status',
- 'help' => 'Select only audits in the given status. By default, '.
- 'only open audits are selected.',
+ 'help' => pht(
+ 'Select only audits in the given status. By default, '.
+ 'only open audits are selected.'),
),
array(
'name' => 'ids',
'param' => 'ids',
- 'help' => 'Select only audits with the given IDs.',
+ 'help' => pht('Select only audits with the given IDs.'),
),
));
}
@@ -72,7 +75,7 @@ public function execute(PhutilArgumentParser $args) {
$max_date = $this->loadDate($args->getArg('max-commit-date'));
if ($min_date && $max_date && ($min_date > $max_date)) {
throw new PhutilArgumentUsageException(
- 'Specified max date must come after specified min date.');
+ pht('Specified maximum date must come after specified minimum date.'));
}
$is_dry_run = $args->getArg('dry-run');
@@ -250,8 +253,9 @@ private function loadDate($date) {
if (!$epoch || $epoch < 1) {
throw new PhutilArgumentUsageException(
pht(
- 'Unable to parse date "%s". Use a format like "2000-01-01".',
- $date));
+ 'Unable to parse date "%s". Use a format like "%s".',
+ $date,
+ '2000-01-01'));
}
return $epoch;
diff --git a/src/applications/audit/storage/PhabricatorAuditInlineComment.php b/src/applications/audit/storage/PhabricatorAuditInlineComment.php
index 292e0274a5..8779b5ffdd 100644
--- a/src/applications/audit/storage/PhabricatorAuditInlineComment.php
+++ b/src/applications/audit/storage/PhabricatorAuditInlineComment.php
@@ -23,6 +23,14 @@ public function getTransactionComment() {
return $this->proxy;
}
+ public function supportsHiding() {
+ return false;
+ }
+
+ public function isHidden() {
+ return false;
+ }
+
public function getTransactionCommentForSave() {
$content_source = PhabricatorContentSource::newForSource(
PhabricatorContentSource::SOURCE_LEGACY,
diff --git a/src/applications/audit/view/PhabricatorAuditListView.php b/src/applications/audit/view/PhabricatorAuditListView.php
index 96844c5b48..75aa58db53 100644
--- a/src/applications/audit/view/PhabricatorAuditListView.php
+++ b/src/applications/audit/view/PhabricatorAuditListView.php
@@ -59,7 +59,7 @@ public function getRequiredHandlePHIDs() {
private function getHandle($phid) {
$handle = idx($this->handles, $phid);
if (!$handle) {
- throw new Exception("No handle for '{$phid}'!");
+ throw new Exception(pht("No handle for '%s'!", $phid));
}
return $handle;
}
@@ -98,7 +98,11 @@ public function render() {
public function buildList() {
$user = $this->getUser();
if (!$user) {
- throw new Exception('you must setUser() before buildList()!');
+ throw new Exception(
+ pht(
+ 'You must %s before %s!',
+ 'setUser()',
+ __FUNCTION__.'()'));
}
$rowc = array();
diff --git a/src/applications/audit/view/PhabricatorAuditTransactionView.php b/src/applications/audit/view/PhabricatorAuditTransactionView.php
index 64a2892ffd..305ea19c56 100644
--- a/src/applications/audit/view/PhabricatorAuditTransactionView.php
+++ b/src/applications/audit/view/PhabricatorAuditTransactionView.php
@@ -72,7 +72,7 @@ protected function renderTransactionContent(
$inlines[] = $xaction;
break;
default:
- throw new Exception('Unknown grouped transaction type!');
+ throw new Exception(pht('Unknown grouped transaction type!'));
}
}
diff --git a/src/applications/auth/conduit/PhabricatorAuthConduitAPIMethod.php b/src/applications/auth/conduit/PhabricatorAuthConduitAPIMethod.php
index 07d2a4b157..34bedec0bc 100644
--- a/src/applications/auth/conduit/PhabricatorAuthConduitAPIMethod.php
+++ b/src/applications/auth/conduit/PhabricatorAuthConduitAPIMethod.php
@@ -3,8 +3,7 @@
abstract class PhabricatorAuthConduitAPIMethod extends ConduitAPIMethod {
final public function getApplication() {
- return PhabricatorApplication::getByClass(
- 'PhabricatorAuthApplication');
+ return PhabricatorApplication::getByClass('PhabricatorAuthApplication');
}
public function getMethodStatus() {
@@ -12,8 +11,7 @@ public function getMethodStatus() {
}
public function getMethodStatusDescription() {
- return pht(
- 'These methods are recently introduced and subject to change.');
+ return pht('These methods are recently introduced and subject to change.');
}
}
diff --git a/src/applications/auth/controller/PhabricatorAuthLoginController.php b/src/applications/auth/controller/PhabricatorAuthLoginController.php
index f00eff32c5..e3cbeaa2c6 100644
--- a/src/applications/auth/controller/PhabricatorAuthLoginController.php
+++ b/src/applications/auth/controller/PhabricatorAuthLoginController.php
@@ -68,7 +68,9 @@ public function processRequest() {
if (!$account) {
throw new Exception(
- 'Auth provider failed to load an account from processLoginRequest()!');
+ pht(
+ 'Auth provider failed to load an account from %s!',
+ 'processLoginRequest()'));
}
if ($account->getUserPHID()) {
@@ -164,7 +166,7 @@ private function setAccountKeyAndContinue(
$next_uri) {
if ($account->getUserPHID()) {
- throw new Exception('Account is already registered or linked.');
+ throw new Exception(pht('Account is already registered or linked.'));
}
// Regenerate the registration secret key, set it on the external account,
diff --git a/src/applications/auth/controller/PhabricatorAuthNeedsMultiFactorController.php b/src/applications/auth/controller/PhabricatorAuthNeedsMultiFactorController.php
index 57516ac6b6..975355ec97 100644
--- a/src/applications/auth/controller/PhabricatorAuthNeedsMultiFactorController.php
+++ b/src/applications/auth/controller/PhabricatorAuthNeedsMultiFactorController.php
@@ -40,7 +40,7 @@ public function processRequest() {
pht(
'Multi-factor authentication helps secure your account by '.
'making it more difficult for attackers to gain access or '.
- 'take senstive actions.'),
+ 'take sensitive actions.'),
pht(
'To learn more about multi-factor authentication, click the '.
'%s button below.',
diff --git a/src/applications/auth/controller/PhabricatorAuthRegisterController.php b/src/applications/auth/controller/PhabricatorAuthRegisterController.php
index d27a644480..9341345143 100644
--- a/src/applications/auth/controller/PhabricatorAuthRegisterController.php
+++ b/src/applications/auth/controller/PhabricatorAuthRegisterController.php
@@ -560,8 +560,7 @@ private function loadDefaultAccount() {
return array($account, $provider, $response);
} else if (count($providers) > 1) {
$response = $this->renderError(
- pht(
- 'There are too many configured default registration providers.'));
+ pht('There are too many configured default registration providers.'));
return array($account, $provider, $response);
}
diff --git a/src/applications/auth/controller/PhabricatorAuthSSHKeyGenerateController.php b/src/applications/auth/controller/PhabricatorAuthSSHKeyGenerateController.php
index d055db514a..2cb6dc81ea 100644
--- a/src/applications/auth/controller/PhabricatorAuthSSHKeyGenerateController.php
+++ b/src/applications/auth/controller/PhabricatorAuthSSHKeyGenerateController.php
@@ -55,9 +55,9 @@ public function handleRequest(AphrontRequest $request) {
->setSubmitURI($file->getDownloadURI())
->appendParagraph(
pht(
- 'A keypair has been generated, and the public key has been '.
- 'added as a recognized key. Use the button below to download '.
- 'the private key.'))
+ 'A keypair has been generated, and the public key has been '.
+ 'added as a recognized key. Use the button below to download '.
+ 'the private key.'))
->appendParagraph(
pht(
'After you download the private key, it will be destroyed. '.
@@ -77,8 +77,7 @@ public function handleRequest(AphrontRequest $request) {
'This workflow will generate a new SSH keypair, add the public '.
'key, and let you download the private key.'))
->appendParagraph(
- pht(
- 'Phabricator will not retain a copy of the private key.'))
+ pht('Phabricator will not retain a copy of the private key.'))
->addSubmitButton(pht('Generate New Keypair'))
->addCancelButton($cancel_uri);
} catch (Exception $ex) {
diff --git a/src/applications/auth/controller/PhabricatorAuthStartController.php b/src/applications/auth/controller/PhabricatorAuthStartController.php
index 7ea10690e5..f9b9f7cb41 100644
--- a/src/applications/auth/controller/PhabricatorAuthStartController.php
+++ b/src/applications/auth/controller/PhabricatorAuthStartController.php
@@ -71,8 +71,8 @@ public function handleRequest(AphrontRequest $request) {
'This Phabricator install is not configured with any enabled '.
'authentication providers which can be used to log in. If you '.
'have accidentally locked yourself out by disabling all providers, '.
- 'you can use `phabricator/bin/auth recover ` to '.
- 'recover access to an administrative account.'));
+ 'you can use `%s` to recover access to an administrative account.'.
+ 'phabricator/bin/auth recover '));
}
$next_uri = $request->getStr('next');
diff --git a/src/applications/auth/controller/PhabricatorEmailLoginController.php b/src/applications/auth/controller/PhabricatorEmailLoginController.php
index d21ec5a1bb..9db360d51d 100644
--- a/src/applications/auth/controller/PhabricatorEmailLoginController.php
+++ b/src/applications/auth/controller/PhabricatorEmailLoginController.php
@@ -72,7 +72,7 @@ public function processRequest() {
$target_email->getUserPHID());
if ($verified_addresses) {
$errors[] = pht(
- 'That email addess is not verified. You can only send '.
+ 'That email address is not verified. You can only send '.
'password reset links to a verified address.');
$e_email = pht('Unverified');
}
@@ -86,26 +86,22 @@ public function processRequest() {
PhabricatorAuthSessionEngine::ONETIME_RESET);
if ($is_serious) {
- $body = <<addCancelButton('/', pht('Done'));
}
}
-
}
$error_view = null;
@@ -153,8 +148,7 @@ public function processRequest() {
$dialog = new AphrontDialogView();
$dialog->setUser($request->getUser());
- $dialog->setTitle(pht(
- 'Forgot Password / Email Login'));
+ $dialog->setTitle(pht('Forgot Password / Email Login'));
$dialog->appendChild($email_auth);
$dialog->addSubmitButton(pht('Send Email'));
$dialog->setSubmitURI('/login/email/');
diff --git a/src/applications/auth/factor/__tests__/PhabricatorTOTPAuthFactorTestCase.php b/src/applications/auth/factor/__tests__/PhabricatorTOTPAuthFactorTestCase.php
index 464c0b8e54..284db4cde1 100644
--- a/src/applications/auth/factor/__tests__/PhabricatorTOTPAuthFactorTestCase.php
+++ b/src/applications/auth/factor/__tests__/PhabricatorTOTPAuthFactorTestCase.php
@@ -39,6 +39,4 @@ public function testTOTPCodeGeneration() {
}
-
-
}
diff --git a/src/applications/auth/management/PhabricatorAuthManagementCachePKCS8Workflow.php b/src/applications/auth/management/PhabricatorAuthManagementCachePKCS8Workflow.php
index a10b3ea64a..22f993cee5 100644
--- a/src/applications/auth/management/PhabricatorAuthManagementCachePKCS8Workflow.php
+++ b/src/applications/auth/management/PhabricatorAuthManagementCachePKCS8Workflow.php
@@ -11,8 +11,8 @@ protected function didConstruct() {
pht(
'Cache the PKCS8 format of a public key. When developing on OSX, '.
'this can be used to work around issues with ssh-keygen. Use '.
- '`ssh-keygen -e -m PKCS8 -f key.pub` to generate a PKCS8 key to '.
- 'feed to this command.'))
+ '`%s` to generate a PKCS8 key to feed to this command.',
+ 'ssh-keygen -e -m PKCS8 -f key.pub'))
->setArguments(
array(
array(
@@ -35,7 +35,8 @@ public function execute(PhutilArgumentParser $args) {
if (!strlen($public_keyfile)) {
throw new PhutilArgumentUsageException(
pht(
- 'You must specify the path to a public keyfile with --public.'));
+ 'You must specify the path to a public keyfile with %s.',
+ '--public'));
}
if (!Filesystem::pathExists($public_keyfile)) {
@@ -51,7 +52,8 @@ public function execute(PhutilArgumentParser $args) {
if (!strlen($pkcs8_keyfile)) {
throw new PhutilArgumentUsageException(
pht(
- 'You must specify the path to a pkcs8 keyfile with --pkc8s.'));
+ 'You must specify the path to a pkcs8 keyfile with %s.',
+ '--pkc8s'));
}
if (!Filesystem::pathExists($pkcs8_keyfile)) {
diff --git a/src/applications/auth/management/PhabricatorAuthManagementLDAPWorkflow.php b/src/applications/auth/management/PhabricatorAuthManagementLDAPWorkflow.php
index e7afcc48d1..725d2dfc49 100644
--- a/src/applications/auth/management/PhabricatorAuthManagementLDAPWorkflow.php
+++ b/src/applications/auth/management/PhabricatorAuthManagementLDAPWorkflow.php
@@ -21,28 +21,28 @@ public function execute(PhutilArgumentParser $args) {
if (!$provider) {
$console->writeOut(
"%s\n",
- 'The LDAP authentication provider is not enabled.');
+ pht('The LDAP authentication provider is not enabled.'));
exit(1);
}
if (!function_exists('ldap_connect')) {
$console->writeOut(
"%s\n",
- 'The LDAP extension is not enabled.');
+ pht('The LDAP extension is not enabled.'));
exit(1);
}
$adapter = $provider->getAdapter();
$console->writeOut("%s\n", pht('Enter LDAP Credentials'));
- $username = phutil_console_prompt('LDAP Username: ');
+ $username = phutil_console_prompt(pht('LDAP Username: '));
if (!strlen($username)) {
throw new PhutilArgumentUsageException(
pht('You must enter an LDAP username.'));
}
phutil_passthru('stty -echo');
- $password = phutil_console_prompt('LDAP Password: ');
+ $password = phutil_console_prompt(pht('LDAP Password: '));
phutil_passthru('stty echo');
if (!strlen($password)) {
diff --git a/src/applications/auth/management/PhabricatorAuthManagementRecoverWorkflow.php b/src/applications/auth/management/PhabricatorAuthManagementRecoverWorkflow.php
index fe918adee4..ad843d56ce 100644
--- a/src/applications/auth/management/PhabricatorAuthManagementRecoverWorkflow.php
+++ b/src/applications/auth/management/PhabricatorAuthManagementRecoverWorkflow.php
@@ -8,8 +8,9 @@ protected function didConstruct() {
->setName('recover')
->setExamples('**recover** __username__')
->setSynopsis(
- 'Recover access to an administrative account if you have locked '.
- 'yourself out of Phabricator.')
+ pht(
+ 'Recover access to an administrative account if you have locked '.
+ 'yourself out of Phabricator.'))
->setArguments(
array(
'username' => array(
@@ -29,8 +30,9 @@ public function execute(PhutilArgumentParser $args) {
throw new PhutilArgumentUsageException(
pht(
'This Phabricator installation has no recoverable administrator '.
- 'accounts. You can use `bin/accountadmin` to create a new '.
- 'administrator account or make an existing user an administrator.'));
+ 'accounts. You can use `%s` to create a new administrator '.
+ 'account or make an existing user an administrator.',
+ 'bin/accountadmin'));
}
$can_recover = mpull($can_recover, 'getUsername');
sort($can_recover);
@@ -85,10 +87,11 @@ public function execute(PhutilArgumentParser $args) {
$console->writeOut(' %s', $onetime_uri);
$console->writeOut("\n\n");
$console->writeOut(
+ "%s\n",
pht(
'After logging in, you can use the "Auth" application to add or '.
'restore authentication providers and allow normal logins to '.
- 'succeed.')."\n");
+ 'succeed.'));
return 0;
}
diff --git a/src/applications/auth/management/PhabricatorAuthManagementRefreshWorkflow.php b/src/applications/auth/management/PhabricatorAuthManagementRefreshWorkflow.php
index b05b87f5e8..23c0a109cb 100644
--- a/src/applications/auth/management/PhabricatorAuthManagementRefreshWorkflow.php
+++ b/src/applications/auth/management/PhabricatorAuthManagementRefreshWorkflow.php
@@ -16,17 +16,17 @@ protected function didConstruct() {
array(
'name' => 'user',
'param' => 'user',
- 'help' => 'Refresh tokens for a given user.',
+ 'help' => pht('Refresh tokens for a given user.'),
),
array(
'name' => 'type',
'param' => 'provider',
- 'help' => 'Refresh tokens for a given provider type.',
+ 'help' => pht('Refresh tokens for a given provider type.'),
),
array(
'name' => 'domain',
'param' => 'domain',
- 'help' => 'Refresh tokens for a given domain.',
+ 'help' => pht('Refresh tokens for a given domain.'),
),
));
}
diff --git a/src/applications/auth/management/PhabricatorAuthManagementStripWorkflow.php b/src/applications/auth/management/PhabricatorAuthManagementStripWorkflow.php
index f6d057b57a..f25d05301b 100644
--- a/src/applications/auth/management/PhabricatorAuthManagementStripWorkflow.php
+++ b/src/applications/auth/management/PhabricatorAuthManagementStripWorkflow.php
@@ -7,9 +7,7 @@ protected function didConstruct() {
$this
->setName('strip')
->setExamples('**strip** [--user username] [--type type]')
- ->setSynopsis(
- pht(
- 'Remove multi-factor authentication from an account.'))
+ ->setSynopsis(pht('Remove multi-factor authentication from an account.'))
->setArguments(
array(
array(
@@ -50,13 +48,17 @@ public function execute(PhutilArgumentParser $args) {
if ($usernames && $all_users) {
throw new PhutilArgumentUsageException(
pht(
- 'Specify either specific users with --user, or all users with '.
- '--all-users, but not both.'));
+ 'Specify either specific users with %s, or all users with '.
+ '%s, but not both.',
+ '--user',
+ '--all-users'));
} else if (!$usernames && !$all_users) {
throw new PhutilArgumentUsageException(
pht(
- 'Use --user to specify which user to strip factors from, or '.
- '--all-users to strip factors from all users.'));
+ 'Use %s to specify which user to strip factors from, or '.
+ '%s to strip factors from all users.',
+ '--user',
+ '--all-users'));
} else if ($usernames) {
$users = id(new PhabricatorPeopleQuery())
->setViewer($this->getViewer())
diff --git a/src/applications/auth/management/PhabricatorAuthManagementTrustOAuthClientWorkflow.php b/src/applications/auth/management/PhabricatorAuthManagementTrustOAuthClientWorkflow.php
index 229218d3b7..ee5e50b38e 100644
--- a/src/applications/auth/management/PhabricatorAuthManagementTrustOAuthClientWorkflow.php
+++ b/src/applications/auth/management/PhabricatorAuthManagementTrustOAuthClientWorkflow.php
@@ -28,7 +28,8 @@ public function execute(PhutilArgumentParser $args) {
if (!$id) {
throw new PhutilArgumentUsageException(
pht(
- 'Specify an OAuth client id with --id.'));
+ 'Specify an OAuth client id with %s.',
+ '--id'));
}
$client = id(new PhabricatorOAuthServerClientQuery())
diff --git a/src/applications/auth/management/PhabricatorAuthManagementUntrustOAuthClientWorkflow.php b/src/applications/auth/management/PhabricatorAuthManagementUntrustOAuthClientWorkflow.php
index 344e4b8864..a0b3e02fa4 100644
--- a/src/applications/auth/management/PhabricatorAuthManagementUntrustOAuthClientWorkflow.php
+++ b/src/applications/auth/management/PhabricatorAuthManagementUntrustOAuthClientWorkflow.php
@@ -28,7 +28,8 @@ public function execute(PhutilArgumentParser $args) {
if (!$id) {
throw new PhutilArgumentUsageException(
pht(
- 'Specify an OAuth client id with --id.'));
+ 'Specify an OAuth client ID with %s.',
+ '--id'));
}
$client = id(new PhabricatorOAuthServerClientQuery())
@@ -39,7 +40,7 @@ public function execute(PhutilArgumentParser $args) {
if (!$client) {
throw new PhutilArgumentUsageException(
pht(
- 'Failed to find an OAuth client with id %s.', $id));
+ 'Failed to find an OAuth client with ID %s.', $id));
}
if (!$client->getIsTrusted()) {
diff --git a/src/applications/auth/provider/PhabricatorAuthProvider.php b/src/applications/auth/provider/PhabricatorAuthProvider.php
index 5ffb18b41a..d495a3091f 100644
--- a/src/applications/auth/provider/PhabricatorAuthProvider.php
+++ b/src/applications/auth/provider/PhabricatorAuthProvider.php
@@ -195,7 +195,7 @@ public function willRegisterAccount(PhabricatorExternalAccount $account) {
protected function loadOrCreateAccount($account_id) {
if (!strlen($account_id)) {
- throw new Exception('loadOrCreateAccount(...): empty account ID!');
+ throw new Exception(pht('Empty account ID!'));
}
$adapter = $this->getAdapter();
@@ -203,14 +203,18 @@ protected function loadOrCreateAccount($account_id) {
if (!strlen($adapter->getAdapterType())) {
throw new Exception(
- "AuthAdapter (of class '{$adapter_class}') has an invalid ".
- "implementation: no adapter type.");
+ pht(
+ "AuthAdapter (of class '%s') has an invalid implementation: ".
+ "no adapter type.",
+ $adapter_class));
}
if (!strlen($adapter->getAdapterDomain())) {
throw new Exception(
- "AuthAdapter (of class '{$adapter_class}') has an invalid ".
- "implementation: no adapter domain.");
+ pht(
+ "AuthAdapter (of class '%s') has an invalid implementation: ".
+ "no adapter domain.",
+ $adapter_class));
}
$account = id(new PhabricatorExternalAccount())->loadOneWhere(
diff --git a/src/applications/auth/provider/PhabricatorLDAPAuthProvider.php b/src/applications/auth/provider/PhabricatorLDAPAuthProvider.php
index 111d62601b..013cd21736 100644
--- a/src/applications/auth/provider/PhabricatorLDAPAuthProvider.php
+++ b/src/applications/auth/provider/PhabricatorLDAPAuthProvider.php
@@ -110,13 +110,13 @@ protected function renderLoginForm(AphrontRequest $request, $mode) {
->setFullWidth(true)
->appendChild(
id(new AphrontFormTextControl())
- ->setLabel('LDAP Username')
+ ->setLabel(pht('LDAP Username'))
->setName('ldap_username')
->setValue($v_user)
->setError($e_user))
->appendChild(
id(new AphrontFormPasswordControl())
- ->setLabel('LDAP Password')
+ ->setLabel(pht('LDAP Password'))
->setName('ldap_password')
->setError($e_pass));
@@ -166,7 +166,7 @@ public function processLoginRequest(
$account_id = $adapter->getAccountID();
DarkConsoleErrorLogPluginAPI::disableDiscardMode();
} else {
- throw new Exception('Username and password are required!');
+ throw new Exception(pht('Username and password are required!'));
}
} catch (PhutilAuthCredentialException $ex) {
$response = $controller->buildProviderPageResponse(
@@ -258,8 +258,9 @@ public static function assertLDAPExtensionInstalled() {
'Before you can set up or use LDAP, you need to install the PHP '.
'LDAP extension. It is not currently installed, so PHP can not '.
'talk to LDAP. Usually you can install it with '.
- '`yum install php-ldap`, `apt-get install php5-ldap`, or a '.
- 'similar package manager command.'));
+ '`%s`, `%s`, or a similar package manager command.',
+ 'yum install php-ldap',
+ 'apt-get install php5-ldap'));
}
}
diff --git a/src/applications/auth/provider/PhabricatorOAuth1AuthProvider.php b/src/applications/auth/provider/PhabricatorOAuth1AuthProvider.php
index 745232a783..a22707b6cc 100644
--- a/src/applications/auth/provider/PhabricatorOAuth1AuthProvider.php
+++ b/src/applications/auth/provider/PhabricatorOAuth1AuthProvider.php
@@ -84,11 +84,11 @@ public function processLoginRequest(
$verifier = $request->getStr('oauth_verifier');
if (!$token) {
- throw new Exception("Expected 'oauth_token' in request!");
+ throw new Exception(pht("Expected '%s' in request!", 'oauth_token'));
}
if (!$verifier) {
- throw new Exception("Expected 'oauth_verifier' in request!");
+ throw new Exception(pht("Expected '%s' in request!", 'oauth_verifier'));
}
$adapter->setToken($token);
diff --git a/src/applications/auth/provider/PhabricatorOAuth2AuthProvider.php b/src/applications/auth/provider/PhabricatorOAuth2AuthProvider.php
index 4f1f1e8fed..aff6367840 100644
--- a/src/applications/auth/provider/PhabricatorOAuth2AuthProvider.php
+++ b/src/applications/auth/provider/PhabricatorOAuth2AuthProvider.php
@@ -198,7 +198,7 @@ public function getOAuthAccessToken(
$force_refresh = false) {
if ($account->getProviderKey() !== $this->getProviderKey()) {
- throw new Exception('Account does not match provider!');
+ throw new Exception(pht('Account does not match provider!'));
}
if (!$force_refresh) {
@@ -262,8 +262,7 @@ public function willRenderLinkedAccount(
phabricator_datetime($oauth_expires, $viewer)));
} else {
$item->addAttribute(
- pht(
- 'Active OAuth Token'));
+ pht('Active OAuth Token'));
}
} else if ($is_invalid) {
$item->addAttribute(pht('Invalid OAuth Access Token'));
diff --git a/src/applications/auth/provider/PhabricatorOAuthAuthProvider.php b/src/applications/auth/provider/PhabricatorOAuthAuthProvider.php
index 8f7eae8aac..df76c655f3 100644
--- a/src/applications/auth/provider/PhabricatorOAuthAuthProvider.php
+++ b/src/applications/auth/provider/PhabricatorOAuthAuthProvider.php
@@ -82,8 +82,9 @@ public function getConfigurationHelp() {
$help = $this->getProviderConfigurationHelp();
return $help."\n\n".
- pht('Use the **OAuth App Notes** field to record details about which '.
- 'account the external application is registered under.');
+ pht(
+ 'Use the **OAuth App Notes** field to record details about which '.
+ 'account the external application is registered under.');
}
abstract protected function getProviderConfigurationHelp();
diff --git a/src/applications/auth/provider/PhabricatorPasswordAuthProvider.php b/src/applications/auth/provider/PhabricatorPasswordAuthProvider.php
index 6307446c88..dbe2203d83 100644
--- a/src/applications/auth/provider/PhabricatorPasswordAuthProvider.php
+++ b/src/applications/auth/provider/PhabricatorPasswordAuthProvider.php
@@ -13,7 +13,8 @@ public function getConfigurationHelp() {
"(WARNING) Examine the table below for information on how password ".
"hashes will be stored in the database.\n\n".
"(NOTE) You can select a minimum password length by setting ".
- "`account.minimum-password-length` in configuration.");
+ "`%s` in configuration.",
+ 'account.minimum-password-length');
}
public function renderConfigurationFooter() {
@@ -160,7 +161,7 @@ public function buildInviteForm(
public function buildLinkForm(
PhabricatorAuthLinkController $controller) {
- throw new Exception("Password providers can't be linked.");
+ throw new Exception(pht("Password providers can't be linked."));
}
private function renderPasswordLoginForm(
@@ -205,8 +206,9 @@ private function renderPasswordLoginForm(
$errors[] = pht('CAPTCHA was not entered correctly.');
} else {
$e_captcha = pht('Required');
- $errors[] = pht('Too many login failures recently. You must '.
- 'submit a CAPTCHA with your login request.');
+ $errors[] = pht(
+ 'Too many login failures recently. You must '.
+ 'submit a CAPTCHA with your login request.');
}
} else if ($request->isHTTPPost()) {
// NOTE: This is intentionally vague so as not to disclose whether a
@@ -225,13 +227,13 @@ private function renderPasswordLoginForm(
->appendChild($errors)
->appendChild(
id(new AphrontFormTextControl())
- ->setLabel('Username or Email')
+ ->setLabel(pht('Username or Email'))
->setName('username')
->setValue($v_user)
->setError($e_user))
->appendChild(
id(new AphrontFormPasswordControl())
- ->setLabel('Password')
+ ->setLabel(pht('Password'))
->setName('password')
->setError($e_pass));
diff --git a/src/applications/auth/provider/PhabricatorPersonaAuthProvider.php b/src/applications/auth/provider/PhabricatorPersonaAuthProvider.php
index 843c55a365..e88b466872 100644
--- a/src/applications/auth/provider/PhabricatorPersonaAuthProvider.php
+++ b/src/applications/auth/provider/PhabricatorPersonaAuthProvider.php
@@ -9,8 +9,7 @@ public function getProviderName() {
}
public function getDescriptionForCreate() {
- return pht(
- 'Allow users to login or register using Mozilla Persona.');
+ return pht('Allow users to login or register using Mozilla Persona.');
}
public function getAdapter() {
@@ -54,12 +53,12 @@ public function processLoginRequest(
$response = null;
if (!$request->isAjax()) {
- throw new Exception('Expected this request to come via Ajax.');
+ throw new Exception(pht('Expected this request to come via Ajax.'));
}
$assertion = $request->getStr('assertion');
if (!$assertion) {
- throw new Exception('Expected identity assertion.');
+ throw new Exception(pht('Expected identity assertion.'));
}
$adapter->setAssertion($assertion);
diff --git a/src/applications/auth/provider/PhabricatorPhabricatorAuthProvider.php b/src/applications/auth/provider/PhabricatorPhabricatorAuthProvider.php
index b27c895e82..8ea5e71f43 100644
--- a/src/applications/auth/provider/PhabricatorPhabricatorAuthProvider.php
+++ b/src/applications/auth/provider/PhabricatorPhabricatorAuthProvider.php
@@ -122,7 +122,8 @@ public function processEditForm(
$uri = new PhutilURI($values[$key_uri]);
if (!$uri->getProtocol()) {
$errors[] = pht(
- 'Phabricator base URI should include protocol (like "https://").');
+ 'Phabricator base URI should include protocol (like "%s").',
+ 'https://');
$issues[$key_uri] = pht('Invalid');
}
}
diff --git a/src/applications/auth/query/PhabricatorAuthProviderConfigQuery.php b/src/applications/auth/query/PhabricatorAuthProviderConfigQuery.php
index 028108c2cc..44e5913290 100644
--- a/src/applications/auth/query/PhabricatorAuthProviderConfigQuery.php
+++ b/src/applications/auth/query/PhabricatorAuthProviderConfigQuery.php
@@ -88,7 +88,7 @@ protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
'isEnabled = 1');
break;
default:
- throw new Exception("Unknown status '{$status}'!");
+ throw new Exception(pht("Unknown status '%s'!", $status));
}
$where[] = $this->buildPagingClause($conn_r);
diff --git a/src/applications/auth/sshkey/PhabricatorAuthSSHPublicKey.php b/src/applications/auth/sshkey/PhabricatorAuthSSHPublicKey.php
index b30e16db7d..d8660b1956 100644
--- a/src/applications/auth/sshkey/PhabricatorAuthSSHPublicKey.php
+++ b/src/applications/auth/sshkey/PhabricatorAuthSSHPublicKey.php
@@ -129,8 +129,9 @@ public function toPKCS8() {
throw new PhutilProxyException(
pht(
'Failed to convert public key into PKCS8 format. If you are '.
- 'developing on OSX, you may be able to use `bin/auth cache-pkcs8` '.
+ 'developing on OSX, you may be able to use `%s` '.
'to work around this issue. %s',
+ 'bin/auth cache-pkcs8',
$ex->getMessage()),
$ex);
}
diff --git a/src/applications/base/PhabricatorApplication.php b/src/applications/base/PhabricatorApplication.php
index 295d4db180..e97e4d605f 100644
--- a/src/applications/base/PhabricatorApplication.php
+++ b/src/applications/base/PhabricatorApplication.php
@@ -32,7 +32,7 @@ public static function getApplicationGroups() {
public abstract function getName();
public function getShortDescription() {
- return $this->getName().' Application';
+ return pht('%s Application', $this->getName());
}
public function isInstalled() {
@@ -254,7 +254,7 @@ protected function getInboundEmailSupportLink() {
}
public function getAppEmailBlurb() {
- throw new Exception('Not Implemented.');
+ throw new PhutilMethodNotImplementedException();
}
@@ -371,7 +371,7 @@ public static function getByClass($class_name) {
}
if (!$selected) {
- throw new Exception("No application '{$class_name}'!");
+ throw new Exception(pht("No application '%s'!", $class_name));
}
return $selected;
@@ -531,7 +531,7 @@ private function getCustomPolicySetting($capability) {
private function getCustomCapabilitySpecification($capability) {
$custom = $this->getCustomCapabilities();
if (!isset($custom[$capability])) {
- throw new Exception("Unknown capability '{$capability}'!");
+ throw new Exception(pht("Unknown capability '%s'!", $capability));
}
return $custom[$capability];
}
diff --git a/src/applications/base/controller/PhabricatorController.php b/src/applications/base/controller/PhabricatorController.php
index e2b899ab6e..04bb633d4e 100644
--- a/src/applications/base/controller/PhabricatorController.php
+++ b/src/applications/base/controller/PhabricatorController.php
@@ -316,7 +316,7 @@ private function buildPageResponse($page) {
public function getApplicationURI($path = '') {
if (!$this->getCurrentApplication()) {
- throw new Exception('No application!');
+ throw new Exception(pht('No application!'));
}
return $this->getCurrentApplication()->getApplicationURI($path);
}
@@ -388,8 +388,8 @@ public function didProcessRequest($response) {
if (isset($seen[$hash])) {
$seen[] = get_class($response);
throw new Exception(
- 'Cycle while reducing proxy responses: '.
- implode(' -> ', $seen));
+ pht('Cycle while reducing proxy responses: %s',
+ implode(' -> ', $seen)));
}
$seen[$hash] = get_class($response);
diff --git a/src/applications/base/controller/__tests__/PhabricatorAccessControlTestCase.php b/src/applications/base/controller/__tests__/PhabricatorAccessControlTestCase.php
index 3791d7462a..560e0c95c4 100644
--- a/src/applications/base/controller/__tests__/PhabricatorAccessControlTestCase.php
+++ b/src/applications/base/controller/__tests__/PhabricatorAccessControlTestCase.php
@@ -63,7 +63,7 @@ public function testControllerAccessControls() {
// Test standard defaults.
$this->checkAccess(
- 'Default',
+ pht('Default'),
id(clone $controller),
$request,
array(
@@ -82,7 +82,7 @@ public function testControllerAccessControls() {
$env->overrideEnvConfig('auth.require-email-verification', true);
$this->checkAccess(
- 'Email Verification Required',
+ pht('Email Verification Required'),
id(clone $controller),
$request,
array(
@@ -97,7 +97,7 @@ public function testControllerAccessControls() {
));
$this->checkAccess(
- 'Email Verification Required, With Exception',
+ pht('Email Verification Required, With Exception'),
id(clone $controller)->setConfig('email', false),
$request,
array(
@@ -116,7 +116,7 @@ public function testControllerAccessControls() {
// Test admin access.
$this->checkAccess(
- 'Admin Required',
+ pht('Admin Required'),
id(clone $controller)->setConfig('admin', true),
$request,
array(
@@ -134,7 +134,7 @@ public function testControllerAccessControls() {
// Test disabled access.
$this->checkAccess(
- 'Allow Disabled',
+ pht('Allow Disabled'),
id(clone $controller)->setConfig('enabled', false),
$request,
array(
@@ -152,7 +152,7 @@ public function testControllerAccessControls() {
// Test no login required.
$this->checkAccess(
- 'No Login Required',
+ pht('No Login Required'),
id(clone $controller)->setConfig('login', false),
$request,
array(
@@ -170,7 +170,7 @@ public function testControllerAccessControls() {
// Test public access.
$this->checkAccess(
- 'Public Access',
+ pht('Public Access'),
id(clone $controller)->setConfig('public', true),
$request,
array(
@@ -185,7 +185,7 @@ public function testControllerAccessControls() {
$env->overrideEnvConfig('policy.allow-public', true);
$this->checkAccess(
- 'Public + configured',
+ pht('Public + configured'),
id(clone $controller)->setConfig('public', true),
$request,
array(
@@ -210,7 +210,7 @@ public function testControllerAccessControls() {
$app_controller = id(clone $controller)->setCurrentApplication($app);
$this->checkAccess(
- 'Application Controller',
+ pht('Application Controller'),
$app_controller,
$request,
array(
@@ -225,7 +225,7 @@ public function testControllerAccessControls() {
));
$this->checkAccess(
- 'Application Controller',
+ pht('Application Controller'),
id(clone $app_controller)->setConfig('login', false),
$request,
array(
@@ -259,7 +259,7 @@ private function checkAccess(
$this->assertTrue(
($result === null),
- "Expect user '{$uname}' to be allowed access to '{$label}'.");
+ pht("Expect user '%s' to be allowed access to '%s'.", $uname, $label));
}
foreach ($no as $user) {
@@ -274,7 +274,7 @@ private function checkAccess(
$this->assertFalse(
($result === null),
- "Expect user '{$uname}' to be denied access to '{$label}'.");
+ pht("Expect user '%s' to be denied access to '%s'.", $uname, $label));
}
}
diff --git a/src/applications/cache/PhabricatorCaches.php b/src/applications/cache/PhabricatorCaches.php
index 4e3af7a6a4..1cddba9fb1 100644
--- a/src/applications/cache/PhabricatorCaches.php
+++ b/src/applications/cache/PhabricatorCaches.php
@@ -332,7 +332,9 @@ public static function maybeDeflateData($value) {
public static function inflateData($value) {
if (!function_exists('gzinflate')) {
throw new Exception(
- pht('gzinflate() is not available; unable to read deflated data!'));
+ pht(
+ '%s is not available; unable to read deflated data!',
+ 'gzinflate()'));
}
$value = gzinflate($value);
diff --git a/src/applications/cache/PhabricatorKeyValueDatabaseCache.php b/src/applications/cache/PhabricatorKeyValueDatabaseCache.php
index 5bdf60f660..85bc57f8b7 100644
--- a/src/applications/cache/PhabricatorKeyValueDatabaseCache.php
+++ b/src/applications/cache/PhabricatorKeyValueDatabaseCache.php
@@ -136,7 +136,7 @@ private function digestKeys(array $keys) {
private function willWriteValue($key, $value) {
if (!is_string($value)) {
- throw new Exception('Only strings may be written to the DB cache!');
+ throw new Exception(pht('Only strings may be written to the DB cache!'));
}
static $can_deflate;
@@ -162,7 +162,7 @@ private function didReadValue($format, $value) {
case self::CACHE_FORMAT_DEFLATE:
return PhabricatorCaches::inflateData($value);
default:
- throw new Exception('Unknown cache format.');
+ throw new Exception(pht('Unknown cache format.'));
}
}
diff --git a/src/applications/cache/management/PhabricatorCacheManagementPurgeWorkflow.php b/src/applications/cache/management/PhabricatorCacheManagementPurgeWorkflow.php
index 2d6de653bc..2523a1e333 100644
--- a/src/applications/cache/management/PhabricatorCacheManagementPurgeWorkflow.php
+++ b/src/applications/cache/management/PhabricatorCacheManagementPurgeWorkflow.php
@@ -6,24 +6,24 @@ final class PhabricatorCacheManagementPurgeWorkflow
protected function didConstruct() {
$this
->setName('purge')
- ->setSynopsis('Drop data from caches.')
+ ->setSynopsis(pht('Drop data from caches.'))
->setArguments(
array(
array(
'name' => 'purge-all',
- 'help' => 'Purge all caches.',
+ 'help' => pht('Purge all caches.'),
),
array(
'name' => 'purge-remarkup',
- 'help' => 'Purge the remarkup cache.',
+ 'help' => pht('Purge the remarkup cache.'),
),
array(
'name' => 'purge-changeset',
- 'help' => 'Purge the Differential changeset cache.',
+ 'help' => pht('Purge the Differential changeset cache.'),
),
array(
'name' => 'purge-general',
- 'help' => 'Purge the general cache.',
+ 'help' => pht('Purge the general cache.'),
),
));
}
@@ -46,27 +46,30 @@ public function execute(PhutilArgumentParser $args) {
}
throw new PhutilArgumentUsageException(
- "Specify which cache or caches to purge, or use '--purge-all'. ".
- "Available caches are: ".implode(', ', $list).". Use '--help' ".
- "for more information.");
+ pht(
+ "Specify which cache or caches to purge, or use '%s'. Available ".
+ "caches are: %s. Use '%s' for more information.",
+ '--purge-all',
+ implode(', ', $list),
+ '--help'));
}
if ($purge['remarkup']) {
- $console->writeOut('Purging remarkup cache...');
+ $console->writeOut(pht('Purging remarkup cache...'));
$this->purgeRemarkupCache();
- $console->writeOut("done.\n");
+ $console->writeOut("%s\n", pht('Done.'));
}
if ($purge['changeset']) {
- $console->writeOut('Purging changeset cache...');
+ $console->writeOut(pht('Purging changeset cache...'));
$this->purgeChangesetCache();
- $console->writeOut("done.\n");
+ $console->writeOut("%s\n", pht('Done.'));
}
if ($purge['general']) {
- $console->writeOut('Purging general cache...');
+ $console->writeOut(pht('Purging general cache...'));
$this->purgeGeneralCache();
- $console->writeOut("done.\n");
+ $console->writeOut("%s\n", pht('Done.'));
}
}
diff --git a/src/applications/cache/spec/PhabricatorCacheSpec.php b/src/applications/cache/spec/PhabricatorCacheSpec.php
index 31645ea97f..1688cb07fd 100644
--- a/src/applications/cache/spec/PhabricatorCacheSpec.php
+++ b/src/applications/cache/spec/PhabricatorCacheSpec.php
@@ -96,8 +96,8 @@ protected function raiseEnableAPCIssue() {
$message = pht(
'The APC or APCu PHP extensions are installed, but not enabled in your '.
'PHP configuration. Enabling these extensions will improve Phabricator '.
- 'performance. Edit the "apc.enabled" setting to enable these '.
- 'extensions.');
+ 'performance. Edit the "%s" setting to enable these extensions.',
+ 'apc.enabled');
return $this
->newIssue('extension.apc.enabled')
diff --git a/src/applications/cache/spec/PhabricatorOpcodeCacheSpec.php b/src/applications/cache/spec/PhabricatorOpcodeCacheSpec.php
index dd270fa2a0..c129fb0fa0 100644
--- a/src/applications/cache/spec/PhabricatorOpcodeCacheSpec.php
+++ b/src/applications/cache/spec/PhabricatorOpcodeCacheSpec.php
@@ -35,14 +35,14 @@ private function initAPCSpec() {
$slam_defense = ini_get('apc.slam_defense');
if (!$write_lock || $slam_defense) {
- $summary = pht(
- 'Adjust APC settings to quiet unnecessary errors.');
+ $summary = pht('Adjust APC settings to quiet unnecessary errors.');
$message = pht(
'Some versions of APC may emit unnecessary errors into the '.
'error log under the current APC settings. To resolve this, '.
- 'enable "apc.write_lock" and disable "apc.slam_defense" in '.
- 'your PHP configuration.');
+ 'enable "%s" and disable "%s" in your PHP configuration.',
+ 'apc.write_lock',
+ 'apc.slam_defense');
$this
->newIssue('extension.apc.write-lock')
@@ -58,36 +58,40 @@ private function initAPCSpec() {
$is_stat_enabled = ini_get('apc.stat');
if ($is_stat_enabled && !$is_dev) {
$summary = pht(
- '"apc.stat" is currently enabled, but should probably be disabled.');
+ '"%s" is currently enabled, but should probably be disabled.',
+ 'apc.stat');
$message = pht(
- 'The "apc.stat" setting is currently enabled in your PHP '.
- 'configuration. In production mode, "apc.stat" should be '.
- 'disabled. This will improve performance slightly.');
+ 'The "%s" setting is currently enabled in your PHP configuration. '.
+ 'In production mode, "%s" should be disabled. '.
+ 'This will improve performance slightly.',
+ 'apc.stat',
+ 'apc.stat');
$this
->newIssue('extension.apc.stat-enabled')
- ->setShortName(pht('"apc.stat" Enabled'))
- ->setName(pht('"apc.stat" Enabled in Production'))
+ ->setShortName(pht('"%s" Enabled', 'apc.stat'))
+ ->setName(pht('"%s" Enabled in Production', 'apc.stat'))
->setSummary($summary)
->setMessage($message)
->addPHPConfig('apc.stat')
->addPhabricatorConfig('phabricator.developer-mode');
} else if (!$is_stat_enabled && $is_dev) {
$summary = pht(
- '"apc.stat" is currently disabled, but should probably be enabled.');
+ '"%s" is currently disabled, but should probably be enabled.',
+ 'apc.stat');
$message = pht(
- 'The "apc.stat" setting is currently disabled in your PHP '.
- 'configuration, but Phabricator is running in development mode. '.
- 'This option should normally be enabled in development so you do '.
- 'not need to restart your webserver after making changes to the '.
- 'code.');
+ 'The "%s" setting is currently disabled in your PHP configuration, '.
+ 'but Phabricator is running in development mode. This option should '.
+ 'normally be enabled in development so you do not need to restart '.
+ 'your webserver after making changes to the code.',
+ 'apc.stat');
$this
->newIssue('extension.apc.stat-disabled')
- ->setShortName(pht('"apc.stat" Disabled'))
- ->setName(pht('"apc.stat" Disabled in Development'))
+ ->setShortName(pht('"%s" Disabled', 'apc.stat'))
+ ->setName(pht('"%s" Disabled in Development', 'apc.stat'))
->setSummary($summary)
->setMessage($message)
->addPHPConfig('apc.stat')
@@ -128,8 +132,9 @@ private function initOpcacheSpec() {
$message = pht(
'In development, OPcache should be configured to always reload '.
'code so the webserver does not need to be restarted after making '.
- 'changes. To do this, enable "opcache.validate_timestamps" and '.
- 'set "opcache.revalidate_freq" to 0.');
+ 'changes. To do this, enable "%s" and set "%s" to 0.',
+ 'opcache.validate_timestamps',
+ 'opcache.revalidate_freq');
$this
->newIssue('extension.opcache.devmode')
@@ -141,14 +146,13 @@ private function initOpcacheSpec() {
->addPHPConfig('opcache.revalidate_freq')
->addPhabricatorConfig('phabricator.developer-mode');
} else if (!$is_dev && $validate) {
- $summary = pht(
- 'OPcache is not configured ideally for production.');
+ $summary = pht('OPcache is not configured ideally for production.');
$message = pht(
'In production, OPcache should be configured to never '.
'revalidate code. This will slightly improve performance. '.
- 'To do this, disable "opcache.validate_timestamps" in your PHP '.
- 'configuration.');
+ 'To do this, disable "%s" in your PHP configuration.',
+ 'opcache.validate_timestamps');
$this
->newIssue('extension.opcache.production')
@@ -166,8 +170,9 @@ private function initOpcacheSpec() {
$message = pht(
'The PHP "Zend OPcache" extension is installed, but not enabled in '.
'your PHP configuration. Enabling it will dramatically improve '.
- 'Phabricator performance. Edit the "opcache.enable" setting to '.
- 'enable the extension.');
+ 'Phabricator performance. Edit the "%s" setting to '.
+ 'enable the extension.',
+ 'opcache.enable');
$this->newIssue('extension.opcache.enable')
->setShortName(pht('OPcache Disabled'))
diff --git a/src/applications/calendar/application/PhabricatorCalendarApplication.php b/src/applications/calendar/application/PhabricatorCalendarApplication.php
index 534b11d2e8..d41577a3af 100644
--- a/src/applications/calendar/application/PhabricatorCalendarApplication.php
+++ b/src/applications/calendar/application/PhabricatorCalendarApplication.php
@@ -54,6 +54,8 @@ public function getRoutes() {
=> 'PhabricatorCalendarEventEditController',
'edit/(?P[1-9]\d*)/'
=> 'PhabricatorCalendarEventEditController',
+ 'drag/(?P[1-9]\d*)/'
+ => 'PhabricatorCalendarEventDragController',
'cancel/(?P[1-9]\d*)/'
=> 'PhabricatorCalendarEventCancelController',
'(?Pjoin|decline|accept)/(?P[1-9]\d*)/'
diff --git a/src/applications/calendar/controller/PhabricatorCalendarEventDragController.php b/src/applications/calendar/controller/PhabricatorCalendarEventDragController.php
new file mode 100644
index 0000000000..7b813cdc44
--- /dev/null
+++ b/src/applications/calendar/controller/PhabricatorCalendarEventDragController.php
@@ -0,0 +1,66 @@
+getViewer();
+
+ $event = id(new PhabricatorCalendarEventQuery())
+ ->setViewer($viewer)
+ ->withIDs(array($request->getURIData('id')))
+ ->requireCapabilities(
+ array(
+ PhabricatorPolicyCapability::CAN_VIEW,
+ PhabricatorPolicyCapability::CAN_EDIT,
+ ))
+ ->executeOne();
+ if (!$event) {
+ return new Aphront404Response();
+ }
+
+ if (!$request->validateCSRF()) {
+ return new Aphront400Response();
+ }
+
+ if ($event->getIsAllDay()) {
+ return new Aphront400Response();
+ }
+
+ $xactions = array();
+
+ $duration = $event->getDateTo() - $event->getDateFrom();
+
+ $start = $request->getInt('start');
+ $start_value = id(AphrontFormDateControlValue::newFromEpoch(
+ $viewer,
+ $start));
+
+ $end = $start + $duration;
+ $end_value = id(AphrontFormDateControlValue::newFromEpoch(
+ $viewer,
+ $end));
+
+
+ $xactions[] = id(new PhabricatorCalendarEventTransaction())
+ ->setTransactionType(
+ PhabricatorCalendarEventTransaction::TYPE_START_DATE)
+ ->setNewValue($start_value);
+
+ $xactions[] = id(new PhabricatorCalendarEventTransaction())
+ ->setTransactionType(
+ PhabricatorCalendarEventTransaction::TYPE_END_DATE)
+ ->setNewValue($end_value);
+
+
+ $editor = id(new PhabricatorCalendarEventEditor())
+ ->setActor($viewer)
+ ->setContinueOnMissingFields(true)
+ ->setContentSourceFromRequest($request)
+ ->setContinueOnNoEffect(true);
+
+ $xactions = $editor->applyTransactions($event, $xactions);
+
+ return id(new AphrontReloadResponse());
+ }
+}
diff --git a/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php b/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php
index cf9797da45..cc19f7273f 100644
--- a/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php
+++ b/src/applications/calendar/controller/PhabricatorCalendarEventEditController.php
@@ -14,26 +14,63 @@ public function isCreate() {
}
public function handleRequest(AphrontRequest $request) {
- $user = $request->getUser();
- $user_phid = $user->getPHID();
+ $viewer = $request->getViewer();
+ $user_phid = $viewer->getPHID();
$error_name = true;
$error_start_date = true;
$error_end_date = true;
$validation_exception = null;
+ $all_day_id = celerity_generate_unique_node_id();
+ $start_date_id = celerity_generate_unique_node_id();
+ $end_date_id = null;
+
+ $next_workflow = $request->getStr('next');
+ $uri_query = $request->getStr('query');
+
if ($this->isCreate()) {
- $event = PhabricatorCalendarEvent::initializeNewCalendarEvent($user);
- $end_value = AphrontFormDateControlValue::newFromEpoch($user, time());
- $start_value = AphrontFormDateControlValue::newFromEpoch($user, time());
+ $event = PhabricatorCalendarEvent::initializeNewCalendarEvent($viewer);
+
+ $create_start_year = $request->getInt('year');
+ $create_start_month = $request->getInt('month');
+ $create_start_day = $request->getInt('day');
+ $create_start_time = $request->getStr('time');
+
+ if ($create_start_year) {
+ $start = AphrontFormDateControlValue::newFromParts(
+ $viewer,
+ $create_start_year,
+ $create_start_month,
+ $create_start_day,
+ $create_start_time);
+ if (!$start->isValid()) {
+ return new Aphront400Response();
+ }
+ $start_value = AphrontFormDateControlValue::newFromEpoch(
+ $viewer,
+ $start->getEpoch());
+
+ $end = clone $start_value->getDateTime();
+ $end->modify('+1 hour');
+ $end_value = AphrontFormDateControlValue::newFromEpoch(
+ $viewer,
+ $end->format('U'));
+
+ } else {
+ list($start_value, $end_value) = $this->getDefaultTimeValues($viewer);
+ }
+
+
$submit_label = pht('Create');
$page_title = pht('Create Event');
$redirect = 'created';
$subscribers = array();
$invitees = array($user_phid);
$cancel_uri = $this->getApplicationURI();
+ $end_date_id = celerity_generate_unique_node_id();
} else {
$event = id(new PhabricatorCalendarEventQuery())
- ->setViewer($user)
+ ->setViewer($viewer)
->withIDs(array($this->id))
->requireCapabilities(
array(
@@ -46,10 +83,10 @@ public function handleRequest(AphrontRequest $request) {
}
$end_value = AphrontFormDateControlValue::newFromEpoch(
- $user,
+ $viewer,
$event->getDateTo());
$start_value = AphrontFormDateControlValue::newFromEpoch(
- $user,
+ $viewer,
$event->getDateFrom());
$submit_label = pht('Update');
@@ -76,7 +113,7 @@ public function handleRequest(AphrontRequest $request) {
$icon = $event->getIcon();
$current_policies = id(new PhabricatorPolicyQuery())
- ->setViewer($user)
+ ->setViewer($viewer)
->setObject($event)
->execute();
@@ -101,9 +138,9 @@ public function handleRequest(AphrontRequest $request) {
$new_invitees = $this->getNewInviteeList($invitees, $event);
$status_attending = PhabricatorCalendarEventInvitee::STATUS_ATTENDING;
if ($this->isCreate()) {
- $status = idx($new_invitees, $user->getPHID());
+ $status = idx($new_invitees, $viewer->getPHID());
if ($status) {
- $new_invitees[$user->getPHID()] = $status_attending;
+ $new_invitees[$viewer->getPHID()] = $status_attending;
}
}
@@ -156,14 +193,29 @@ public function handleRequest(AphrontRequest $request) {
->setNewValue($request->getStr('editPolicy'));
$editor = id(new PhabricatorCalendarEventEditor())
- ->setActor($user)
+ ->setActor($viewer)
->setContentSourceFromRequest($request)
->setContinueOnNoEffect(true);
try {
$xactions = $editor->applyTransactions($event, $xactions);
$response = id(new AphrontRedirectResponse());
- return $response->setURI('/E'.$event->getID());
+ switch ($next_workflow) {
+ case 'day':
+ if (!$uri_query) {
+ $uri_query = 'month';
+ }
+ $year = $start_value->getDateTime()->format('Y');
+ $month = $start_value->getDateTime()->format('m');
+ $day = $start_value->getDateTime()->format('d');
+ $response->setURI(
+ '/calendar/query/'.$uri_query.'/'.$year.'/'.$month.'/'.$day.'/');
+ break;
+ default:
+ $response->setURI('/E'.$event->getID());
+ break;
+ }
+ return $response;
} catch (PhabricatorApplicationTransactionValidationException $ex) {
$validation_exception = $ex;
$error_name = $ex->getShortMessage(
@@ -178,10 +230,6 @@ public function handleRequest(AphrontRequest $request) {
}
}
- $all_day_id = celerity_generate_unique_node_id();
- $start_date_id = celerity_generate_unique_node_id();
- $end_date_id = celerity_generate_unique_node_id();
-
Javelin::initBehavior('event-all-day', array(
'allDayID' => $all_day_id,
'startDateID' => $start_date_id,
@@ -203,16 +251,17 @@ public function handleRequest(AphrontRequest $request) {
$all_day_id);
$start_control = id(new AphrontFormDateControl())
- ->setUser($user)
+ ->setUser($viewer)
->setName('start')
->setLabel(pht('Start'))
->setError($error_start_date)
->setValue($start_value)
->setID($start_date_id)
- ->setIsTimeDisabled($is_all_day);
+ ->setIsTimeDisabled($is_all_day)
+ ->setEndDateID($end_date_id);
$end_control = id(new AphrontFormDateControl())
- ->setUser($user)
+ ->setUser($viewer)
->setName('end')
->setLabel(pht('End'))
->setError($error_end_date)
@@ -226,13 +275,13 @@ public function handleRequest(AphrontRequest $request) {
->setValue($description);
$view_policies = id(new AphrontFormPolicyControl())
- ->setUser($user)
+ ->setUser($viewer)
->setCapability(PhabricatorPolicyCapability::CAN_VIEW)
->setPolicyObject($event)
->setPolicies($current_policies)
->setName('viewPolicy');
$edit_policies = id(new AphrontFormPolicyControl())
- ->setUser($user)
+ ->setUser($viewer)
->setCapability(PhabricatorPolicyCapability::CAN_EDIT)
->setPolicyObject($event)
->setPolicies($current_policies)
@@ -242,14 +291,14 @@ public function handleRequest(AphrontRequest $request) {
->setLabel(pht('Subscribers'))
->setName('subscribers')
->setValue($subscribers)
- ->setUser($user)
+ ->setUser($viewer)
->setDatasource(new PhabricatorMetaMTAMailableDatasource());
$invitees = id(new AphrontFormTokenizerControl())
->setLabel(pht('Invitees'))
->setName('invitees')
->setValue($invitees)
- ->setUser($user)
+ ->setUser($viewer)
->setDatasource(new PhabricatorMetaMTAMailableDatasource());
if ($this->isCreate()) {
@@ -267,7 +316,9 @@ public function handleRequest(AphrontRequest $request) {
->setValue($icon);
$form = id(new AphrontFormView())
- ->setUser($user)
+ ->addHiddenInput('next', $next_workflow)
+ ->addHiddenInput('query', $uri_query)
+ ->setUser($viewer)
->appendChild($name)
->appendChild($all_day_checkbox)
->appendChild($start_control)
@@ -349,4 +400,22 @@ public function getNewInviteeList(array $phids, $event) {
return $new;
}
+ private function getDefaultTimeValues($viewer) {
+ $start = new DateTime('@'.time());
+ $start->setTimeZone($viewer->getTimeZone());
+
+ $start->setTime($start->format('H'), 0, 0);
+ $start->modify('+1 hour');
+ $end = id(clone $start)->modify('+1 hour');
+
+ $start_value = AphrontFormDateControlValue::newFromEpoch(
+ $viewer,
+ $start->format('U'));
+ $end_value = AphrontFormDateControlValue::newFromEpoch(
+ $viewer,
+ $end->format('U'));
+
+ return array($start_value, $end_value);
+ }
+
}
diff --git a/src/applications/calendar/mail/PhabricatorCalendarReplyHandler.php b/src/applications/calendar/mail/PhabricatorCalendarReplyHandler.php
index 1d60e1294d..23639f1b89 100644
--- a/src/applications/calendar/mail/PhabricatorCalendarReplyHandler.php
+++ b/src/applications/calendar/mail/PhabricatorCalendarReplyHandler.php
@@ -5,7 +5,10 @@ final class PhabricatorCalendarReplyHandler
public function validateMailReceiver($mail_receiver) {
if (!($mail_receiver instanceof PhabricatorCalendarEvent)) {
- throw new Exception('Mail receiver is not a PhabricatorCalendarEvent!');
+ throw new Exception(
+ pht(
+ 'Mail receiver is not a %s!',
+ 'PhabricatorCalendarEvent'));
}
}
diff --git a/src/applications/calendar/query/PhabricatorCalendarEventQuery.php b/src/applications/calendar/query/PhabricatorCalendarEventQuery.php
index c66e367793..bdc87aaf26 100644
--- a/src/applications/calendar/query/PhabricatorCalendarEventQuery.php
+++ b/src/applications/calendar/query/PhabricatorCalendarEventQuery.php
@@ -42,6 +42,30 @@ public function withIsCancelled($is_cancelled) {
return $this;
}
+ protected function getDefaultOrderVector() {
+ return array('start', 'id');
+ }
+
+ public function getOrderableColumns() {
+ return array(
+ 'start' => array(
+ 'table' => $this->getPrimaryTableAlias(),
+ 'column' => 'dateFrom',
+ 'reverse' => true,
+ 'type' => 'int',
+ 'unique' => false,
+ ),
+ ) + parent::getOrderableColumns();
+ }
+
+ protected function getPagingValueMap($cursor, array $keys) {
+ $event = $this->loadCursorObject($cursor);
+ return array(
+ 'start' => $event->getDateFrom(),
+ 'id' => $event->getID(),
+ );
+ }
+
protected function loadPage() {
$table = new PhabricatorCalendarEvent();
$conn_r = $table->establishConnection('r');
@@ -156,6 +180,21 @@ public function getQueryApplicationClass() {
protected function willFilterPage(array $events) {
+ $range_start = $this->rangeBegin;
+ $range_end = $this->rangeEnd;
+
+ foreach ($events as $key => $event) {
+ $event_start = $event->getDateFrom();
+ $event_end = $event->getDateTo();
+
+ if ($range_start && $event_end < $range_start) {
+ unset($events[$key]);
+ }
+ if ($range_end && $event_start > $range_end) {
+ unset($events[$key]);
+ }
+ }
+
$phids = array();
foreach ($events as $event) {
@@ -173,6 +212,8 @@ protected function willFilterPage(array $events) {
$event->attachInvitees($event_invitees);
}
+ $events = msort($events, 'getDateFrom');
+
return $events;
}
diff --git a/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php b/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php
index b9ca2b81bf..b42b5dcdf8 100644
--- a/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php
+++ b/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php
@@ -390,12 +390,13 @@ private function buildCalendarDayView(
list($start_year, $start_month, $start_day) =
$this->getDisplayYearAndMonthAndDay($query);
- $day_view = new PHUICalendarDayView(
+ $day_view = id(new PHUICalendarDayView(
$this->getDateFrom($query),
$this->getDateTo($query),
$start_year,
$start_month,
- $start_day);
+ $start_day))
+ ->setQuery($query->getQueryKey());
$day_view->setUser($viewer);
@@ -408,7 +409,13 @@ private function buildCalendarDayView(
$viewer_is_invited = $status->getIsUserInvited($viewer->getPHID());
+ $can_edit = PhabricatorPolicyFilter::hasCapability(
+ $viewer,
+ $status,
+ PhabricatorPolicyCapability::CAN_EDIT);
+
$event = new AphrontCalendarEventView();
+ $event->setCanEdit($can_edit);
$event->setEventID($status->getID());
$event->setEpochRange($status->getDateFrom(), $status->getDateTo());
$event->setIsAllDay($status->getIsAllDay());
diff --git a/src/applications/calendar/storage/__tests__/PhabricatorCalendarHolidayTestCase.php b/src/applications/calendar/storage/__tests__/PhabricatorCalendarHolidayTestCase.php
index 40ec7f0aac..3e92a19583 100644
--- a/src/applications/calendar/storage/__tests__/PhabricatorCalendarHolidayTestCase.php
+++ b/src/applications/calendar/storage/__tests__/PhabricatorCalendarHolidayTestCase.php
@@ -12,7 +12,7 @@ protected function willRunTests() {
parent::willRunTests();
id(new PhabricatorCalendarHoliday())
->setDay('2012-01-02')
- ->setName('International Testing Day')
+ ->setName(pht('International Testing Day'))
->save();
}
@@ -32,7 +32,7 @@ public function testNthBusinessDay() {
$this->assertEqual(
$expect,
date('Y-m-d', $actual),
- "{$n} business days since '{$date}'");
+ pht("%d business days since '%s'", $n, $date));
}
}
diff --git a/src/applications/calendar/view/AphrontCalendarEventView.php b/src/applications/calendar/view/AphrontCalendarEventView.php
index eb80a3ce49..5bc0b71e31 100644
--- a/src/applications/calendar/view/AphrontCalendarEventView.php
+++ b/src/applications/calendar/view/AphrontCalendarEventView.php
@@ -12,6 +12,7 @@ final class AphrontCalendarEventView extends AphrontView {
private $uri;
private $isAllDay;
private $icon;
+ private $canEdit;
public function setURI($uri) {
$this->uri = $uri;
@@ -97,6 +98,14 @@ public function getIcon() {
return $this->icon;
}
+ public function setCanEdit($can_edit) {
+ $this->canEdit = $can_edit;
+ return $this;
+ }
+
+ public function getCanEdit() {
+ return $this->canEdit;
+ }
public function getMultiDay() {
$nextday = strtotime('12:00 AM Tomorrow', $this->getEpochStart());
@@ -107,7 +116,7 @@ public function getMultiDay() {
}
public function render() {
- throw new Exception('Events are only rendered indirectly.');
+ throw new Exception(pht('Events are only rendered indirectly.'));
}
}
diff --git a/src/applications/celerity/CelerityResourceMap.php b/src/applications/celerity/CelerityResourceMap.php
index 5b0c374dab..7e5e00594b 100644
--- a/src/applications/celerity/CelerityResourceMap.php
+++ b/src/applications/celerity/CelerityResourceMap.php
@@ -43,7 +43,8 @@ public static function getNamedInstance($name) {
if (empty($resources_list[$name])) {
throw new Exception(
pht(
- 'No resource source exists with name "%s"!', $name));
+ 'No resource source exists with name "%s"!',
+ $name));
}
$instance = new CelerityResourceMap($resources_list[$name]);
diff --git a/src/applications/celerity/CelerityResourceMapGenerator.php b/src/applications/celerity/CelerityResourceMapGenerator.php
index 36092e497e..b9c4ddaa37 100644
--- a/src/applications/celerity/CelerityResourceMapGenerator.php
+++ b/src/applications/celerity/CelerityResourceMapGenerator.php
@@ -244,7 +244,10 @@ private function getProvidesAndRequires($name, $data) {
if (count($provides) > 1) {
throw new Exception(
- pht('Resource "%s" must @provide at most one Celerity target.', $name));
+ pht(
+ 'Resource "%s" must %s at most one Celerity target.',
+ $name,
+ '@provide'));
}
return array(head($provides), $requires);
@@ -268,7 +271,9 @@ private function detectGraphCycles(array $nodes) {
$cycle = $graph->detectCycles($provides);
if ($cycle) {
throw new Exception(
- pht('Cycle detected in resource graph: %s', implode(' > ', $cycle)));
+ pht(
+ 'Cycle detected in resource graph: %s',
+ implode(' > ', $cycle)));
}
}
}
@@ -298,9 +303,10 @@ private function rebuildPackages(
throw new Exception(
pht(
'Package specification for "%s" includes "%s", but that symbol '.
- 'is not @provided by any resource.',
+ 'is not %s by any resource.',
$package_name,
- $symbol));
+ $symbol,
+ '@provided'));
}
$resource_name = $reverse_map[$symbol_hash];
diff --git a/src/applications/celerity/CelerityResourceTransformer.php b/src/applications/celerity/CelerityResourceTransformer.php
index 72880c8ce3..ebfae6a8d6 100644
--- a/src/applications/celerity/CelerityResourceTransformer.php
+++ b/src/applications/celerity/CelerityResourceTransformer.php
@@ -332,7 +332,10 @@ public function replaceCSSVariable($matches) {
if (empty($map[$var_name])) {
$path = $this->currentPath;
throw new Exception(
- "CSS file '{$path}' has unknown variable '{$var_name}'.");
+ pht(
+ "CSS file '%s' has unknown variable '%s'.",
+ $path,
+ $var_name));
}
return $map[$var_name];
diff --git a/src/applications/celerity/CeleritySpriteGenerator.php b/src/applications/celerity/CeleritySpriteGenerator.php
index a42fbfa4db..e25e1050a6 100644
--- a/src/applications/celerity/CeleritySpriteGenerator.php
+++ b/src/applications/celerity/CeleritySpriteGenerator.php
@@ -223,8 +223,11 @@ private function getDirectoryList($dir) {
foreach ($images as $image) {
if (!preg_match('/\.png$/', $image)) {
throw new Exception(
- "Expected file '{$image}' in '{$path}' to be a sprite source ".
- "ending in '.png'.");
+ pht(
+ "Expected file '%s' in '%s' to be a sprite source ending in '%s'.",
+ $image,
+ $path,
+ '.png'));
}
$result[] = substr($image, 0, -4);
}
diff --git a/src/applications/celerity/CelerityStaticResourceResponse.php b/src/applications/celerity/CelerityStaticResourceResponse.php
index 7864515e11..cfb586602e 100644
--- a/src/applications/celerity/CelerityStaticResourceResponse.php
+++ b/src/applications/celerity/CelerityStaticResourceResponse.php
@@ -244,10 +244,15 @@ public function renderHTMLFooter() {
public static function renderInlineScript($data) {
if (stripos($data, '') !== false) {
throw new Exception(
- 'Literal is not allowed inside inline script.');
+ pht(
+ 'Literal %s is not allowed inside inline script.',
+ ''));
}
if (strpos($data, ' because it is ignored by HTML parsers. We
// would need to send the document with XHTML content type.
diff --git a/src/applications/celerity/controller/CelerityResourceController.php b/src/applications/celerity/controller/CelerityResourceController.php
index c91f9297c4..717e20f9f9 100644
--- a/src/applications/celerity/controller/CelerityResourceController.php
+++ b/src/applications/celerity/controller/CelerityResourceController.php
@@ -35,7 +35,7 @@ protected function serveResource($path, $package_hash = null) {
$type_map = self::getSupportedResourceTypes();
if (empty($type_map[$type])) {
- throw new Exception('Only static resources may be served.');
+ throw new Exception(pht('Only static resources may be served.'));
}
$dev_mode = PhabricatorEnv::getEnvConfig('phabricator.developer-mode');
diff --git a/src/applications/chatlog/conduit/ChatLogQueryConduitAPIMethod.php b/src/applications/chatlog/conduit/ChatLogQueryConduitAPIMethod.php
index 8270ced921..434a4671e6 100644
--- a/src/applications/chatlog/conduit/ChatLogQueryConduitAPIMethod.php
+++ b/src/applications/chatlog/conduit/ChatLogQueryConduitAPIMethod.php
@@ -11,7 +11,7 @@ public function getMethodStatus() {
}
public function getMethodDescription() {
- return 'Retrieve chatter.';
+ return pht('Retrieve chatter.');
}
protected function defineParamTypes() {
diff --git a/src/applications/chatlog/conduit/ChatLogRecordConduitAPIMethod.php b/src/applications/chatlog/conduit/ChatLogRecordConduitAPIMethod.php
index ca94b91dcc..fe972222ae 100644
--- a/src/applications/chatlog/conduit/ChatLogRecordConduitAPIMethod.php
+++ b/src/applications/chatlog/conduit/ChatLogRecordConduitAPIMethod.php
@@ -11,7 +11,7 @@ public function getMethodStatus() {
}
public function getMethodDescription() {
- return 'Record chatter.';
+ return pht('Record chatter.');
}
protected function defineParamTypes() {
diff --git a/src/applications/chatlog/controller/PhabricatorChatLogChannelListController.php b/src/applications/chatlog/controller/PhabricatorChatLogChannelListController.php
index c557b2bc2f..3b4892bfe8 100644
--- a/src/applications/chatlog/controller/PhabricatorChatLogChannelListController.php
+++ b/src/applications/chatlog/controller/PhabricatorChatLogChannelListController.php
@@ -12,8 +12,8 @@ public function processRequest() {
$user = $request->getUser();
$channels = id(new PhabricatorChatLogChannelQuery())
- ->setViewer($user)
- ->execute();
+ ->setViewer($user)
+ ->execute();
$list = new PHUIObjectItemListView();
foreach ($channels as $channel) {
diff --git a/src/applications/chatlog/controller/PhabricatorChatLogChannelLogController.php b/src/applications/chatlog/controller/PhabricatorChatLogChannelLogController.php
index c7d2dc990e..327024562a 100644
--- a/src/applications/chatlog/controller/PhabricatorChatLogChannelLogController.php
+++ b/src/applications/chatlog/controller/PhabricatorChatLogChannelLogController.php
@@ -29,9 +29,9 @@ public function processRequest() {
->withChannelIDs(array($this->channelID));
$channel = id(new PhabricatorChatLogChannelQuery())
- ->setViewer($user)
- ->withIDs(array($this->channelID))
- ->executeOne();
+ ->setViewer($user)
+ ->withIDs(array($this->channelID))
+ ->executeOne();
if (!$channel) {
return new Aphront404Response();
diff --git a/src/applications/conduit/call/__tests__/ConduitCallTestCase.php b/src/applications/conduit/call/__tests__/ConduitCallTestCase.php
index a5cc190d68..b62ddcef1a 100644
--- a/src/applications/conduit/call/__tests__/ConduitCallTestCase.php
+++ b/src/applications/conduit/call/__tests__/ConduitCallTestCase.php
@@ -21,6 +21,8 @@ public function testConduitAuth() {
$this->assertTrue(
($caught instanceof ConduitException),
- 'user.whoami should require authentication');
+ pht(
+ '%s should require authentication.',
+ 'user.whoami'));
}
}
diff --git a/src/applications/conduit/controller/PhabricatorConduitAPIController.php b/src/applications/conduit/controller/PhabricatorConduitAPIController.php
index cdc14da27d..cee47949d2 100644
--- a/src/applications/conduit/controller/PhabricatorConduitAPIController.php
+++ b/src/applications/conduit/controller/PhabricatorConduitAPIController.php
@@ -176,11 +176,14 @@ private function actAsUser(
$config_key = 'security.allow-conduit-act-as-user';
if (!PhabricatorEnv::getEnvConfig($config_key)) {
- throw new Exception('security.allow-conduit-act-as-user is disabled');
+ throw new Exception(pht('%s is disabled.', $config_key));
}
if (!$api_request->getUser()->getIsAdmin()) {
- throw new Exception('Only administrators can use actAsUser');
+ throw new Exception(
+ pht(
+ 'Only administrators can use %s.',
+ __FUNCTION__));
}
$user = id(new PhabricatorUser())->loadOneWhere(
@@ -189,8 +192,10 @@ private function actAsUser(
if (!$user) {
throw new Exception(
- "The actAsUser username '{$user_name}' is not a valid user."
- );
+ pht(
+ "The %s username '%s' is not a valid user.",
+ __FUNCTION__,
+ $user_name));
}
$api_request->setUser($user);
@@ -224,7 +229,8 @@ private function authenticateUser(
return array(
'ERR-INVALID-AUTH',
pht(
- 'Request is missing required "auth.host" parameter.'),
+ 'Request is missing required "%s" parameter.',
+ 'auth.host'),
);
}
@@ -266,8 +272,7 @@ private function authenticateUser(
if (!$stored_key) {
return array(
'ERR-INVALID-AUTH',
- pht(
- 'No user or device is associated with that public key.'),
+ pht('No user or device is associated with that public key.'),
);
}
@@ -311,7 +316,8 @@ private function authenticateUser(
return array(
'ERR-INVALID-AUTH',
pht(
- 'Provided "auth.type" ("%s") is not recognized.',
+ 'Provided "%s" ("%s") is not recognized.',
+ 'auth.type',
$auth_type),
);
}
@@ -405,8 +411,7 @@ private function authenticateUser(
if (!($user instanceof PhabricatorUser)) {
return array(
'ERR-INVALID-AUTH',
- pht(
- 'API token is not associated with a valid user.'),
+ pht('API token is not associated with a valid user.'),
);
}
@@ -421,12 +426,11 @@ private function authenticateUser(
if ($access_token &&
$method_scope != PhabricatorOAuthServerScope::SCOPE_NOT_ACCESSIBLE) {
$token = id(new PhabricatorOAuthServerAccessToken())
- ->loadOneWhere('token = %s',
- $access_token);
+ ->loadOneWhere('token = %s', $access_token);
if (!$token) {
return array(
'ERR-INVALID-AUTH',
- 'Access token does not exist.',
+ pht('Access token does not exist.'),
);
}
@@ -436,19 +440,18 @@ private function authenticateUser(
if (!$valid) {
return array(
'ERR-INVALID-AUTH',
- 'Access token is invalid.',
+ pht('Access token is invalid.'),
);
}
// valid token, so let's log in the user!
$user_phid = $token->getUserPHID();
$user = id(new PhabricatorUser())
- ->loadOneWhere('phid = %s',
- $user_phid);
+ ->loadOneWhere('phid = %s', $user_phid);
if (!$user) {
return array(
'ERR-INVALID-AUTH',
- 'Access token is for invalid user.',
+ pht('Access token is for invalid user.'),
);
}
return $this->validateAuthenticatedUser(
@@ -467,7 +470,7 @@ private function authenticateUser(
if (!$user) {
return array(
'ERR-INVALID-AUTH',
- 'Authentication is invalid.',
+ pht('Authentication is invalid.'),
);
}
$token = idx($metadata, 'authToken');
@@ -476,7 +479,7 @@ private function authenticateUser(
if (sha1($token.$certificate) !== $signature) {
return array(
'ERR-INVALID-AUTH',
- 'Authentication is invalid.',
+ pht('Authentication is invalid.'),
);
}
return $this->validateAuthenticatedUser(
@@ -491,7 +494,7 @@ private function authenticateUser(
if (!$session_key) {
return array(
'ERR-INVALID-SESSION',
- 'Session key is not present.',
+ pht('Session key is not present.'),
);
}
@@ -501,7 +504,7 @@ private function authenticateUser(
if (!$user) {
return array(
'ERR-INVALID-SESSION',
- 'Session key is invalid.',
+ pht('Session key is invalid.'),
);
}
@@ -642,10 +645,13 @@ private function decodeConduitParams(
// actually do type checking, it might be reasonable to treat it as
// a string if the parameter type is string.
throw new Exception(
- "The value for parameter '{$key}' is not valid JSON. All ".
- "parameters must be encoded as JSON values, including strings ".
- "(which means you need to surround them in double quotes). ".
- "Check your syntax. Value was: {$value}");
+ pht(
+ "The value for parameter '%s' is not valid JSON. All ".
+ "parameters must be encoded as JSON values, including strings ".
+ "(which means you need to surround them in double quotes). ".
+ "Check your syntax. Value was: %s.",
+ $key,
+ $value));
}
$params[$key] = $decoded_value;
}
@@ -666,7 +672,7 @@ private function decodeConduitParams(
} catch (PhutilJSONParserException $ex) {
throw new PhutilProxyException(
pht(
- "Invalid parameter information was passed to method '%s'",
+ "Invalid parameter information was passed to method '%s'.",
$method),
$ex);
}
diff --git a/src/applications/conduit/controller/PhabricatorConduitConsoleController.php b/src/applications/conduit/controller/PhabricatorConduitConsoleController.php
index 5c0ccfe6fb..73e32b49f3 100644
--- a/src/applications/conduit/controller/PhabricatorConduitConsoleController.php
+++ b/src/applications/conduit/controller/PhabricatorConduitConsoleController.php
@@ -46,7 +46,8 @@ public function handleRequest(AphrontRequest $request) {
->appendRemarkupInstructions(
pht(
'Enter parameters using **JSON**. For instance, to enter a '.
- 'list, type: `["apple", "banana", "cherry"]`'));
+ 'list, type: `%s`',
+ '["apple", "banana", "cherry"]'));
$params = $method->getParamTypes();
foreach ($params as $param => $desc) {
@@ -67,12 +68,12 @@ public function handleRequest(AphrontRequest $request) {
$form
->appendChild(
id(new AphrontFormSelectControl())
- ->setLabel('Output Format')
+ ->setLabel(pht('Output Format'))
->setName('output')
->setOptions(
array(
- 'human' => 'Human Readable',
- 'json' => 'JSON',
+ 'human' => pht('Human Readable'),
+ 'json' => pht('JSON'),
)))
->appendChild(
id(new AphrontFormSubmitControl())
diff --git a/src/applications/conduit/controller/PhabricatorConduitLogController.php b/src/applications/conduit/controller/PhabricatorConduitLogController.php
index d8da592372..62f3a24905 100644
--- a/src/applications/conduit/controller/PhabricatorConduitLogController.php
+++ b/src/applications/conduit/controller/PhabricatorConduitLogController.php
@@ -69,7 +69,7 @@ private function renderCallTable(array $calls, array $conns) {
$conn = idx($conns, $call->getConnectionID());
if ($conn) {
$name = $conn->getUserName();
- $client = ' (via '.$conn->getClient().')';
+ $client = ' '.pht('(via %s)', $conn->getClient());
} else {
$name = null;
$client = null;
@@ -98,7 +98,7 @@ private function renderCallTable(array $calls, array $conns) {
array($call->getMethod(), $client),
$status,
$call->getError(),
- number_format($call->getDuration()).' us',
+ pht('%s us', new PhutilNumber($call->getDuration())),
phabricator_datetime($call->getDateCreated(), $viewer),
);
}
diff --git a/src/applications/conduit/method/ConduitAPIMethod.php b/src/applications/conduit/method/ConduitAPIMethod.php
index f6d464cfc5..0643ca72d1 100644
--- a/src/applications/conduit/method/ConduitAPIMethod.php
+++ b/src/applications/conduit/method/ConduitAPIMethod.php
@@ -78,7 +78,7 @@ public function getMethodStatusDescription() {
}
public function getErrorDescription($error_code) {
- return idx($this->getErrorTypes(), $error_code, 'Unknown Error');
+ return idx($this->getErrorTypes(), $error_code, pht('Unknown Error'));
}
public function getRequiredScope() {
@@ -134,9 +134,12 @@ public static function getConduitMethod($method_name) {
$orig_class = get_class($method_map[$name]);
$this_class = get_class($method);
throw new Exception(
- "Two Conduit API method classes ({$orig_class}, {$this_class}) ".
- "both have the same method name ({$name}). API methods ".
- "must have unique method names.");
+ pht(
+ 'Two Conduit API method classes (%s, %s) both have the same '.
+ 'method name (%s). API methods must have unique method names.',
+ $orig_class,
+ $this_class,
+ $name));
}
}
diff --git a/src/applications/conduit/method/ConduitConnectConduitAPIMethod.php b/src/applications/conduit/method/ConduitConnectConduitAPIMethod.php
index 12f08f8636..a6ec09ae09 100644
--- a/src/applications/conduit/method/ConduitConnectConduitAPIMethod.php
+++ b/src/applications/conduit/method/ConduitConnectConduitAPIMethod.php
@@ -15,7 +15,7 @@ public function shouldAllowUnguardedWrites() {
}
public function getMethodDescription() {
- return 'Connect a session-based client.';
+ return pht('Connect a session-based client.');
}
protected function defineParamTypes() {
@@ -36,22 +36,21 @@ protected function defineReturnType() {
protected function defineErrorTypes() {
return array(
- 'ERR-BAD-VERSION' =>
+ 'ERR-BAD-VERSION' => pht(
'Client/server version mismatch. Upgrade your server or downgrade '.
- 'your client.',
- 'NEW-ARC-VERSION' =>
- 'Client/server version mismatch. Upgrade your client.',
- 'ERR-UNKNOWN-CLIENT' =>
- 'Client is unknown.',
- 'ERR-INVALID-USER' =>
- 'The username you are attempting to authenticate with is not valid.',
- 'ERR-INVALID-CERTIFICATE' =>
- 'Your authentication certificate for this server is invalid.',
- 'ERR-INVALID-TOKEN' =>
+ 'your client.'),
+ 'NEW-ARC-VERSION' => pht(
+ 'Client/server version mismatch. Upgrade your client.'),
+ 'ERR-UNKNOWN-CLIENT' => pht('Client is unknown.'),
+ 'ERR-INVALID-USER' => pht(
+ 'The username you are attempting to authenticate with is not valid.'),
+ 'ERR-INVALID-CERTIFICATE' => pht(
+ 'Your authentication certificate for this server is invalid.'),
+ 'ERR-INVALID-TOKEN' => pht(
"The challenge token you are authenticating with is outside of the ".
"allowed time range. Either your system clock is out of whack or ".
- "you're executing a replay attack.",
- 'ERR-NO-CERTIFICATE' => 'This server requires authentication.',
+ "you're executing a replay attack."),
+ 'ERR-NO-CERTIFICATE' => pht('This server requires authentication.'),
);
}
@@ -87,16 +86,21 @@ protected function execute(ConduitAPIRequest $request) {
if ($server_version < $client_version) {
$ex = new ConduitException('ERR-BAD-VERSION');
$ex->setErrorDescription(
- "Your 'arc' client version is '{$client_version}', which ".
- "is newer than the server version, '{$server_version}'. ".
- "Upgrade your Phabricator install.");
+ pht(
+ "Your '%s' client version is '%d', which is newer than the ".
+ "server version, '%d'. Upgrade your Phabricator install.",
+ 'arc',
+ $client_version,
+ $server_version));
} else {
$ex = new ConduitException('NEW-ARC-VERSION');
$ex->setErrorDescription(
- "A new version of arc is available! You need to upgrade ".
- "to connect to this server (you are running version ".
- "{$client_version}, the server is running version ".
- "{$server_version}).");
+ pht(
+ 'A new version of arc is available! You need to upgrade '.
+ 'to connect to this server (you are running version '.
+ '%d, the server is running version %d).',
+ $client_version,
+ $server_version));
}
throw $ex;
}
diff --git a/src/applications/conduit/method/ConduitGetCertificateConduitAPIMethod.php b/src/applications/conduit/method/ConduitGetCertificateConduitAPIMethod.php
index be14610796..6248b5a6ba 100644
--- a/src/applications/conduit/method/ConduitGetCertificateConduitAPIMethod.php
+++ b/src/applications/conduit/method/ConduitGetCertificateConduitAPIMethod.php
@@ -16,7 +16,7 @@ public function shouldAllowUnguardedWrites() {
}
public function getMethodDescription() {
- return 'Retrieve certificate information for a user.';
+ return pht('Retrieve certificate information for a user.');
}
protected function defineParamTypes() {
@@ -32,10 +32,10 @@ protected function defineReturnType() {
protected function defineErrorTypes() {
return array(
- 'ERR-BAD-TOKEN' => 'Token does not exist or has expired.',
- 'ERR-RATE-LIMIT' =>
+ 'ERR-BAD-TOKEN' => pht('Token does not exist or has expired.'),
+ 'ERR-RATE-LIMIT' => pht(
'You have made too many invalid token requests recently. Wait before '.
- 'making more.',
+ 'making more.'),
);
}
@@ -69,7 +69,7 @@ protected function execute(ConduitAPIRequest $request) {
'phid = %s',
$info->getUserPHID());
if (!$user) {
- throw new Exception('Certificate token points to an invalid user!');
+ throw new Exception(pht('Certificate token points to an invalid user!'));
}
return array(
diff --git a/src/applications/conduit/method/ConduitPingConduitAPIMethod.php b/src/applications/conduit/method/ConduitPingConduitAPIMethod.php
index f3c502defa..9e0c1d4ff5 100644
--- a/src/applications/conduit/method/ConduitPingConduitAPIMethod.php
+++ b/src/applications/conduit/method/ConduitPingConduitAPIMethod.php
@@ -11,7 +11,7 @@ public function shouldRequireAuthentication() {
}
public function getMethodDescription() {
- return 'Basic ping for monitoring or a health-check.';
+ return pht('Basic ping for monitoring or a health-check.');
}
protected function defineParamTypes() {
diff --git a/src/applications/conduit/method/ConduitQueryConduitAPIMethod.php b/src/applications/conduit/method/ConduitQueryConduitAPIMethod.php
index f5162a04fc..6cd9283b4c 100644
--- a/src/applications/conduit/method/ConduitQueryConduitAPIMethod.php
+++ b/src/applications/conduit/method/ConduitQueryConduitAPIMethod.php
@@ -7,7 +7,7 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return 'Returns the parameters of the Conduit methods.';
+ return pht('Returns the parameters of the Conduit methods.');
}
protected function defineParamTypes() {
diff --git a/src/applications/conduit/protocol/ConduitAPIRequest.php b/src/applications/conduit/protocol/ConduitAPIRequest.php
index 7e5a8ae515..fe8af34b65 100644
--- a/src/applications/conduit/protocol/ConduitAPIRequest.php
+++ b/src/applications/conduit/protocol/ConduitAPIRequest.php
@@ -36,9 +36,10 @@ public function setUser(PhabricatorUser $user) {
public function getUser() {
if (!$this->user) {
throw new Exception(
- 'You can not access the user inside the implementation of a Conduit '.
- 'method which does not require authentication (as per '.
- 'shouldRequireAuthentication()).');
+ pht(
+ 'You can not access the user inside the implementation of a Conduit '.
+ 'method which does not require authentication (as per %s).',
+ 'shouldRequireAuthentication()'));
}
return $this->user;
}
diff --git a/src/applications/conduit/query/PhabricatorConduitSearchEngine.php b/src/applications/conduit/query/PhabricatorConduitSearchEngine.php
index 0ed7a95b44..eece3e5c17 100644
--- a/src/applications/conduit/query/PhabricatorConduitSearchEngine.php
+++ b/src/applications/conduit/query/PhabricatorConduitSearchEngine.php
@@ -58,7 +58,7 @@ public function buildSearchForm(
$form
->appendChild(
id(new AphrontFormTextControl())
- ->setLabel('Name Contains')
+ ->setLabel(pht('Name Contains'))
->setName('nameContains')
->setValue($saved->getParameter('nameContains')));
@@ -66,12 +66,13 @@ public function buildSearchForm(
$form
->appendChild(
id(new AphrontFormTextControl())
- ->setLabel('Applications')
+ ->setLabel(pht('Applications'))
->setName('applicationNames')
->setValue(implode(', ', $names))
- ->setCaption(pht(
- 'Example: %s',
- phutil_tag('tt', array(), 'differential, paste'))));
+ ->setCaption(
+ pht(
+ 'Example: %s',
+ phutil_tag('tt', array(), 'differential, paste'))));
$is_stable = $saved->getParameter('isStable');
$is_unstable = $saved->getParameter('isUnstable');
diff --git a/src/applications/conduit/ssh/ConduitSSHWorkflow.php b/src/applications/conduit/ssh/ConduitSSHWorkflow.php
index aed7004d7e..6589fac324 100644
--- a/src/applications/conduit/ssh/ConduitSSHWorkflow.php
+++ b/src/applications/conduit/ssh/ConduitSSHWorkflow.php
@@ -18,9 +18,9 @@ public function execute(PhutilArgumentParser $args) {
$methodv = $args->getArg('method');
if (!$methodv) {
- throw new Exception('No Conduit method provided.');
+ throw new Exception(pht('No Conduit method provided.'));
} else if (count($methodv) > 1) {
- throw new Exception('Too many Conduit methods provided.');
+ throw new Exception(pht('Too many Conduit methods provided.'));
}
$method = head($methodv);
diff --git a/src/applications/config/check/PhabricatorAuthSetupCheck.php b/src/applications/config/check/PhabricatorAuthSetupCheck.php
index 5d4f731867..0295a85b2d 100644
--- a/src/applications/config/check/PhabricatorAuthSetupCheck.php
+++ b/src/applications/config/check/PhabricatorAuthSetupCheck.php
@@ -27,13 +27,8 @@ protected function executeChecks() {
'You have not configured any authentication providers yet. You '.
'should add a provider (like username/password, LDAP, or GitHub '.
'OAuth) so users can register and log in. You can add and configure '.
- 'providers %s.',
- phutil_tag(
- 'a',
- array(
- 'href' => '/auth/',
- ),
- pht('using the "Auth" application')));
+ 'providers using the [[%s | "Auth" application]].',
+ '/auth/');
$this
->newIssue('auth.noproviders')
diff --git a/src/applications/config/check/PhabricatorBinariesSetupCheck.php b/src/applications/config/check/PhabricatorBinariesSetupCheck.php
index 87887d4a96..59dc3a78ab 100644
--- a/src/applications/config/check/PhabricatorBinariesSetupCheck.php
+++ b/src/applications/config/check/PhabricatorBinariesSetupCheck.php
@@ -7,7 +7,6 @@ public function getDefaultGroup() {
}
protected function executeChecks() {
-
if (phutil_is_windows()) {
$bin_name = 'where';
} else {
@@ -28,8 +27,9 @@ protected function executeChecks() {
if (!Filesystem::binaryExists('diff')) {
$message = pht(
- "Without 'diff', Phabricator will not be able to generate or render ".
- "diffs in multiple applications.");
+ "Without '%s', Phabricator will not be able to generate or render ".
+ "diffs in multiple applications.",
+ 'diff');
$this->raiseWarning('diff', $message);
} else {
$tmp_a = new TempFile();
@@ -43,12 +43,13 @@ protected function executeChecks() {
list($err) = exec_manual('diff %s %s', $tmp_a, $tmp_b);
if ($err) {
$this->newIssue('bin.diff.same')
- ->setName(pht("Unexpected 'diff' Behavior"))
+ ->setName(pht("Unexpected '%s' Behavior", 'diff'))
->setMessage(
pht(
- "The 'diff' binary on this system has unexpected behavior: ".
+ "The '%s' binary on this system has unexpected behavior: ".
"it was expected to exit without an error code when passed ".
"identical files, but exited with code %d.",
+ 'diff',
$err));
}
@@ -58,9 +59,10 @@ protected function executeChecks() {
->setName(pht("Unexpected 'diff' Behavior"))
->setMessage(
pht(
- "The 'diff' binary on this system has unexpected behavior: ".
+ "The '%s' binary on this system has unexpected behavior: ".
"it was expected to exit with a nonzero error code when passed ".
- "differing files, but did not."));
+ "differing files, but did not.",
+ 'diff'));
}
}
@@ -249,7 +251,6 @@ private function raiseMinimumVersionWarning(
}
private function raiseBadVersionWarning($binary, $bad_version) {
-
switch ($binary) {
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
break;
diff --git a/src/applications/config/check/PhabricatorDaemonsSetupCheck.php b/src/applications/config/check/PhabricatorDaemonsSetupCheck.php
index a6b9ef8488..3b4b335134 100644
--- a/src/applications/config/check/PhabricatorDaemonsSetupCheck.php
+++ b/src/applications/config/check/PhabricatorDaemonsSetupCheck.php
@@ -16,8 +16,7 @@ protected function executeChecks() {
->execute();
if (!$task_daemon) {
- $doc_href = PhabricatorEnv::getDocLink(
- 'Managing Daemons with phd');
+ $doc_href = PhabricatorEnv::getDocLink('Managing Daemons with phd');
$summary = pht(
'You must start the Phabricator daemons to send email, rebuild '.
@@ -57,24 +56,29 @@ protected function executeChecks() {
if ($phd_user) {
if ($daemon->getRunningAsUser() != $phd_user) {
- $doc_href = PhabricatorEnv::getDocLink(
- 'Managing Daemons with phd');
+ $doc_href = PhabricatorEnv::getDocLink('Managing Daemons with phd');
$summary = pht(
'At least one daemon is currently running as a different '.
- 'user than configured in the Phabricator phd.user setting');
+ 'user than configured in the Phabricator %s setting',
+ 'phd.user');
$message = pht(
'A daemon is running as user %s while the Phabricator config '.
- 'specifies phd.user to be %s.'.
+ 'specifies %s to be %s.'.
"\n\n".
- 'Either adjust phd.user to match %s or start '.
+ 'Either adjust %s to match %s or start '.
'the daemons as the correct user. '.
"\n\n".
- 'phd Daemons will try to '.
- 'use sudo to start as the configured user. '.
- 'Make sure that the user who starts phd has the correct '.
- 'sudo permissions to start phd daemons as %s',
+ '%s Daemons will try to use %s to start as the configured user. '.
+ 'Make sure that the user who starts %s has the correct '.
+ 'sudo permissions to start %s daemons as %s',
+ 'phd.user',
+ 'phd.user',
+ 'phd',
+ 'sudo',
+ 'phd',
+ 'phd',
phutil_tag('tt', array(), $daemon->getRunningAsUser()),
phutil_tag('tt', array(), $phd_user),
phutil_tag('tt', array(), $daemon->getRunningAsUser()),
diff --git a/src/applications/config/check/PhabricatorDatabaseSetupCheck.php b/src/applications/config/check/PhabricatorDatabaseSetupCheck.php
index 3f7af1bdb4..4ee0a75c6f 100644
--- a/src/applications/config/check/PhabricatorDatabaseSetupCheck.php
+++ b/src/applications/config/check/PhabricatorDatabaseSetupCheck.php
@@ -79,8 +79,8 @@ protected function executeChecks() {
if (empty($databases[$namespace.'_meta_data'])) {
$message = pht(
- 'Run the storage upgrade script to setup Phabricator\'s database '.
- 'schema.');
+ "Run the storage upgrade script to setup Phabricator's database ".
+ "schema.");
$this->newIssue('storage.upgrade')
->setName(pht('Setup MySQL Schema'))
@@ -103,10 +103,11 @@ protected function executeChecks() {
if ($diff) {
$this->newIssue('storage.patch')
->setName(pht('Upgrade MySQL Schema'))
- ->setMessage(pht(
- "Run the storage upgrade script to upgrade Phabricator's database ".
- "schema. Missing patches: %s ",
- phutil_implode_html(phutil_tag('br'), array_keys($diff))))
+ ->setMessage(
+ pht(
+ "Run the storage upgrade script to upgrade Phabricator's ".
+ "database schema. Missing patches: %s ",
+ phutil_implode_html(phutil_tag('br'), array_keys($diff))))
->addCommand(
hsprintf('phabricator/ $ ./bin/storage upgrade'));
}
@@ -123,13 +124,15 @@ protected function executeChecks() {
->setName(pht('Deprecated mysql.host Format'))
->setSummary(
pht(
- 'Move port information from `mysql.host` to `mysql.port` in your '.
- 'config.'))
+ 'Move port information from `%s` to `%s` in your config.',
+ 'mysql.host',
+ 'mysql.port'))
->setMessage(
pht(
- 'Your `mysql.host` configuration contains a port number, but '.
- 'this usage is deprecated. Instead, put the port number in '.
- '`mysql.port`.'))
+ 'Your `%s` configuration contains a port number, but this usage '.
+ 'is deprecated. Instead, put the port number in `%s`.',
+ 'mysql.host',
+ 'mysql.port'))
->addPhabricatorConfig('mysql.host')
->addPhabricatorConfig('mysql.port')
->addCommand(
diff --git a/src/applications/config/check/PhabricatorElasticSearchSetupCheck.php b/src/applications/config/check/PhabricatorElasticSearchSetupCheck.php
index a573c14490..47a3cb4b18 100644
--- a/src/applications/config/check/PhabricatorElasticSearchSetupCheck.php
+++ b/src/applications/config/check/PhabricatorElasticSearchSetupCheck.php
@@ -7,44 +7,71 @@ public function getDefaultGroup() {
}
protected function executeChecks() {
- if ($this->shouldUseElasticSearchEngine()) {
- $engine = new PhabricatorElasticSearchEngine();
-
- if (!$engine->indexExists()) {
- $summary = pht(
- 'You enabled Elasticsearch but the index does not exist.');
-
- $message = pht(
- 'You likely enabled search.elastic.host without creating the '.
- 'index. Run `./bin/search init` to correct the index.');
-
- $this
- ->newIssue('elastic.missing-index')
- ->setName(pht('Elasticsearch index Not Found'))
- ->setSummary($summary)
- ->setMessage($message)
- ->addRelatedPhabricatorConfig('search.elastic.host');
- } else if (!$engine->indexIsSane()) {
- $summary = pht(
- 'Elasticsearch index exists but needs correction.');
-
- $message = pht(
- 'Either the Phabricator schema for Elasticsearch has changed '.
- 'or Elasticsearch created the index automatically. Run '.
- '`./bin/search init` to correct the index.');
-
- $this
- ->newIssue('elastic.broken-index')
- ->setName(pht('Elasticsearch index Incorrect'))
- ->setSummary($summary)
- ->setMessage($message);
+ if (!$this->shouldUseElasticSearchEngine()) {
+ return;
+ }
+
+ $engine = new PhabricatorElasticSearchEngine();
+
+ $index_exists = null;
+ $index_sane = null;
+ try {
+ $index_exists = $engine->indexExists();
+ if ($index_exists) {
+ $index_sane = $engine->indexIsSane();
}
+ } catch (Exception $ex) {
+ $summary = pht('Elasticsearch is not reachable as configured.');
+ $message = pht(
+ 'Elasticsearch is configured (with the %s setting) but Phabricator '.
+ 'encountered an exception when trying to test the index.'.
+ "\n\n".
+ '%s',
+ phutil_tag('tt', array(), 'search.elastic.host'),
+ phutil_tag('pre', array(), $ex->getMessage()));
+
+ $this->newIssue('elastic.misconfigured')
+ ->setName(pht('Elasticsearch Misconfigured'))
+ ->setSummary($summary)
+ ->setMessage($message)
+ ->addRelatedPhabricatorConfig('search.elastic.host');
+ return;
+ }
+
+ if (!$index_exists) {
+ $summary = pht(
+ 'You enabled Elasticsearch but the index does not exist.');
+
+ $message = pht(
+ 'You likely enabled search.elastic.host without creating the '.
+ 'index. Run `./bin/search init` to correct the index.');
+
+ $this
+ ->newIssue('elastic.missing-index')
+ ->setName(pht('Elasticsearch index Not Found'))
+ ->setSummary($summary)
+ ->setMessage($message)
+ ->addRelatedPhabricatorConfig('search.elastic.host');
+ } else if (!$index_sane) {
+ $summary = pht(
+ 'Elasticsearch index exists but needs correction.');
+
+ $message = pht(
+ 'Either the Phabricator schema for Elasticsearch has changed '.
+ 'or Elasticsearch created the index automatically. Run '.
+ '`./bin/search init` to correct the index.');
+
+ $this
+ ->newIssue('elastic.broken-index')
+ ->setName(pht('Elasticsearch index Incorrect'))
+ ->setSummary($summary)
+ ->setMessage($message);
}
}
protected function shouldUseElasticSearchEngine() {
$search_engine = PhabricatorSearchEngine::loadEngine();
- return $search_engine instanceof PhabricatorElasticSearchEngine;
+ return ($search_engine instanceof PhabricatorElasticSearchEngine);
}
}
diff --git a/src/applications/config/check/PhabricatorExtraConfigSetupCheck.php b/src/applications/config/check/PhabricatorExtraConfigSetupCheck.php
index 2d69334c47..b3c294b3e6 100644
--- a/src/applications/config/check/PhabricatorExtraConfigSetupCheck.php
+++ b/src/applications/config/check/PhabricatorExtraConfigSetupCheck.php
@@ -147,8 +147,9 @@ public static function getAncientConfig() {
$markup_reason = pht(
'Custom remarkup rules are now added by subclassing '.
- 'PhabricatorRemarkupCustomInlineRule or '.
- 'PhabricatorRemarkupCustomBlockRule.');
+ '%s or %s.',
+ 'PhabricatorRemarkupCustomInlineRule',
+ 'PhabricatorRemarkupCustomBlockRule');
$session_reason = pht(
'Sessions now expire and are garbage collected rather than having an '.
@@ -171,27 +172,33 @@ public static function getAncientConfig() {
'Phabricator no longer supports global customization of monospaced '.
'fonts.');
+ $public_mail_reason = pht(
+ 'Inbound mail addresses are now configured for each application '.
+ 'in the Applications tool.');
+
$ancient_config += array(
'phid.external-loaders' =>
pht(
- 'External loaders have been replaced. Extend `PhabricatorPHIDType` '.
- 'to implement new PHID and handle types.'),
+ 'External loaders have been replaced. Extend `%s` '.
+ 'to implement new PHID and handle types.',
+ 'PhabricatorPHIDType'),
'maniphest.custom-task-extensions-class' =>
pht(
- 'Maniphest fields are now loaded automatically. You can configure '.
- 'them with `maniphest.fields`.'),
+ 'Maniphest fields are now loaded automatically. '.
+ 'You can configure them with `%s`.',
+ 'maniphest.fields'),
'maniphest.custom-fields' =>
pht(
- 'Maniphest fields are now defined in '.
- '`maniphest.custom-field-definitions`. Existing definitions have '.
- 'been migrated.'),
+ 'Maniphest fields are now defined in `%s`. '.
+ 'Existing definitions have been migrated.',
+ 'maniphest.custom-field-definitions'),
'differential.custom-remarkup-rules' => $markup_reason,
'differential.custom-remarkup-block-rules' => $markup_reason,
'auth.sshkeys.enabled' => pht(
'SSH keys are now actually useful, so they are always enabled.'),
'differential.anonymous-access' => pht(
- 'Phabricator now has meaningful global access controls. See '.
- '`policy.allow-public`.'),
+ 'Phabricator now has meaningful global access controls. See `%s`.',
+ 'policy.allow-public'),
'celerity.resource-path' => pht(
'An alternate resource map is no longer supported. Instead, use '.
'multiple maps. See T4222.'),
@@ -207,9 +214,10 @@ public static function getAncientConfig() {
'differential.show-test-plan-field' => $differential_field_reason,
'differential.field-selector' => $differential_field_reason,
'phabricator.show-beta-applications' => pht(
- 'This option has been renamed to `phabricator.show-prototypes` '.
- 'to emphasize the unfinished nature of many prototype applications. '.
- 'Your existing setting has been migrated.'),
+ 'This option has been renamed to `%s` to emphasize the '.
+ 'unfinished nature of many prototype applications. '.
+ 'Your existing setting has been migrated.',
+ 'phabricator.show-prototypes'),
'notification.user' => pht(
'The notification server no longer requires root permissions. Start '.
'the server as the user you want it to run under.'),
@@ -219,10 +227,12 @@ public static function getAncientConfig() {
'The translation implementation has changed and providers are no '.
'longer used or supported.'),
'config.mask' => pht(
- 'Use `config.hide` instead of this option.'),
+ 'Use `%s` instead of this option.',
+ 'config.hide'),
'phd.start-taskmasters' => pht(
'Taskmasters now use an autoscaling pool. You can configure the '.
- 'pool size with `phd.taskmasters`.'),
+ 'pool size with `%s`.',
+ 'phd.taskmasters'),
'storage.engine-selector' => pht(
'Phabricator now automatically discovers available storage engines '.
'at runtime.'),
@@ -230,8 +240,8 @@ public static function getAncientConfig() {
'Phabricator now supports arbitrarily large files. Consult the '.
'documentation for configuration details.'),
'security.allow-outbound-http' => pht(
- 'This option has been replaced with the more granular option '.
- '`security.outbound-blacklist`.'),
+ 'This option has been replaced with the more granular option `%s`.',
+ 'security.outbound-blacklist'),
'metamta.reply.show-hints' => pht(
'Phabricator no longer shows reply hints in mail.'),
@@ -256,6 +266,11 @@ public static function getAncientConfig() {
'search.engine-selector' => pht(
'Phabricator now automatically discovers available search engines '.
'at runtime.'),
+
+ 'metamta.files.public-create-email' => $public_mail_reason,
+ 'metamta.maniphest.public-create-email' => $public_mail_reason,
+ 'metamta.maniphest.default-public-author' => $public_mail_reason,
+ 'metamta.paste.public-create-email' => $public_mail_reason,
);
return $ancient_config;
diff --git a/src/applications/config/check/PhabricatorFileinfoSetupCheck.php b/src/applications/config/check/PhabricatorFileinfoSetupCheck.php
index 4f5013c033..543fc4fb7c 100644
--- a/src/applications/config/check/PhabricatorFileinfoSetupCheck.php
+++ b/src/applications/config/check/PhabricatorFileinfoSetupCheck.php
@@ -9,12 +9,14 @@ public function getDefaultGroup() {
protected function executeChecks() {
if (!extension_loaded('fileinfo')) {
$message = pht(
- "The 'fileinfo' extension is not installed. Without 'fileinfo', ".
+ "The '%s' extension is not installed. Without '%s', ".
"support, Phabricator may not be able to determine the MIME types ".
- "of uploaded files.");
+ "of uploaded files.",
+ 'fileinfo',
+ 'fileinfo');
$this->newIssue('extension.fileinfo')
- ->setName(pht("Missing 'fileinfo' Extension"))
+ ->setName(pht("Missing '%s' Extension", 'fileinfo'))
->setMessage($message);
}
}
diff --git a/src/applications/config/check/PhabricatorGDSetupCheck.php b/src/applications/config/check/PhabricatorGDSetupCheck.php
index f738715bce..750702c706 100644
--- a/src/applications/config/check/PhabricatorGDSetupCheck.php
+++ b/src/applications/config/check/PhabricatorGDSetupCheck.php
@@ -9,12 +9,15 @@ public function getDefaultGroup() {
protected function executeChecks() {
if (!extension_loaded('gd')) {
$message = pht(
- "The 'gd' extension is not installed. Without 'gd', support, ".
+ "The '%s' extension is not installed. Without '%s', support, ".
"Phabricator will not be able to process or resize images ".
- "(for example, to generate thumbnails). Install or enable 'gd'.");
+ "(for example, to generate thumbnails). Install or enable '%s'.",
+ 'gd',
+ 'gd',
+ 'gd');
$this->newIssue('extension.gd')
- ->setName(pht("Missing 'gd' Extension"))
+ ->setName(pht("Missing '%s' Extension", 'gd'))
->setMessage($message);
} else {
$image_type_map = array(
@@ -36,15 +39,17 @@ protected function executeChecks() {
$have = implode(', ', $have);
$message = pht(
- "The 'gd' extension has support for only some image types. ".
+ "The '%s' extension has support for only some image types. ".
"Phabricator will be unable to process images of the missing ".
- "types until you build 'gd' with support for them. ".
+ "types until you build '%s' with support for them. ".
"Supported types: %s. Missing types: %s.",
+ 'gd',
+ 'gd',
$have,
$missing);
$this->newIssue('extension.gd.support')
- ->setName(pht("Partial 'gd' Support"))
+ ->setName(pht("Partial '%s' Support", 'gd'))
->setMessage($message);
}
}
diff --git a/src/applications/config/check/PhabricatorImagemagickSetupCheck.php b/src/applications/config/check/PhabricatorImagemagickSetupCheck.php
index 55c538f3a2..a69781132e 100644
--- a/src/applications/config/check/PhabricatorImagemagickSetupCheck.php
+++ b/src/applications/config/check/PhabricatorImagemagickSetupCheck.php
@@ -11,13 +11,15 @@ protected function executeChecks() {
if ($imagemagick) {
if (!Filesystem::binaryExists('convert')) {
$message = pht(
- 'You have enabled Imagemagick in your config, but the \'convert\' '.
- 'binary is not in the webserver\'s $PATH. Disable imagemagick '.
- 'or make it available to the webserver.');
+ "You have enabled Imagemagick in your config, but the '%s' ".
+ "binary is not in the webserver's %s. Disable imagemagick ".
+ "or make it available to the webserver.",
+ 'convert',
+ '$PATH');
$this->newIssue('files.enable-imagemagick')
->setName(pht(
- "'convert' binary not found or Imagemagick is not installed."))
+ "'%s' binary not found or Imagemagick is not installed.", 'convert'))
->setMessage($message)
->addRelatedPhabricatorConfig('files.enable-imagemagick')
->addPhabricatorConfig('environment.append-paths');
diff --git a/src/applications/config/check/PhabricatorMySQLSetupCheck.php b/src/applications/config/check/PhabricatorMySQLSetupCheck.php
index a5178cc9ed..75ecc06239 100644
--- a/src/applications/config/check/PhabricatorMySQLSetupCheck.php
+++ b/src/applications/config/check/PhabricatorMySQLSetupCheck.php
@@ -27,14 +27,15 @@ protected function executeChecks() {
$recommended_minimum = (32 * 1024 * 1024);
if ($max_allowed_packet < $recommended_minimum) {
$message = pht(
- "MySQL is configured with a small 'max_allowed_packet' (%d), ".
+ "MySQL is configured with a small '%s' (%d), ".
"which may cause some large writes to fail. Strongly consider raising ".
"this to at least %d in your MySQL configuration.",
+ 'max_allowed_packet',
$max_allowed_packet,
$recommended_minimum);
$this->newIssue('mysql.max_allowed_packet')
- ->setName(pht('Small MySQL "max_allowed_packet"'))
+ ->setName(pht('Small MySQL "%s"', 'max_allowed_packet'))
->setMessage($message)
->addMySQLConfig('max_allowed_packet');
}
@@ -70,7 +71,7 @@ protected function executeChecks() {
phutil_tag('pre', array(), 'sql_mode=STRICT_ALL_TABLES'));
$this->newIssue('mysql.mode')
- ->setName(pht('MySQL STRICT_ALL_TABLES Mode Not Set'))
+ ->setName(pht('MySQL %s Mode Not Set', 'STRICT_ALL_TABLES'))
->setSummary($summary)
->setMessage($message)
->addMySQLConfig('sql_mode');
@@ -109,7 +110,7 @@ protected function executeChecks() {
phutil_tag('tt', array(), 'ONLY_FULL_GROUP_BY'));
$this->newIssue('mysql.mode')
- ->setName(pht('MySQL ONLY_FULL_GROUP_BY Mode Set'))
+ ->setName(pht('MySQL %s Mode Set', 'ONLY_FULL_GROUP_BY'))
->setSummary($summary)
->setMessage($message)
->addMySQLConfig('sql_mode');
@@ -134,7 +135,7 @@ protected function executeChecks() {
phutil_tag('tt', array(), 'ft_stopword_file'));
$this->newIssue('mysql.ft_stopword_file')
- ->setName(pht('MySQL ft_stopword_file Not Supported'))
+ ->setName(pht('MySQL %s Not Supported', 'ft_stopword_file'))
->setSummary($summary)
->setMessage($message)
->addMySQLConfig('ft_stopword_file');
diff --git a/src/applications/config/check/PhabricatorPHPConfigSetupCheck.php b/src/applications/config/check/PhabricatorPHPConfigSetupCheck.php
index 57d97226a6..03bbb3c52d 100644
--- a/src/applications/config/check/PhabricatorPHPConfigSetupCheck.php
+++ b/src/applications/config/check/PhabricatorPHPConfigSetupCheck.php
@@ -14,15 +14,14 @@ protected function executeChecks() {
$safe_mode = ini_get('safe_mode');
if ($safe_mode) {
$message = pht(
- "You have 'safe_mode' enabled in your PHP configuration, but ".
- "Phabricator will not run in safe mode. Safe mode has been deprecated ".
- "in PHP 5.3 and removed in PHP 5.4.".
- "\n\n".
- "Disable safe mode to continue.");
+ "You have '%s' enabled in your PHP configuration, but Phabricator ".
+ "will not run in safe mode. Safe mode has been deprecated in PHP 5.3 ".
+ "and removed in PHP 5.4.\n\nDisable safe mode to continue.",
+ 'safe_mode');
$this->newIssue('php.safe_mode')
->setIsFatal(true)
- ->setName(pht('Disable PHP safe_mode'))
+ ->setName(pht('Disable PHP %s', 'safe_mode'))
->setMessage($message)
->addPHPConfig('safe_mode');
return;
@@ -146,17 +145,15 @@ protected function executeChecks() {
}
$issue = $this->newIssue('php.open_basedir')
- ->setName(pht('Disable PHP open_basedir'))
+ ->setName(pht('Disable PHP %s', 'open_basedir'))
->addPHPConfig('open_basedir');
if ($failures) {
$message = pht(
- "Your server is configured with 'open_basedir', which prevents ".
- "Phabricator from opening files it requires access to.".
- "\n\n".
- "Disable this setting to continue.".
- "\n\n".
- "Failures:\n\n%s",
+ "Your server is configured with '%s', which prevents Phabricator ".
+ "from opening files it requires access to.\n\n".
+ "Disable this setting to continue.\n\nFailures:\n\n%s",
+ 'open_basedir',
implode("\n\n", $failures));
$issue
@@ -166,15 +163,17 @@ protected function executeChecks() {
return;
} else {
$summary = pht(
- "You have 'open_basedir' configured in your PHP settings, which ".
- "may cause some features to fail.");
+ "You have '%s' configured in your PHP settings, which ".
+ "may cause some features to fail.",
+ 'open_basedir');
$message = pht(
- "You have 'open_basedir' configured in your PHP settings. Although ".
- "this setting appears permissive enough that Phabricator will ".
- "work properly, you may still run into problems because of it.".
- "\n\n".
- "Consider disabling 'open_basedir'.");
+ "You have '%s' configured in your PHP settings. Although this ".
+ "setting appears permissive enough that Phabricator will work ".
+ "properly, you may still run into problems because of it.\n\n".
+ "Consider disabling '%s'.",
+ 'open_basedir',
+ 'open_basedir');
$issue
->setSummary($summary)
diff --git a/src/applications/config/check/PhabricatorPathSetupCheck.php b/src/applications/config/check/PhabricatorPathSetupCheck.php
index 4833e4861a..618c81abb9 100644
--- a/src/applications/config/check/PhabricatorPathSetupCheck.php
+++ b/src/applications/config/check/PhabricatorPathSetupCheck.php
@@ -13,19 +13,25 @@ protected function executeChecks() {
if (!$path) {
$summary = pht(
- 'The environmental variable $PATH is empty. Phabricator will not '.
- 'be able to execute some commands.');
+ 'The environmental variable %s is empty. Phabricator will not '.
+ 'be able to execute some commands.',
+ '$PATH');
$message = pht(
- 'The environmental variable $PATH is empty. Phabricator needs to '.
- 'execute some system commands, like `svn`, `git`, `hg`, and `diff`. '.
- 'To execute these commands, the binaries must be available in the '.
- 'webserver\'s $PATH. You can set additional paths in Phabricator '.
- 'configuration.');
+ "The environmental variable %s is empty. Phabricator needs to execute ".
+ "some system commands, like `%s`, `%s`, `%s`, and `%s`. To execute ".
+ "these commands, the binaries must be available in the webserver's ".
+ "%s. You can set additional paths in Phabricator configuration.",
+ '$PATH',
+ 'svn',
+ 'git',
+ 'hg',
+ 'diff',
+ '$PATH');
$this
->newIssue('config.environment.append-paths')
- ->setName(pht('$PATH Not Set'))
+ ->setName(pht('%s Not Set', '$PATH'))
->setSummary($summary)
->setMessage($message)
->addPhabricatorConfig('environment.append-paths');
@@ -86,10 +92,11 @@ protected function executeChecks() {
if (!phutil_is_windows() && !@file_exists($path_part.'/.')) {
$message = pht(
"The PATH component '%s' (which resolves as the absolute path ".
- "'%s') is not usable because it is not traversable (its '+x' ".
+ "'%s') is not usable because it is not traversable (its '%s' ".
"permission bit is not set).",
$path_part,
- Filesystem::resolvePath($path_part));
+ Filesystem::resolvePath($path_part),
+ '+x');
}
}
diff --git a/src/applications/config/check/PhabricatorPygmentSetupCheck.php b/src/applications/config/check/PhabricatorPygmentSetupCheck.php
index 26f1f46332..228eb7a33b 100644
--- a/src/applications/config/check/PhabricatorPygmentSetupCheck.php
+++ b/src/applications/config/check/PhabricatorPygmentSetupCheck.php
@@ -12,17 +12,23 @@ protected function executeChecks() {
if ($pygment) {
if (!Filesystem::binaryExists('pygmentize')) {
$summary = pht(
- 'You enabled pygments but the pygmentize script is not '.
- 'actually available, your $PATH is probably broken.');
+ 'You enabled pygments but the %s script is not '.
+ 'actually available, your %s is probably broken.',
+ 'pygmentize',
+ '$PATH');
$message = pht(
- 'The environmental variable $PATH does not contain '.
- 'pygmentize. You have enabled pygments, which requires '.
- 'pygmentize to be available in your $PATH variable.');
+ 'The environmental variable %s does not contain %s. '.
+ 'You have enabled pygments, which requires '.
+ '%s to be available in your %s variable.',
+ '$PATH',
+ 'pygmentize',
+ 'pygmentize',
+ '$PATH');
$this
->newIssue('pygments.enabled')
- ->setName(pht('pygmentize Not Found'))
+ ->setName(pht('%s Not Found', 'pygmentize'))
->setSummary($summary)
->setMessage($message)
->addRelatedPhabricatorConfig('pygments.enabled')
@@ -31,19 +37,21 @@ protected function executeChecks() {
list($err) = exec_manual('pygmentize -h');
if ($err) {
$summary = pht(
- 'You have enabled pygments and the pygmentize script is '.
- 'available, but does not seem to work.');
+ 'You have enabled pygments and the %s script is '.
+ 'available, but does not seem to work.',
+ 'pygmentize');
$message = pht(
- 'Phabricator has %s available in $PATH, but the binary '.
+ 'Phabricator has %s available in %s, but the binary '.
'exited with an error code when run as %s. Check that it is '.
'installed correctly.',
+ phutil_tag('tt', array(), '$PATH'),
phutil_tag('tt', array(), 'pygmentize'),
phutil_tag('tt', array(), 'pygmentize -h'));
$this
->newIssue('pygments.failed')
- ->setName(pht('pygmentize Not Working'))
+ ->setName(pht('%s Not Working', 'pygmentize'))
->setSummary($summary)
->setMessage($message)
->addRelatedPhabricatorConfig('pygments.enabled')
@@ -51,12 +59,14 @@ protected function executeChecks() {
}
}
} else {
- $summary = pht('Pygments should be installed and enabled '.
+ $summary = pht(
+ 'Pygments should be installed and enabled '.
'to provide advanced syntax highlighting.');
- $message = pht('Phabricator can highlight a few languages by default, '.
+ $message = pht(
+ 'Phabricator can highlight a few languages by default, '.
'but installing and enabling Pygments (a third-party highlighting '.
- 'tool) will add syntax highlighting for many more languages. '."\n\n".
+ "tool) will add syntax highlighting for many more languages. \n\n".
'For instructions on installing and enabling Pygments, see the '.
'%s configuration option.'."\n\n".
'If you do not want to install Pygments, you can ignore this issue.',
diff --git a/src/applications/config/check/PhabricatorSetupCheck.php b/src/applications/config/check/PhabricatorSetupCheck.php
index a689d14943..beb52de4dd 100644
--- a/src/applications/config/check/PhabricatorSetupCheck.php
+++ b/src/applications/config/check/PhabricatorSetupCheck.php
@@ -130,7 +130,9 @@ final public static function runAllChecks() {
foreach ($check->getIssues() as $key => $issue) {
if (isset($issues[$key])) {
throw new Exception(
- "Two setup checks raised an issue with key '{$key}'!");
+ pht(
+ "Two setup checks raised an issue with key '%s'!",
+ $key));
}
$issues[$key] = $issue;
if ($issue->getIsFatal()) {
@@ -139,8 +141,8 @@ final public static function runAllChecks() {
}
}
- foreach (PhabricatorEnv::getEnvConfig('config.ignore-issues')
- as $ignorable => $derp) {
+ $ignore_issues = PhabricatorEnv::getEnvConfig('config.ignore-issues');
+ foreach ($ignore_issues as $ignorable => $derp) {
if (isset($issues[$ignorable])) {
$issues[$ignorable]->setIsIgnored(true);
}
diff --git a/src/applications/config/check/PhabricatorTimezoneSetupCheck.php b/src/applications/config/check/PhabricatorTimezoneSetupCheck.php
index 5fcf74a294..bf087c933a 100644
--- a/src/applications/config/check/PhabricatorTimezoneSetupCheck.php
+++ b/src/applications/config/check/PhabricatorTimezoneSetupCheck.php
@@ -40,8 +40,10 @@ protected function executeChecks() {
$message = pht(
"Your configuration fails to specify a server timezone. You can either ".
- "set the PHP configuration value 'date.timezone' or the Phabricator ".
- "configuration value 'phabricator.timezone' to specify one.");
+ "set the PHP configuration value '%s' or the Phabricator ".
+ "configuration value '%s' to specify one.",
+ 'date.timezone',
+ 'phabricator.timezone');
$this
->newIssue('config.timezone')
diff --git a/src/applications/config/controller/PhabricatorConfigIgnoreController.php b/src/applications/config/controller/PhabricatorConfigIgnoreController.php
index a136035536..ba634dec1a 100644
--- a/src/applications/config/controller/PhabricatorConfigIgnoreController.php
+++ b/src/applications/config/controller/PhabricatorConfigIgnoreController.php
@@ -34,7 +34,7 @@ public function processRequest() {
'This issue will no longer be suppressed, and will return to its '.
'rightful place as a global setup warning.');
} else {
- throw new Exception('Unrecognized verb: '.$this->verb);
+ throw new Exception(pht('Unrecognized verb: %s', $this->verb));
}
$dialog = id(new AphrontDialogView())
diff --git a/src/applications/config/custom/PhabricatorCustomHeaderConfigType.php b/src/applications/config/custom/PhabricatorCustomHeaderConfigType.php
index b738aa6aa2..fee8ba5a4c 100644
--- a/src/applications/config/custom/PhabricatorCustomHeaderConfigType.php
+++ b/src/applications/config/custom/PhabricatorCustomHeaderConfigType.php
@@ -5,8 +5,10 @@ final class PhabricatorCustomHeaderConfigType
public function validateOption(PhabricatorConfigOption $option, $value) {
if (phid_get_type($value) != PhabricatorFileFilePHIDType::TYPECONST) {
- throw new Exception(pht(
- '%s is not a valid file phid.', $value));
+ throw new Exception(
+ pht(
+ '%s is not a valid file PHID.',
+ $value));
}
$file = id(new PhabricatorFileQuery())
@@ -14,23 +16,27 @@ public function validateOption(PhabricatorConfigOption $option, $value) {
->withPHIDs(array($value))
->executeOne();
if (!$file) {
- throw new Exception(pht(
- '%s is not a valid file phid.', $value));
+ throw new Exception(
+ pht(
+ '%s is not a valid file PHID.',
+ $value));
}
$most_open_policy = PhabricatorPolicies::getMostOpenPolicy();
if ($file->getViewPolicy() != $most_open_policy) {
- throw new Exception(pht(
- 'Specified file %s has policy "%s" but should have policy "%s".',
- $value,
- $file->getViewPolicy(),
- $most_open_policy));
+ throw new Exception(
+ pht(
+ 'Specified file %s has policy "%s" but should have policy "%s".',
+ $value,
+ $file->getViewPolicy(),
+ $most_open_policy));
}
if (!$file->isViewableImage()) {
- throw new Exception(pht(
- 'Specified file %s is not a viewable image.',
- $value));
+ throw new Exception(
+ pht(
+ 'Specified file %s is not a viewable image.',
+ $value));
}
}
diff --git a/src/applications/config/management/PhabricatorConfigManagementDeleteWorkflow.php b/src/applications/config/management/PhabricatorConfigManagementDeleteWorkflow.php
index 8f8cea0838..24b0f48c26 100644
--- a/src/applications/config/management/PhabricatorConfigManagementDeleteWorkflow.php
+++ b/src/applications/config/management/PhabricatorConfigManagementDeleteWorkflow.php
@@ -12,8 +12,9 @@ protected function didConstruct() {
array(
array(
'name' => 'database',
- 'help' => pht('Delete configuration in the database instead of '.
- 'in local configuration.'),
+ 'help' => pht(
+ 'Delete configuration in the database instead of '.
+ 'in local configuration.'),
),
array(
'name' => 'args',
@@ -27,15 +28,15 @@ public function execute(PhutilArgumentParser $args) {
$argv = $args->getArg('args');
if (count($argv) == 0) {
- throw new PhutilArgumentUsageException(pht(
- 'Specify a configuration key to delete.'));
+ throw new PhutilArgumentUsageException(
+ pht('Specify a configuration key to delete.'));
}
$key = $argv[0];
if (count($argv) > 1) {
- throw new PhutilArgumentUsageException(pht(
- 'Too many arguments: expected one key.'));
+ throw new PhutilArgumentUsageException(
+ pht('Too many arguments: expected one key.'));
}
@@ -49,10 +50,11 @@ public function execute(PhutilArgumentParser $args) {
}
$values = $config->getKeys(array($key));
if (!$values) {
- throw new PhutilArgumentUsageException(pht(
- "Configuration key '%s' is not set in %s configuration!",
- $key,
- $config_type));
+ throw new PhutilArgumentUsageException(
+ pht(
+ "Configuration key '%s' is not set in %s configuration!",
+ $key,
+ $config_type));
}
if ($use_database) {
@@ -64,7 +66,8 @@ public function execute(PhutilArgumentParser $args) {
}
$console->writeOut(
- pht("Deleted '%s' from %s configuration.", $key, $config_type)."\n");
+ "%s\n",
+ pht("Deleted '%s' from %s configuration.", $key, $config_type));
}
}
diff --git a/src/applications/config/management/PhabricatorConfigManagementGetWorkflow.php b/src/applications/config/management/PhabricatorConfigManagementGetWorkflow.php
index 1924cc4792..800ffe5942 100644
--- a/src/applications/config/management/PhabricatorConfigManagementGetWorkflow.php
+++ b/src/applications/config/management/PhabricatorConfigManagementGetWorkflow.php
@@ -7,7 +7,7 @@ protected function didConstruct() {
$this
->setName('get')
->setExamples('**get** __key__')
- ->setSynopsis('Get a local configuration value.')
+ ->setSynopsis(pht('Get a local configuration value.'))
->setArguments(
array(
array(
@@ -23,21 +23,23 @@ public function execute(PhutilArgumentParser $args) {
$argv = $args->getArg('args');
if (count($argv) == 0) {
throw new PhutilArgumentUsageException(
- 'Specify a configuration key to get.');
+ pht('Specify a configuration key to get.'));
}
$key = $argv[0];
if (count($argv) > 1) {
throw new PhutilArgumentUsageException(
- 'Too many arguments: expected one key.');
+ pht('Too many arguments: expected one key.'));
}
$options = PhabricatorApplicationConfigOptions::loadAllOptions();
if (empty($options[$key])) {
throw new PhutilArgumentUsageException(
- "No such configuration key '{$key}'! Use `config list` to list all ".
- "keys.");
+ pht(
+ "No such configuration key '%s'! Use `%s` to list all keys.",
+ $key,
+ 'config list'));
}
$values = array();
diff --git a/src/applications/config/management/PhabricatorConfigManagementListWorkflow.php b/src/applications/config/management/PhabricatorConfigManagementListWorkflow.php
index 10bd6202b2..ea9922e4d7 100644
--- a/src/applications/config/management/PhabricatorConfigManagementListWorkflow.php
+++ b/src/applications/config/management/PhabricatorConfigManagementListWorkflow.php
@@ -7,7 +7,7 @@ protected function didConstruct() {
$this
->setName('list')
->setExamples('**list**')
- ->setSynopsis('List all configuration keys.');
+ ->setSynopsis(pht('List all configuration keys.'));
}
public function execute(PhutilArgumentParser $args) {
diff --git a/src/applications/config/management/PhabricatorConfigManagementMigrateWorkflow.php b/src/applications/config/management/PhabricatorConfigManagementMigrateWorkflow.php
index 1f992d003a..67b5733dc7 100644
--- a/src/applications/config/management/PhabricatorConfigManagementMigrateWorkflow.php
+++ b/src/applications/config/management/PhabricatorConfigManagementMigrateWorkflow.php
@@ -20,54 +20,60 @@ public function execute(PhutilArgumentParser $args) {
$database_config = new PhabricatorConfigDatabaseSource('default');
$config_sources = PhabricatorEnv::getConfigSourceStack()->getStack();
$console->writeOut(
- pht('Migrating file-based config to more modern config...')."\n");
+ "%s\n",
+ pht('Migrating file-based config to more modern config...'));
foreach ($config_sources as $config_source) {
if (!($config_source instanceof PhabricatorConfigFileSource)) {
$console->writeOut(
- pht('Skipping config of source type %s...',
- get_class($config_source))."\n");
+ "%s\n",
+ pht(
+ 'Skipping config of source type %s...',
+ get_class($config_source)));
continue;
}
- $console->writeOut(pht('Migrating file source...')."\n");
+ $console->writeOut("%s\n", pht('Migrating file source...'));
$all_keys = $config_source->getAllKeys();
foreach ($all_keys as $key => $value) {
$option = idx($options, $key);
if (!$option) {
- $console->writeOut(pht('Skipping obsolete option: %s', $key)."\n");
+ $console->writeOut("%s\n", pht('Skipping obsolete option: %s', $key));
continue;
}
$in_local = $local_config->getKeys(array($option->getKey()));
if ($in_local) {
- $console->writeOut(pht(
- 'Skipping option "%s"; already in local config.', $key)."\n");
+ $console->writeOut(
+ "%s\n",
+ pht('Skipping option "%s"; already in local config.', $key));
continue;
}
$is_locked = $option->getLocked();
if ($is_locked) {
$local_config->setKeys(array($option->getKey() => $value));
$key_count++;
- $console->writeOut(pht(
- 'Migrated option "%s" from file to local config.', $key)."\n");
+ $console->writeOut(
+ "%s\n",
+ pht('Migrated option "%s" from file to local config.', $key));
} else {
$in_database = $database_config->getKeys(array($option->getKey()));
if ($in_database) {
- $console->writeOut(pht(
- 'Skipping option "%s"; already in database config.', $key)."\n");
+ $console->writeOut(
+ "%s\n",
+ pht('Skipping option "%s"; already in database config.', $key));
continue;
} else {
$config_entry = PhabricatorConfigEntry::loadConfigEntry($key);
$config_entry->setValue($value);
$config_entry->save();
$key_count++;
- $console->writeOut(pht(
- 'Migrated option "%s" from file to database config.', $key)."\n");
+ $console->writeOut(
+ "%s\n",
+ pht('Migrated option "%s" from file to database config.', $key));
}
}
}
}
- $console->writeOut(pht(
- 'Done. Migrated %d keys.', $key_count)."\n");
+ $console->writeOut("%s\n", pht('Done. Migrated %d keys.', $key_count));
return 0;
}
diff --git a/src/applications/config/management/PhabricatorConfigManagementSetWorkflow.php b/src/applications/config/management/PhabricatorConfigManagementSetWorkflow.php
index 0da6332268..1da30408ee 100644
--- a/src/applications/config/management/PhabricatorConfigManagementSetWorkflow.php
+++ b/src/applications/config/management/PhabricatorConfigManagementSetWorkflow.php
@@ -12,8 +12,9 @@ protected function didConstruct() {
array(
array(
'name' => 'database',
- 'help' => pht('Update configuration in the database instead of '.
- 'in local configuration.'),
+ 'help' => pht(
+ 'Update configuration in the database instead of '.
+ 'in local configuration.'),
),
array(
'name' => 'args',
@@ -26,31 +27,34 @@ public function execute(PhutilArgumentParser $args) {
$console = PhutilConsole::getConsole();
$argv = $args->getArg('args');
if (count($argv) == 0) {
- throw new PhutilArgumentUsageException(pht(
- 'Specify a configuration key and a value to set it to.'));
+ throw new PhutilArgumentUsageException(
+ pht('Specify a configuration key and a value to set it to.'));
}
$key = $argv[0];
if (count($argv) == 1) {
- throw new PhutilArgumentUsageException(pht(
- "Specify a value to set the key '%s' to.",
- $key));
+ throw new PhutilArgumentUsageException(
+ pht(
+ "Specify a value to set the key '%s' to.",
+ $key));
}
$value = $argv[1];
if (count($argv) > 2) {
- throw new PhutilArgumentUsageException(pht(
- 'Too many arguments: expected one key and one value.'));
+ throw new PhutilArgumentUsageException(
+ pht(
+ 'Too many arguments: expected one key and one value.'));
}
$options = PhabricatorApplicationConfigOptions::loadAllOptions();
if (empty($options[$key])) {
- throw new PhutilArgumentUsageException(pht(
- "No such configuration key '%s'! Use `config list` to list all ".
- "keys.",
- $key));
+ throw new PhutilArgumentUsageException(
+ pht(
+ "No such configuration key '%s'! Use `%s` to list all keys.",
+ $key,
+ 'config list'));
}
$option = $options[$key];
@@ -64,10 +68,11 @@ public function execute(PhutilArgumentParser $args) {
break;
case 'int':
if (!ctype_digit($value)) {
- throw new PhutilArgumentUsageException(pht(
- "Config key '%s' is of type '%s'. Specify an integer.",
- $key,
- $type));
+ throw new PhutilArgumentUsageException(
+ pht(
+ "Config key '%s' is of type '%s'. Specify an integer.",
+ $key,
+ $type));
}
$value = (int)$value;
break;
@@ -77,11 +82,13 @@ public function execute(PhutilArgumentParser $args) {
} else if ($value == 'false') {
$value = false;
} else {
- throw new PhutilArgumentUsageException(pht(
- "Config key '%s' is of type '%s'. ".
- "Specify 'true' or 'false'.",
- $key,
- $type));
+ throw new PhutilArgumentUsageException(
+ pht(
+ "Config key '%s' is of type '%s'. Specify '%s' or '%s'.",
+ $key,
+ $type,
+ 'true',
+ 'false'));
}
break;
default:
@@ -89,23 +96,25 @@ public function execute(PhutilArgumentParser $args) {
if (!is_array($value)) {
switch ($type) {
case 'set':
- $message = pht(
- "Config key '%s' is of type '%s'. Specify it in JSON. ".
- "For example:\n\n".
- ' ./bin/config set \'{"value1": true, "value2": true}\''.
- "\n",
- $key,
- $type);
+ $message = sprintf(
+ "%s%s\n\n %s\n",
+ pht(
+ "Config key '%s' is of type '%s'. Specify it in JSON.",
+ $key,
+ $type),
+ pht('For example:'),
+ './bin/config set \'{"value1": true, "value2": true}\'');
break;
default:
if (preg_match('/^list', $type)) {
- $message = pht(
- "Config key '%s' is of type '%s'. Specify it in JSON. ".
- "For example:\n\n".
- ' ./bin/config set \'["a", "b", "c"]\''.
- "\n",
- $key,
- $type);
+ $message = sprintf(
+ "%s%s\n\n %s\n",
+ pht(
+ "Config key '%s' is of type '%s'. Specify it in JSON.",
+ $key,
+ $type),
+ pht('For example:'),
+ './bin/config set \'["a", "b", "c"]\'');
} else {
$message = pht(
'Config key "%s" is of type "%s". Specify it in JSON.',
@@ -120,10 +129,11 @@ public function execute(PhutilArgumentParser $args) {
}
$use_database = $args->getArg('database');
if ($option->getLocked() && $use_database) {
- throw new PhutilArgumentUsageException(pht(
- "Config key '%s' is locked and can only be set in local ".
- 'configuration.',
- $key));
+ throw new PhutilArgumentUsageException(
+ pht(
+ "Config key '%s' is locked and can only be set in local ".
+ "configuration.",
+ $key));
}
try {
@@ -145,7 +155,8 @@ public function execute(PhutilArgumentParser $args) {
}
$console->writeOut(
- pht("Set '%s' in %s configuration.", $key, $config_type)."\n");
+ "%s\n",
+ pht("Set '%s' in %s configuration.", $key, $config_type));
}
}
diff --git a/src/applications/config/option/PhabricatorAWSConfigOptions.php b/src/applications/config/option/PhabricatorAWSConfigOptions.php
index 1a360ffc16..b191e0e40e 100644
--- a/src/applications/config/option/PhabricatorAWSConfigOptions.php
+++ b/src/applications/config/option/PhabricatorAWSConfigOptions.php
@@ -39,8 +39,8 @@ public function getOptions() {
pht(
'Explicit S3 endpoint to use. Leave empty to have Phabricator '.
'select and endpoint. Normally, you do not need to set this.'))
- ->addExample(null, 'Use default endpoint')
- ->addExample('s3.amazon.com', 'Use specific endpoint'),
+ ->addExample(null, pht('Use default endpoint'))
+ ->addExample('s3.amazon.com', pht('Use specific endpoint')),
$this->newOption('amazon-ec2.access-key', 'string', null)
->setLocked(true)
->setDescription(pht('Access key for Amazon EC2.')),
diff --git a/src/applications/config/option/PhabricatorAccessLogConfigOptions.php b/src/applications/config/option/PhabricatorAccessLogConfigOptions.php
index c186fc3557..5bc55f64a7 100644
--- a/src/applications/config/option/PhabricatorAccessLogConfigOptions.php
+++ b/src/applications/config/option/PhabricatorAccessLogConfigOptions.php
@@ -49,14 +49,16 @@ public function getOptions() {
);
$http_desc = pht(
- 'Format for the HTTP access log. Use {{log.access.path}} to set the '.
- 'path. Available variables are:');
+ 'Format for the HTTP access log. Use `%s` to set the path. '.
+ 'Available variables are:',
+ 'log.access.path');
$http_desc .= "\n\n";
$http_desc .= $this->renderMapHelp($http_map);
$ssh_desc = pht(
- 'Format for the SSH access log. Use {{log.ssh.path}} to set the '.
- 'path. Available variables are:');
+ 'Format for the SSH access log. Use %s to set the path. '.
+ 'Available variables are:',
+ 'log.ssh.path');
$ssh_desc .= "\n\n";
$ssh_desc .= $this->renderMapHelp($ssh_map);
@@ -67,7 +69,6 @@ public function getOptions() {
->setDescription(
pht(
"To enable the Phabricator access log, specify a path. The ".
- "access log can provide more detailed information about ".
"Phabricator access than normal HTTP access logs (for instance, ".
"it can show logged-in users, controllers, and other application ".
"data).\n\n".
diff --git a/src/applications/config/option/PhabricatorApplicationConfigOptions.php b/src/applications/config/option/PhabricatorApplicationConfigOptions.php
index 7ac1df3e16..d99cdf3101 100644
--- a/src/applications/config/option/PhabricatorApplicationConfigOptions.php
+++ b/src/applications/config/option/PhabricatorApplicationConfigOptions.php
@@ -227,7 +227,7 @@ final public static function loadAllOptions($external_only = false) {
if (isset($options[$key])) {
throw new Exception(
pht(
- "Mulitple % subclasses contain an option named '%s'!",
+ "Mulitple %s subclasses contain an option named '%s'!",
__CLASS__,
$key));
}
diff --git a/src/applications/config/option/PhabricatorAuthenticationConfigOptions.php b/src/applications/config/option/PhabricatorAuthenticationConfigOptions.php
index dc7996a3ee..a965d16f42 100644
--- a/src/applications/config/option/PhabricatorAuthenticationConfigOptions.php
+++ b/src/applications/config/option/PhabricatorAuthenticationConfigOptions.php
@@ -55,8 +55,8 @@ public function getOptions() {
"registration, you can disable the queue to reduce administrative ".
"overhead.\n\n".
"NOTE: Before you disable the queue, make sure ".
- "{{auth.email-domains}} is configured correctly for your ".
- "install!")),
+ "{{auth.email-domains}} is configured correctly ".
+ "for your install!")),
$this->newOption('auth.email-domains', 'list', array())
->setSummary(pht('Only allow registration from particular domains.'))
->setDescription(
@@ -89,8 +89,7 @@ public function getOptions() {
))
->setSummary(
pht(
- 'Determines whether or not basic account information is '.
- 'editable.'))
+ 'Determines whether or not basic account information is editable.'))
->setDescription(
pht(
'Is basic account information (email, real name, profile '.
diff --git a/src/applications/config/option/PhabricatorClusterConfigOptions.php b/src/applications/config/option/PhabricatorClusterConfigOptions.php
index f6e2849e43..8684d98233 100644
--- a/src/applications/config/option/PhabricatorClusterConfigOptions.php
+++ b/src/applications/config/option/PhabricatorClusterConfigOptions.php
@@ -69,9 +69,10 @@ public function getOptions() {
'hosting providers running multi-tenant clusters.'.
"\n\n".
'If you provide an instance identifier here (normally by '.
- 'injecting it with a `PhabricatorConfigSiteSource`), Phabricator '.
- 'will pass it to subprocesses and commit hooks in the '.
- '`PHABRICATOR_INSTANCE` environmental variable.')),
+ 'injecting it with a `%s`), Phabricator will pass it to '.
+ 'subprocesses and commit hooks in the `%s` environmental variable.',
+ 'PhabricatorConfigSiteSource',
+ 'PHABRICATOR_INSTANCE')),
);
}
diff --git a/src/applications/config/option/PhabricatorConfigOption.php b/src/applications/config/option/PhabricatorConfigOption.php
index e5c9773611..e1d71416e7 100644
--- a/src/applications/config/option/PhabricatorConfigOption.php
+++ b/src/applications/config/option/PhabricatorConfigOption.php
@@ -76,7 +76,9 @@ public function getLockedMessage() {
}
return pht(
'This configuration is locked and can not be edited from the web '.
- 'interface. Use `./bin/config` in `phabricator/` to edit it.');
+ 'interface. Use `%s` in `%s` to edit it.',
+ './bin/config',
+ 'phabricator/');
}
public function addExample($value, $description) {
@@ -180,7 +182,7 @@ public function isCustomType() {
public function getCustomObject() {
if (!$this->customObject) {
if (!$this->isCustomType()) {
- throw new Exception('This option does not have a custom type!');
+ throw new Exception(pht('This option does not have a custom type!'));
}
$this->customObject = newv(substr($this->getType(), 7), array());
}
diff --git a/src/applications/config/option/PhabricatorCoreConfigOptions.php b/src/applications/config/option/PhabricatorCoreConfigOptions.php
index b5df38633a..7477bae5b6 100644
--- a/src/applications/config/option/PhabricatorCoreConfigOptions.php
+++ b/src/applications/config/option/PhabricatorCoreConfigOptions.php
@@ -58,9 +58,9 @@ public function getOptions() {
'Phabricator, and a production environment for deploying it), '.
'set the production environment URI here so that emails and other '.
'durable URIs will always generate with links pointing at the '.
- 'production environment. If unset, defaults to '.
- '{{phabricator.base-uri}}. Most installs do not need to set '.
- 'this option.'))
+ 'production environment. If unset, defaults to `%s`. Most '.
+ 'installs do not need to set this option.',
+ 'phabricator.base-uri'))
->addExample('http://phabricator.example.com/', pht('Valid Setting')),
$this->newOption('phabricator.allowed-uris', 'list', array())
->setLocked(true)
@@ -68,9 +68,9 @@ public function getOptions() {
->setDescription(
pht(
"These alternative URIs will be able to access 'normal' pages ".
- "on your Phabricator install. Other features such as OAuth ".
- "won't work. The major use case for this is moving installs ".
- "across domains."))
+ "on your Phabricator install. Other features such as OAuth ".
+ "won't work. The major use case for this is moving installs ".
+ "across domains."))
->addExample(
"http://phabricator2.example.com/\n".
"http://phabricator3.example.com/",
@@ -83,8 +83,9 @@ public function getOptions() {
"PHP requires that you set a timezone in your php.ini before ".
"using date functions, or it will emit a warning. If this isn't ".
"possible (for instance, because you are using HPHP) you can set ".
- "some valid constant for date_default_timezone_set() here and ".
- "Phabricator will set it on your behalf, silencing the warning."))
+ "some valid constant for %s here and Phabricator will set it on ".
+ "your behalf, silencing the warning.",
+ 'date_default_timezone_set()'))
->addExample('America/New_York', pht('US East (EDT)'))
->addExample('America/Chicago', pht('US Central (CDT)'))
->addExample('America/Boise', pht('US Mountain (MDT)'))
@@ -92,14 +93,14 @@ public function getOptions() {
$this->newOption('phabricator.cookie-prefix', 'string', null)
->setLocked(true)
->setSummary(
- pht('Set a string Phabricator should use to prefix '.
- 'cookie names.'))
+ pht(
+ 'Set a string Phabricator should use to prefix cookie names.'))
->setDescription(
pht(
'Cookies set for x.com are also sent for y.x.com. Assuming '.
'Phabricator instances are running on both domains, this will '.
'create a collision preventing you from logging in.'))
- ->addExample('dev', pht('Prefix cookie with "dev"')),
+ ->addExample('dev', pht('Prefix cookie with "%s"', 'dev')),
$this->newOption('phabricator.show-prototypes', 'bool', false)
->setLocked(true)
->setBoolOptions(
@@ -155,22 +156,29 @@ public function getOptions() {
'linked.')),
$this->newOption('environment.append-paths', 'list', $paths)
->setSummary(
- pht('These paths get appended to your \$PATH envrionment variable.'))
+ pht(
+ 'These paths get appended to your %s environment variable.',
+ '$PATH'))
->setDescription(
pht(
"Phabricator occasionally shells out to other binaries on the ".
- "server. An example of this is the `pygmentize` command, used ".
- "to syntax-highlight code written in languages other than PHP. ".
- "By default, it is assumed that these binaries are in the \$PATH ".
- "of the user running Phabricator (normally 'apache', 'httpd', or ".
- "'nobody'). Here you can add extra directories to the \$PATH ".
+ "server. An example of this is the `%s` command, used to ".
+ "syntax-highlight code written in languages other than PHP. By ".
+ "default, it is assumed that these binaries are in the %s of the ".
+ "user running Phabricator (normally 'apache', 'httpd', or ".
+ "'nobody'). Here you can add extra directories to the %s ".
"environment variable, for when these binaries are in ".
"non-standard locations.\n\n".
- "Note that you can also put binaries in ".
- "`phabricator/support/bin/` (for example, by symlinking them).\n\n".
+ "Note that you can also put binaries in `%s` (for example, by ".
+ "symlinking them).\n\n".
"The current value of PATH after configuration is applied is:\n\n".
" lang=text\n".
- " %s", $path))
+ " %s",
+ '$PATH',
+ '$PATH',
+ 'phabricator/support/bin/',
+ $path,
+ 'pygmentize'))
->setLocked(true)
->addExample('/usr/local/bin', pht('Add One Path'))
->addExample("/usr/bin\n/usr/local/bin", pht('Add Multiple Paths')),
@@ -200,7 +208,7 @@ public function getOptions() {
),
pht('Applications application'))))
->setDescription(
- pht('Array containing list of Uninstalled applications.')),
+ pht('Array containing list of uninstalled applications.')),
$this->newOption('phabricator.application-settings', 'wild', array())
->setLocked(true)
->setDescription(
@@ -261,7 +269,9 @@ protected function didValidateOption(
throw new PhabricatorConfigValidationException(
pht(
"Config option '%s' is invalid. The URI must start with ".
- "'http://' or 'https://'.",
+ "%s' or '%s'.",
+ 'http://',
+ 'https://',
$key));
}
@@ -269,10 +279,12 @@ protected function didValidateOption(
if (strpos($domain, '.') === false) {
throw new PhabricatorConfigValidationException(
pht(
- "Config option '%s' is invalid. The URI must contain a dot ('.'), ".
- "like 'http://example.com/', not just a bare name like ".
- "'http://example/'. Some web browsers will not set cookies on ".
- "domains with no TLD.",
+ "Config option '%s' is invalid. The URI must contain a dot ".
+ "('%s'), like '%s', not just a bare name like '%s'. Some web ".
+ "browsers will not set cookies on domains with no TLD.",
+ '.',
+ 'http://example.com/',
+ 'http://example/',
$key));
}
@@ -281,11 +293,11 @@ protected function didValidateOption(
throw new PhabricatorConfigValidationException(
pht(
"Config option '%s' is invalid. The URI must NOT have a path, ".
- "e.g. 'http://phabricator.example.com/' is OK, but ".
- "'http://example.com/phabricator/' is not. Phabricator must be ".
- "installed on an entire domain; it can not be installed on a ".
- "path.",
- $key));
+ "e.g. '%s' is OK, but '%s' is not. Phabricator must be installed ".
+ "on an entire domain; it can not be installed on a path.",
+ $key,
+ 'http://phabricator.example.com/',
+ 'http://example.com/phabricator/'));
}
}
@@ -299,16 +311,13 @@ protected function didValidateOption(
throw new PhabricatorConfigValidationException(
pht(
"Config option '%s' is invalid. The timezone identifier must ".
- "be a valid timezone identifier recognized by PHP, like ".
- "'America/Los_Angeles'. You can find a list of valid identifiers ".
- "here: %s",
+ "be a valid timezone identifier recognized by PHP, like '%s'. "."
+ You can find a list of valid identifiers here: %s",
$key,
+ 'America/Los_Angeles',
'http://php.net/manual/timezones.php'));
}
}
-
-
-
}
diff --git a/src/applications/config/option/PhabricatorDeveloperConfigOptions.php b/src/applications/config/option/PhabricatorDeveloperConfigOptions.php
index c2063ec87c..37cf752f68 100644
--- a/src/applications/config/option/PhabricatorDeveloperConfigOptions.php
+++ b/src/applications/config/option/PhabricatorDeveloperConfigOptions.php
@@ -52,8 +52,9 @@ public function getOptions() {
"even for logged-out users. This is only really useful if you ".
"need to debug something on a logged-out page. You should not ".
"enable this option in production.\n\n".
- "You must enable DarkConsole by setting {{darkconsole.enabled}} ".
- "before this option will have any effect.")),
+ "You must enable DarkConsole by setting '%s' ".
+ "before this option will have any effect.",
+ 'darkconsole.enabled')),
$this->newOption('debug.time-limit', 'int', null)
->setSummary(
pht(
@@ -170,12 +171,13 @@ public function getOptions() {
pht('Disable deflate compression'),
))
->setSummary(
- pht('Toggle gzdeflate()-based compression for some caches.'))
+ pht('Toggle %s-based compression for some caches.', 'gzdeflate()'))
->setDescription(
pht(
- 'Set this to false to disable the use of gzdeflate()-based '.
+ 'Set this to false to disable the use of %s-based '.
'compression in some caches. This may give you less performant '.
- '(but more debuggable) caching.')),
+ '(but more debuggable) caching.',
+ 'gzdeflate()')),
);
}
}
diff --git a/src/applications/config/option/PhabricatorMailgunConfigOptions.php b/src/applications/config/option/PhabricatorMailgunConfigOptions.php
index 3baf4e6798..aebcba6725 100644
--- a/src/applications/config/option/PhabricatorMailgunConfigOptions.php
+++ b/src/applications/config/option/PhabricatorMailgunConfigOptions.php
@@ -25,8 +25,9 @@ public function getOptions() {
->setLocked(true)
->setDescription(
pht(
- 'Mailgun domain name. See https://mailgun.com/cp/domains'))
- ->addExample('mycompany.com', 'Use specific domain'),
+ 'Mailgun domain name. See %s.',
+ 'https://mailgun.com/cp/domains'))
+ ->addExample('mycompany.com', pht('Use specific domain')),
$this->newOption('mailgun.api-key', 'string', null)
->setHidden(true)
->setDescription(pht('Mailgun API key.')),
diff --git a/src/applications/config/option/PhabricatorMetaMTAConfigOptions.php b/src/applications/config/option/PhabricatorMetaMTAConfigOptions.php
index d190f1b393..55c8c5689c 100644
--- a/src/applications/config/option/PhabricatorMetaMTAConfigOptions.php
+++ b/src/applications/config/option/PhabricatorMetaMTAConfigOptions.php
@@ -24,7 +24,7 @@ public function getOptions() {
When a user takes an action which generates an email notification (like
commenting on a Differential revision), Phabricator can either send that mail
"From" the user's email address (like "alincoln@logcabin.com") or "From" the
-'metamta.default-address' address.
+'%s' address.
The user experience is generally better if Phabricator uses the user's real
address as the "From" since the messages are easier to organize when they appear
@@ -43,7 +43,8 @@ public function getOptions() {
initially, since the risk in turning it on is that your outgoing mail will
never arrive.
EODOC
-));
+ ,
+ 'metamta.default-address'));
$one_mail_per_recipient_desc = $this->deformat(pht(<<deformat(pht(<<deformat(pht(<<deformat(pht(<<newOption('storage.default-namespace', 'string', 'phabricator')
->setLocked(true)
->setSummary(
diff --git a/src/applications/config/option/PhabricatorPHDConfigOptions.php b/src/applications/config/option/PhabricatorPHDConfigOptions.php
index b07e62244c..59cb8ea728 100644
--- a/src/applications/config/option/PhabricatorPHDConfigOptions.php
+++ b/src/applications/config/option/PhabricatorPHDConfigOptions.php
@@ -23,12 +23,10 @@ public function getOptions() {
return array(
$this->newOption('phd.pid-directory', 'string', '/var/tmp/phd/pid')
->setDescription(
- pht(
- 'Directory that phd should use to track running daemons.')),
+ pht('Directory that phd should use to track running daemons.')),
$this->newOption('phd.log-directory', 'string', '/var/tmp/phd/log')
->setDescription(
- pht(
- 'Directory that the daemons should use to store log files.')),
+ pht('Directory that the daemons should use to store log files.')),
$this->newOption('phd.taskmasters', 'int', 4)
->setSummary(pht('Maximum taskmaster daemon pool size.'))
->setDescription(
@@ -47,8 +45,10 @@ public function getOptions() {
pht(
"Launch daemons in 'verbose' mode by default. This creates a lot ".
"of output, but can help debug issues. Daemons launched in debug ".
- "mode with 'phd debug' are always launched in verbose mode. See ".
- "also 'phd.trace'.")),
+ "mode with '%s' are always launched in verbose mode. ".
+ "See also '%s'.",
+ 'phd debug',
+ 'phd.trace')),
$this->newOption('phd.user', 'string', null)
->setLocked(true)
->setSummary(pht('System user to run daemons as.'))
@@ -69,8 +69,10 @@ public function getOptions() {
pht(
"Launch daemons in 'trace' mode by default. This creates an ".
"ENORMOUS amount of output, but can help debug issues. Daemons ".
- "launched in debug mode with 'phd debug' are always launched in ".
- "trace mode. See also 'phd.verbose'.")),
+ "launched in debug mode with '%s' are always launched in ".
+ "trace mode. See also '%s'.",
+ 'phd debug',
+ 'phd.verbose')),
$this->newOption('phd.variant-config', 'list', array())
->setDescription(
pht(
diff --git a/src/applications/config/option/PhabricatorPHPMailerConfigOptions.php b/src/applications/config/option/PhabricatorPHPMailerConfigOptions.php
index fbe98175d1..b2d5c91e91 100644
--- a/src/applications/config/option/PhabricatorPHPMailerConfigOptions.php
+++ b/src/applications/config/option/PhabricatorPHPMailerConfigOptions.php
@@ -43,9 +43,12 @@ public function getOptions() {
->setSummary(pht('Configure TLS or SSL for SMTP.'))
->setDescription(
pht(
- "Using PHPMailer with SMTP, you can set this to one of 'tls' or ".
- "'ssl' to use TLS or SSL, respectively. Leave it blank for ".
- "vanilla SMTP. If you're sending via Gmail, set it to 'ssl'.")),
+ "Using PHPMailer with SMTP, you can set this to one of '%s' or ".
+ "'%s' to use TLS or SSL, respectively. Leave it blank for ".
+ "vanilla SMTP. If you're sending via Gmail, set it to '%s'.",
+ 'tls',
+ 'ssl',
+ 'ssl')),
$this->newOption('phpmailer.smtp-user', 'string', null)
->setLocked(true)
->setDescription(pht('Username for SMTP.')),
diff --git a/src/applications/config/option/PhabricatorSMSConfigOptions.php b/src/applications/config/option/PhabricatorSMSConfigOptions.php
index 973f5db13e..33b75c263f 100644
--- a/src/applications/config/option/PhabricatorSMSConfigOptions.php
+++ b/src/applications/config/option/PhabricatorSMSConfigOptions.php
@@ -20,12 +20,10 @@ public function getGroup() {
}
public function getOptions() {
- $adapter_description = $this->deformat(pht(<<newOption(
@@ -40,7 +38,7 @@ public function getOptions() {
'class',
null)
->setBaseClass('PhabricatorSMSImplementationAdapter')
- ->setSummary(pht('Control how sms is sent.'))
+ ->setSummary(pht('Control how SMS is sent.'))
->setDescription($adapter_description),
$this->newOption(
'twilio.account-sid',
diff --git a/src/applications/config/option/PhabricatorSecurityConfigOptions.php b/src/applications/config/option/PhabricatorSecurityConfigOptions.php
index d8a8c85a92..63e43b3081 100644
--- a/src/applications/config/option/PhabricatorSecurityConfigOptions.php
+++ b/src/applications/config/option/PhabricatorSecurityConfigOptions.php
@@ -92,12 +92,13 @@ public function getOptions() {
"reasonably configure more granular behavior there.\n\n".
"IMPORTANT: Phabricator determines if a request is HTTPS or not ".
- "by examining the PHP \$_SERVER['HTTPS'] variable. If you run ".
+ "by examining the PHP `%s` variable. If you run ".
"Apache/mod_php this will probably be set correctly for you ".
"automatically, but if you run Phabricator as CGI/FCGI (e.g., ".
"through nginx or lighttpd), you need to configure your web ".
"server so that it passes the value correctly based on the ".
- "connection type."))
+ "connection type.",
+ "\$_SERVER['HTTPS']"))
->setBoolOptions(
array(
pht('Force HTTPS'),
@@ -163,7 +164,8 @@ public function getOptions() {
"When users write comments which have URIs, they'll be ".
"automatically linked if the protocol appears in this set. This ".
"whitelist is primarily to prevent security issues like ".
- "javascript:// URIs."))
+ "%s URIs.",
+ 'javascript://'))
->addExample("http\nhttps", pht('Valid Setting'))
->setLocked(true),
$this->newOption(
@@ -226,7 +228,7 @@ public function getOptions() {
pht('Determines whether or not YouTube videos get embedded.'))
->setDescription(
pht(
- "If you enable this, linked YouTube videos will be embeded ".
+ "If you enable this, linked YouTube videos will be embedded ".
"inline. This has mild security implications (you'll leak ".
"referrers to YouTube) and is pretty silly (but sort of ".
"awesome).")),
@@ -308,8 +310,10 @@ protected function didValidateOption(
throw new PhabricatorConfigValidationException(
pht(
"Config option '%s' is invalid. The URI must start with ".
- "'http://' or 'https://'.",
- $key));
+ "'%s' or '%s'.",
+ $key,
+ 'http://',
+ 'https://'));
}
$domain = $uri->getDomain();
@@ -317,10 +321,11 @@ protected function didValidateOption(
throw new PhabricatorConfigValidationException(
pht(
"Config option '%s' is invalid. The URI must contain a dot ('.'), ".
- "like 'http://example.com/', not just a bare name like ".
- "'http://example/'. Some web browsers will not set cookies on ".
- "domains with no TLD.",
- $key));
+ "like '%s', not just a bare name like '%s'. ".
+ "Some web browsers will not set cookies on domains with no TLD.",
+ $key,
+ 'http://example.com/',
+ 'http://example/'));
}
$path = $uri->getPath();
@@ -328,11 +333,11 @@ protected function didValidateOption(
throw new PhabricatorConfigValidationException(
pht(
"Config option '%s' is invalid. The URI must NOT have a path, ".
- "e.g. 'http://phabricator.example.com/' is OK, but ".
- "'http://example.com/phabricator/' is not. Phabricator must be ".
- "installed on an entire domain; it can not be installed on a ".
- "path.",
- $key));
+ "e.g. '%s' is OK, but '%s' is not. Phabricator must be installed ".
+ "on an entire domain; it can not be installed on a path.",
+ $key,
+ 'http://phabricator.example.com/',
+ 'http://example.com/phabricator/'));
}
}
}
diff --git a/src/applications/config/option/PhabricatorSyntaxHighlightingConfigOptions.php b/src/applications/config/option/PhabricatorSyntaxHighlightingConfigOptions.php
index 90c1e87906..c2511b0f8e 100644
--- a/src/applications/config/option/PhabricatorSyntaxHighlightingConfigOptions.php
+++ b/src/applications/config/option/PhabricatorSyntaxHighlightingConfigOptions.php
@@ -34,8 +34,8 @@ public function getOptions() {
pht(
'Phabricator can highlight PHP by default and use Pygments for '.
'other languages if enabled. You can provide a custom '.
- 'highlighter engine by extending class '.
- 'PhutilSyntaxHighlighterEngine.')),
+ 'highlighter engine by extending class %s.',
+ 'PhutilSyntaxHighlighterEngine')),
$this->newOption('pygments.enabled', 'bool', false)
->setSummary(
pht('Should Phabricator use Pygments to highlight code?'))
@@ -128,7 +128,7 @@ public function getOptions() {
'be tested against the filename. They should map to either an '.
'explicit language as a string value, or a numeric index into '.
'the captured groups as an integer.'))
- ->addExample('{"@\\.xyz$@": "php"}', pht('Highlight *.xyz as PHP.'))
+ ->addExample('{"@\\.xyz$@": "php"}', pht('Highlight %s as PHP.', '*.xyz'))
->addExample(
'{"@/httpd\\.conf@": "apacheconf"}',
pht('Highlight httpd.conf as "apacheconf".'))
diff --git a/src/applications/config/option/PhabricatorTranslationsConfigOptions.php b/src/applications/config/option/PhabricatorTranslationsConfigOptions.php
index 007c61d197..aa7b9a2b32 100644
--- a/src/applications/config/option/PhabricatorTranslationsConfigOptions.php
+++ b/src/applications/config/option/PhabricatorTranslationsConfigOptions.php
@@ -25,10 +25,10 @@ public function getOptions() {
->setSummary(pht('Override translations.'))
->setDescription(
pht(
- "You can use 'translation.override' if you don't want to create ".
- "a full translation to give users an option for switching to it ".
- "and you just want to override some strings in the default ".
- "translation."))
+ "You can use '%s' if you don't want to create a full translation ".
+ "to give users an option for switching to it and you just want to ".
+ "override some strings in the default translation.",
+ 'translation.override'))
->addExample(
'{"some string": "my alternative"}',
pht('Valid Setting')),
diff --git a/src/applications/config/option/PhabricatorUIConfigOptions.php b/src/applications/config/option/PhabricatorUIConfigOptions.php
index 04896e1a20..8b84a6b4b2 100644
--- a/src/applications/config/option/PhabricatorUIConfigOptions.php
+++ b/src/applications/config/option/PhabricatorUIConfigOptions.php
@@ -50,8 +50,7 @@ public function getOptions() {
return array(
$this->newOption('ui.header-color', 'enum', 'dark')
->setDescription(
- pht(
- 'Sets the color of the main header.'))
+ pht('Sets the color of the main header.'))
->setEnumOptions($options),
$this->newOption('ui.footer-items', 'list', array())
->setSummary(
diff --git a/src/applications/conpherence/conduit/ConpherenceQueryThreadConduitAPIMethod.php b/src/applications/conpherence/conduit/ConpherenceQueryThreadConduitAPIMethod.php
index 986e8e520c..cd5fa1bff7 100644
--- a/src/applications/conpherence/conduit/ConpherenceQueryThreadConduitAPIMethod.php
+++ b/src/applications/conpherence/conduit/ConpherenceQueryThreadConduitAPIMethod.php
@@ -9,10 +9,10 @@ public function getAPIMethodName() {
public function getMethodDescription() {
return pht(
- 'Query for conpherence threads for the logged in user. '.
- 'You can query by ids or phids for specific conpherence threads. '.
- 'Otherwise, specify limit and offset to query the most recently '.
- 'updated conpherences for the logged in user.');
+ 'Query for Conpherence threads for the logged in user. You can query '.
+ 'by IDs or PHIDs for specific Conpherence threads. Otherwise, specify '.
+ 'limit and offset to query the most recently updated Conpherences for '.
+ 'the logged in user.');
}
protected function defineParamTypes() {
diff --git a/src/applications/conpherence/conduit/ConpherenceQueryTransactionConduitAPIMethod.php b/src/applications/conpherence/conduit/ConpherenceQueryTransactionConduitAPIMethod.php
index 958748a68e..e014dc742a 100644
--- a/src/applications/conpherence/conduit/ConpherenceQueryTransactionConduitAPIMethod.php
+++ b/src/applications/conpherence/conduit/ConpherenceQueryTransactionConduitAPIMethod.php
@@ -10,9 +10,9 @@ public function getAPIMethodName() {
public function getMethodDescription() {
return pht(
'Query for transactions for the logged in user within a specific '.
- 'conpherence thread. You can specify the thread by id or phid. '.
+ 'Conpherence thread. You can specify the thread by ID or PHID. '.
'Otherwise, specify limit and offset to query the most recent '.
- 'transactions within the conpherence for the logged in user.');
+ 'transactions within the Conpherence for the logged in user.');
}
protected function defineParamTypes() {
@@ -31,7 +31,7 @@ protected function defineReturnType() {
protected function defineErrorTypes() {
return array(
'ERR_USAGE_NO_THREAD_ID' => pht(
- 'You must specify a thread id or thread phid to query transactions '.
+ 'You must specify a thread id or thread PHID to query transactions '.
'from.'),
);
}
diff --git a/src/applications/conpherence/controller/ConpherenceUpdateController.php b/src/applications/conpherence/controller/ConpherenceUpdateController.php
index 8d7db7691c..57df50c828 100644
--- a/src/applications/conpherence/controller/ConpherenceUpdateController.php
+++ b/src/applications/conpherence/controller/ConpherenceUpdateController.php
@@ -208,7 +208,7 @@ public function handleRequest(AphrontRequest $request) {
$response_mode = 'ajax';
break;
default:
- throw new Exception('Unknown action: '.$action);
+ throw new Exception(pht('Unknown action: %s', $action));
break;
}
diff --git a/src/applications/conpherence/mail/ConpherenceReplyHandler.php b/src/applications/conpherence/mail/ConpherenceReplyHandler.php
index a26c9d3cc6..61f925e150 100644
--- a/src/applications/conpherence/mail/ConpherenceReplyHandler.php
+++ b/src/applications/conpherence/mail/ConpherenceReplyHandler.php
@@ -14,7 +14,10 @@ public function getMailAddedParticipantPHIDs() {
public function validateMailReceiver($mail_receiver) {
if (!($mail_receiver instanceof ConpherenceThread)) {
- throw new Exception('Mail receiver is not a ConpherenceThread!');
+ throw new Exception(
+ pht(
+ 'Mail receiver is not a %s!', '
+ ConpherenceThread'));
}
}
diff --git a/src/applications/console/plugin/DarkConsoleErrorLogPlugin.php b/src/applications/console/plugin/DarkConsoleErrorLogPlugin.php
index 513f4b9905..591904a85f 100644
--- a/src/applications/console/plugin/DarkConsoleErrorLogPlugin.php
+++ b/src/applications/console/plugin/DarkConsoleErrorLogPlugin.php
@@ -84,8 +84,8 @@ public function renderPanel() {
$table = new AphrontTableView($rows);
$table->setClassName('error-log');
- $table->setHeaders(array('Error'));
- $table->setNoDataString('No errors.');
+ $table->setHeaders(array(pht('Error')));
+ $table->setNoDataString(pht('No errors.'));
return phutil_tag(
'div',
diff --git a/src/applications/console/plugin/DarkConsoleEventPlugin.php b/src/applications/console/plugin/DarkConsoleEventPlugin.php
index 02dc4e8b78..070227c12d 100644
--- a/src/applications/console/plugin/DarkConsoleEventPlugin.php
+++ b/src/applications/console/plugin/DarkConsoleEventPlugin.php
@@ -3,11 +3,11 @@
final class DarkConsoleEventPlugin extends DarkConsolePlugin {
public function getName() {
- return 'Events';
+ return pht('Events');
}
public function getDescription() {
- return 'Information about Phabricator events and event listeners.';
+ return pht('Information about Phabricator events and event listeners.');
}
public function generateData() {
@@ -51,8 +51,8 @@ public function renderPanel() {
$table = new AphrontTableView($rows);
$table->setHeaders(
array(
- 'Internal ID',
- 'Listener Class',
+ pht('Internal ID'),
+ pht('Listener Class'),
));
$table->setColumnClasses(
array(
@@ -71,7 +71,7 @@ public function renderPanel() {
foreach ($data['events'] as $event) {
$rows[] = array(
$event['type'],
- $event['stopped'] ? 'STOPPED' : null,
+ $event['stopped'] ? pht('STOPPED') : null,
);
}
@@ -82,8 +82,8 @@ public function renderPanel() {
));
$table->setHeaders(
array(
- 'Event Type',
- 'Stopped',
+ pht('Event Type'),
+ pht('Stopped'),
));
$out[] = $table->render();
diff --git a/src/applications/console/plugin/DarkConsoleRequestPlugin.php b/src/applications/console/plugin/DarkConsoleRequestPlugin.php
index b354b328c2..8333903131 100644
--- a/src/applications/console/plugin/DarkConsoleRequestPlugin.php
+++ b/src/applications/console/plugin/DarkConsoleRequestPlugin.php
@@ -3,11 +3,14 @@
final class DarkConsoleRequestPlugin extends DarkConsolePlugin {
public function getName() {
- return 'Request';
+ return pht('Request');
}
public function getDescription() {
- return 'Information about $_REQUEST and $_SERVER.';
+ return pht(
+ 'Information about %s and %s.',
+ '$_REQUEST',
+ '$_SERVER');
}
public function generateData() {
@@ -47,7 +50,7 @@ public function renderPanel() {
if (isset($mask[$key])) {
$rows[] = array(
$key,
- phutil_tag('em', array(), '(Masked)'),
+ phutil_tag('em', array(), pht('(Masked)')),
);
} else {
$rows[] = array(
diff --git a/src/applications/console/plugin/DarkConsoleServicesPlugin.php b/src/applications/console/plugin/DarkConsoleServicesPlugin.php
index 7f33f9ba6d..055315d641 100644
--- a/src/applications/console/plugin/DarkConsoleServicesPlugin.php
+++ b/src/applications/console/plugin/DarkConsoleServicesPlugin.php
@@ -5,11 +5,11 @@ final class DarkConsoleServicesPlugin extends DarkConsolePlugin {
protected $observations;
public function getName() {
- return 'Services';
+ return pht('Services');
}
public function getDescription() {
- return 'Information about services.';
+ return pht('Information about services.');
}
public static function getQueryAnalyzerHeader() {
@@ -44,7 +44,7 @@ public function generateData() {
$log[$key]['explain'] = array(
'sev' => 7,
'size' => null,
- 'reason' => 'Disabled',
+ 'reason' => pht('Disabled'),
);
// Query analysis is disabled for this request, so don't do any of it.
continue;
@@ -102,26 +102,26 @@ public function generateData() {
if (preg_match('/Using where/', $table['Extra'])) {
if ($table['rows'] < 256 && !empty($table['possible_keys'])) {
$cur_badness = 2;
- $cur_reason = 'Small Table Scan';
+ $cur_reason = pht('Small Table Scan');
} else {
$cur_badness = 6;
- $cur_reason = 'TABLE SCAN!';
+ $cur_reason = pht('TABLE SCAN!');
}
} else {
$cur_badness = 3;
- $cur_reason = 'Whole Table';
+ $cur_reason = pht('Whole Table');
}
break;
default:
if (preg_match('/No tables used/i', $table['Extra'])) {
$cur_badness = 1;
- $cur_reason = 'No Tables';
+ $cur_reason = pht('No Tables');
} else if (preg_match('/Impossible/i', $table['Extra'])) {
$cur_badness = 1;
- $cur_reason = 'Empty';
+ $cur_reason = pht('Empty');
} else {
$cur_badness = 4;
- $cur_reason = "Can't Analyze";
+ $cur_reason = pht("Can't Analyze");
}
break;
}
@@ -198,7 +198,7 @@ public function renderPanel() {
$summary[] = array(
$type,
number_format($counts[$type]),
- number_format((int)(1000000 * $totals[$type])).' us',
+ pht('%s us', new PhutilNumber((int)(1000000 * $totals[$type]))),
sprintf('%.1f%%', 100 * $totals[$type] / $page_total),
);
}
@@ -212,10 +212,10 @@ public function renderPanel() {
));
$summary_table->setHeaders(
array(
- 'Type',
- 'Count',
- 'Total Cost',
- 'Page Weight',
+ pht('Type'),
+ pht('Count'),
+ pht('Total Cost'),
+ pht('Page Weight'),
));
$results[] = $summary_table->render();
@@ -258,10 +258,12 @@ public function renderPanel() {
break;
}
+ $offset = ($row['begin'] - $data['start']);
+
$rows[] = array(
$row['type'],
- '+'.number_format(1000 * ($row['begin'] - $data['start'])).' ms',
- number_format(1000000 * $row['duration']).' us',
+ pht('+%s ms', new PhutilNumber(1000 * $offset)),
+ pht('%s us', new PhutilNumber(1000000 * $row['duration'])),
$info,
$analysis,
);
@@ -278,11 +280,11 @@ public function renderPanel() {
));
$table->setHeaders(
array(
- 'Event',
- 'Start',
- 'Duration',
- 'Details',
- 'Analysis',
+ pht('Event'),
+ pht('Start'),
+ pht('Duration'),
+ pht('Details'),
+ pht('Analysis'),
));
$results[] = $table->render();
diff --git a/src/applications/console/plugin/DarkConsoleXHProfPlugin.php b/src/applications/console/plugin/DarkConsoleXHProfPlugin.php
index 2a0d22f775..f751cc31a5 100644
--- a/src/applications/console/plugin/DarkConsoleXHProfPlugin.php
+++ b/src/applications/console/plugin/DarkConsoleXHProfPlugin.php
@@ -5,7 +5,7 @@ final class DarkConsoleXHProfPlugin extends DarkConsolePlugin {
protected $profileFilePHID;
public function getName() {
- return 'XHProf';
+ return pht('XHProf');
}
public function getColor() {
@@ -17,7 +17,7 @@ public function getColor() {
}
public function getDescription() {
- return 'Provides detailed PHP profiling information through XHProf.';
+ return pht('Provides detailed PHP profiling information through XHProf.');
}
public function generateData() {
@@ -47,14 +47,14 @@ public function renderPanel() {
'href' => $href,
'class' => 'bright-link',
),
- 'Installation Guide');
+ pht('Installation Guide'));
return hsprintf(
- '
'.
+ '
%s
',
+ pht(
'The "xhprof" PHP extension is not available. Install xhprof '.
'to enable the XHProf console plugin. You can find instructions in '.
- 'the %s.'.
- '
',
- $install_guide);
+ 'the %s.',
+ $install_guide));
}
$result = array();
diff --git a/src/applications/console/plugin/errorlog/DarkConsoleErrorLogPluginAPI.php b/src/applications/console/plugin/errorlog/DarkConsoleErrorLogPluginAPI.php
index 5d9723cc4b..3067472cf2 100644
--- a/src/applications/console/plugin/errorlog/DarkConsoleErrorLogPluginAPI.php
+++ b/src/applications/console/plugin/errorlog/DarkConsoleErrorLogPluginAPI.php
@@ -67,7 +67,7 @@ public static function handleErrors($event, $value, $metadata) {
);
break;
default:
- error_log('Unknown event : '.$event);
+ error_log(pht('Unknown event: %s', $event));
break;
}
}
diff --git a/src/applications/countdown/controller/PhabricatorCountdownDeleteController.php b/src/applications/countdown/controller/PhabricatorCountdownDeleteController.php
index d57534a420..5dfbd18146 100644
--- a/src/applications/countdown/controller/PhabricatorCountdownDeleteController.php
+++ b/src/applications/countdown/controller/PhabricatorCountdownDeleteController.php
@@ -33,8 +33,9 @@ public function processRequest() {
->setURI('/countdown/');
}
- $inst = pht('Are you sure you want to delete the countdown %s?',
- $countdown->getTitle());
+ $inst = pht(
+ 'Are you sure you want to delete the countdown %s?',
+ $countdown->getTitle());
$dialog = new AphrontDialogView();
$dialog->setUser($request->getUser());
diff --git a/src/applications/daemon/controller/PhabricatorDaemonConsoleController.php b/src/applications/daemon/controller/PhabricatorDaemonConsoleController.php
index cd549a6844..921921942c 100644
--- a/src/applications/daemon/controller/PhabricatorDaemonConsoleController.php
+++ b/src/applications/daemon/controller/PhabricatorDaemonConsoleController.php
@@ -50,7 +50,7 @@ public function handleRequest(AphrontRequest $request) {
$rows[] = array(
$class,
number_format($info['n']),
- number_format((int)($info['duration'] / $info['n'])).' us',
+ pht('%s us', new PhutilNumber((int)($info['duration'] / $info['n']))),
);
}
diff --git a/src/applications/daemon/controller/PhabricatorDaemonLogViewController.php b/src/applications/daemon/controller/PhabricatorDaemonLogViewController.php
index 17d998fe7c..baab0528e3 100644
--- a/src/applications/daemon/controller/PhabricatorDaemonLogViewController.php
+++ b/src/applications/daemon/controller/PhabricatorDaemonLogViewController.php
@@ -148,12 +148,10 @@ private function buildPropertyListView(PhabricatorDaemonLog $daemon) {
phutil_format_relative_time($wait_time));
break;
case PhabricatorDaemonLog::STATUS_EXITING:
- $details = pht(
- 'This daemon is shutting down gracefully.');
+ $details = pht('This daemon is shutting down gracefully.');
break;
case PhabricatorDaemonLog::STATUS_EXITED:
- $details = pht(
- 'This daemon exited normally and is no longer running.');
+ $details = pht('This daemon exited normally and is no longer running.');
break;
}
diff --git a/src/applications/daemon/controller/PhabricatorWorkerTaskDetailController.php b/src/applications/daemon/controller/PhabricatorWorkerTaskDetailController.php
index c7254de181..66925ffd36 100644
--- a/src/applications/daemon/controller/PhabricatorWorkerTaskDetailController.php
+++ b/src/applications/daemon/controller/PhabricatorWorkerTaskDetailController.php
@@ -95,7 +95,7 @@ private function buildPropertyListView(
$status = pht('Cancelled');
break;
default:
- throw new Exception('Unknown task status!');
+ throw new Exception(pht('Unknown task status!'));
}
} else {
$status = pht('Queued');
@@ -141,7 +141,7 @@ private function buildPropertyListView(
$expires);
if ($task->isArchived()) {
- $duration = number_format($task->getDuration()).' us';
+ $duration = pht('%s us', new PhutilNumber($task->getDuration()));
} else {
$duration = phutil_tag('em', array(), pht('Not Completed'));
}
diff --git a/src/applications/daemon/management/PhabricatorDaemonManagementDebugWorkflow.php b/src/applications/daemon/management/PhabricatorDaemonManagementDebugWorkflow.php
index 23d5a54eeb..e2023ae143 100644
--- a/src/applications/daemon/management/PhabricatorDaemonManagementDebugWorkflow.php
+++ b/src/applications/daemon/management/PhabricatorDaemonManagementDebugWorkflow.php
@@ -23,8 +23,10 @@ protected function didConstruct() {
),
array(
'name' => 'as-current-user',
- 'help' => 'Run the daemon as the current user '.
- 'instead of the configured phd.user',
+ 'help' => pht(
+ 'Run the daemon as the current user '.
+ 'instead of the configured %s',
+ 'phd.user'),
),
array(
'name' => 'autoscale',
diff --git a/src/applications/daemon/management/PhabricatorDaemonManagementLogWorkflow.php b/src/applications/daemon/management/PhabricatorDaemonManagementLogWorkflow.php
index b32c1439f6..394b4735a5 100644
--- a/src/applications/daemon/management/PhabricatorDaemonManagementLogWorkflow.php
+++ b/src/applications/daemon/management/PhabricatorDaemonManagementLogWorkflow.php
@@ -17,15 +17,15 @@ protected function didConstruct() {
array(
'name' => 'id',
'param' => 'id',
- 'help' => 'Show logs for daemon(s) with given ID(s).',
+ 'help' => pht('Show logs for daemon(s) with given ID(s).'),
'repeat' => true,
),
array(
'name' => 'limit',
'param' => 'N',
'default' => 100,
- 'help' => 'Show a specific number of log messages '.
- '(default 100).',
+ 'help' => pht(
+ 'Show a specific number of log messages (default 100).'),
),
));
}
@@ -87,7 +87,7 @@ public function execute(PhutilArgumentParser $args) {
$console->writeOut(
"%s\n",
- sprintf(
+ pht(
'Daemon %d %s [%s] %s',
$id,
$type,
diff --git a/src/applications/daemon/management/PhabricatorDaemonManagementReloadWorkflow.php b/src/applications/daemon/management/PhabricatorDaemonManagementReloadWorkflow.php
index 4a7d9a764d..fa70231a0a 100644
--- a/src/applications/daemon/management/PhabricatorDaemonManagementReloadWorkflow.php
+++ b/src/applications/daemon/management/PhabricatorDaemonManagementReloadWorkflow.php
@@ -10,7 +10,8 @@ protected function didConstruct() {
pht(
'Gracefully restart daemon processes in-place to pick up changes '.
'to source. This will not disrupt running jobs. This is an '.
- 'advanced workflow; most installs should use __phd restart__.'))
+ 'advanced workflow; most installs should use __%s__.',
+ 'phd restart'))
->setArguments(
array(
array(
diff --git a/src/applications/daemon/management/PhabricatorDaemonManagementRestartWorkflow.php b/src/applications/daemon/management/PhabricatorDaemonManagementRestartWorkflow.php
index 5d8d6df89e..adb6490f08 100644
--- a/src/applications/daemon/management/PhabricatorDaemonManagementRestartWorkflow.php
+++ b/src/applications/daemon/management/PhabricatorDaemonManagementRestartWorkflow.php
@@ -6,9 +6,7 @@ final class PhabricatorDaemonManagementRestartWorkflow
protected function didConstruct() {
$this
->setName('restart')
- ->setSynopsis(
- pht(
- 'Stop, then start the standard daemon loadout.'))
+ ->setSynopsis(pht('Stop, then start the standard daemon loadout.'))
->setArguments(
array(
array(
diff --git a/src/applications/daemon/management/PhabricatorDaemonManagementStartWorkflow.php b/src/applications/daemon/management/PhabricatorDaemonManagementStartWorkflow.php
index d489dca88b..9a807357a7 100644
--- a/src/applications/daemon/management/PhabricatorDaemonManagementStartWorkflow.php
+++ b/src/applications/daemon/management/PhabricatorDaemonManagementStartWorkflow.php
@@ -9,20 +9,21 @@ protected function didConstruct() {
->setSynopsis(
pht(
'Start the standard configured collection of Phabricator daemons. '.
- 'This is appropriate for most installs. Use **phd launch** to '.
- 'customize which daemons are launched.'))
+ 'This is appropriate for most installs. Use **%s** to '.
+ 'customize which daemons are launched.',
+ 'phd launch'))
->setArguments(
array(
array(
'name' => 'keep-leases',
'help' => pht(
- 'By default, **phd start** will free all task leases held by '.
- 'the daemons. With this flag, this step will be skipped.'),
+ 'By default, **%s** will free all task leases held by '.
+ 'the daemons. With this flag, this step will be skipped.',
+ 'phd start'),
),
array(
'name' => 'force',
- 'help' => pht(
- 'Start daemons even if daemons are already running.'),
+ 'help' => pht('Start daemons even if daemons are already running.'),
),
$this->getAutoscaleReserveArgument(),
));
diff --git a/src/applications/daemon/management/PhabricatorDaemonManagementStatusWorkflow.php b/src/applications/daemon/management/PhabricatorDaemonManagementStatusWorkflow.php
index 9fc3cc016e..343e42ba63 100644
--- a/src/applications/daemon/management/PhabricatorDaemonManagementStatusWorkflow.php
+++ b/src/applications/daemon/management/PhabricatorDaemonManagementStatusWorkflow.php
@@ -75,7 +75,7 @@ public function execute(PhutilArgumentParser $args) {
if (!$daemon->isRunning()) {
$daemon->updateStatus(PhabricatorDaemonLog::STATUS_DEAD);
$status = 2;
- $name = ' '.$name;
+ $name = pht(' %s', $name);
}
$daemon_log = $daemon->getDaemonLog();
diff --git a/src/applications/daemon/management/PhabricatorDaemonManagementStopWorkflow.php b/src/applications/daemon/management/PhabricatorDaemonManagementStopWorkflow.php
index e57c617c83..c54a7e9fee 100644
--- a/src/applications/daemon/management/PhabricatorDaemonManagementStopWorkflow.php
+++ b/src/applications/daemon/management/PhabricatorDaemonManagementStopWorkflow.php
@@ -9,7 +9,8 @@ protected function didConstruct() {
->setSynopsis(
pht(
'Stop all running daemons, or specific daemons identified by PIDs. '.
- 'Use **phd status** to find PIDs.'))
+ 'Use **%s** to find PIDs.',
+ 'phd status'))
->setArguments(
array(
array(
diff --git a/src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php b/src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php
index def781b4a5..63303d6fb7 100644
--- a/src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php
+++ b/src/applications/daemon/management/PhabricatorDaemonManagementWorkflow.php
@@ -28,10 +28,15 @@ private function getControlDirectory($path) {
list($err) = exec_manual('mkdir -p %s', $path);
if ($err) {
throw new Exception(
- "phd requires the directory '{$path}' to exist, but it does not ".
- "exist and could not be created. Create this directory or update ".
- "'phd.pid-directory' / 'phd.log-directory' in your configuration ".
- "to point to an existing directory.");
+ pht(
+ "%s requires the directory '%s' to exist, but it does not exist ".
+ "and could not be created. Create this directory or update ".
+ "'%s' / '%s' in your configuration to point to an existing ".
+ "directory.",
+ 'phd',
+ $path,
+ 'phd.pid-directory',
+ 'phd.log-directory'));
}
}
return $path;
@@ -95,9 +100,9 @@ private function findDaemonClass($substring) {
if (count($match) == 0) {
throw new PhutilArgumentUsageException(
pht(
- "No daemons match '%s'! Use 'phd list' for a list of available ".
- "daemons.",
- $substring));
+ "No daemons match '%s'! Use '%s' for a list of available daemons.",
+ $substring,
+ 'phd list'));
} else if (count($match) > 1) {
throw new PhutilArgumentUsageException(
pht(
@@ -130,14 +135,21 @@ protected final function launchDaemons(
$current_user = $current_user['name'];
if ($phd_user && $phd_user != $current_user) {
if ($debug) {
- throw new PhutilArgumentUsageException(pht(
- 'You are trying to run a daemon as a nonstandard user, '.
- 'and `phd` was not able to `sudo` to the correct user. '."\n".
- 'Phabricator is configured to run daemons as "%s", '.
- 'but the current user is "%s". '."\n".
- 'Use `sudo` to run as a different user, pass `--as-current-user` '.
- 'to ignore this warning, or edit `phd.user` '.
- 'to change the configuration.', $phd_user, $current_user));
+ throw new PhutilArgumentUsageException(
+ pht(
+ "You are trying to run a daemon as a nonstandard user, ".
+ "and `%s` was not able to `%s` to the correct user. \n".
+ 'Phabricator is configured to run daemons as "%s", '.
+ 'but the current user is "%s". '."\n".
+ 'Use `%s` to run as a different user, pass `%s` to ignore this '.
+ 'warning, or edit `%s` to change the configuration.',
+ 'phd',
+ 'sudo',
+ $phd_user,
+ $current_user,
+ 'sudo',
+ '--as-current-user',
+ 'phd.user'));
} else {
$this->runDaemonsAsUser = $phd_user;
$console->writeOut(pht('Starting daemons as %s', $phd_user)."\n");
@@ -213,8 +225,9 @@ protected final function launchDaemons(
$this->runDaemonsAsUser);
} catch (Exception $e) {
// Retry without sudo
- $console->writeOut(pht(
- "sudo command failed. Starting daemon as current user\n"));
+ $console->writeOut(
+ "%s\n",
+ pht('sudo command failed. Starting daemon as current user.'));
$this->executeDaemonLaunchCommand(
$command,
$daemon_script_dir,
@@ -270,8 +283,10 @@ public static function requireExtensions() {
private static function mustHaveExtension($ext) {
if (!extension_loaded($ext)) {
- echo "ERROR: The PHP extension '{$ext}' is not installed. You must ".
- "install it to run daemons on this machine.\n";
+ echo pht(
+ "ERROR: The PHP extension '%s' is not installed. You must ".
+ "install it to run daemons on this machine.\n",
+ $ext);
exit(1);
}
@@ -279,8 +294,10 @@ private static function mustHaveExtension($ext) {
foreach ($extension->getFunctions() as $function) {
$function = $function->name;
if (!function_exists($function)) {
- echo "ERROR: The PHP function {$function}() is disabled. You must ".
- "enable it to run daemons on this machine.\n";
+ echo pht(
+ "ERROR: The PHP function %s is disabled. You must ".
+ "enable it to run daemons on this machine.\n",
+ $function.'()');
exit(1);
}
}
@@ -311,11 +328,15 @@ protected final function executeStartCommand(array $options) {
$message = pht(
"phd start: Unable to start daemons because daemons are already ".
"running.\n\n".
- "You can view running daemons with 'phd status'.\n".
- "You can stop running daemons with 'phd stop'.\n".
- "You can use 'phd restart' to stop all daemons before starting ".
+ "You can view running daemons with '%s'.\n".
+ "You can stop running daemons with '%s'.\n".
+ "You can use '%s' to stop all daemons before starting ".
"new daemons.\n".
- "You can force daemons to start anyway with --force.");
+ "You can force daemons to start anyway with %s.",
+ 'phd status',
+ 'phd stop',
+ 'phd restart',
+ '--force');
$console->writeErr("%s\n", $message);
exit(1);
@@ -352,7 +373,7 @@ protected final function executeStartCommand(array $options) {
$this->launchDaemons($daemons, $is_debug = false);
- $console->writeErr(pht('Done.')."\n");
+ $console->writeErr("%s\n", pht('Done.'));
return 0;
}
@@ -369,8 +390,9 @@ protected final function executeStopCommand(
if ($gently && $force) {
throw new PhutilArgumentUsageException(
pht(
- 'You can not specify conflicting options --gently and --force '.
- 'together.'));
+ 'You can not specify conflicting options %s and %s together.',
+ '--gently',
+ '--force'));
}
$daemons = $this->loadRunningDaemons();
@@ -383,8 +405,9 @@ protected final function executeStopCommand(
$force);
}
if (!$survivors) {
- $console->writeErr(pht(
- 'There are no running Phabricator daemons.')."\n");
+ $console->writeErr(
+ "%s\n",
+ pht('There are no running Phabricator daemons.'));
}
return 0;
}
@@ -392,7 +415,7 @@ protected final function executeStopCommand(
$stop_pids = $this->selectDaemonPIDs($daemons, $pids);
if (!$stop_pids) {
- $console->writeErr(pht('No daemons to kill.')."\n");
+ $console->writeErr("%s\n", pht('No daemons to kill.'));
return 0;
}
@@ -470,12 +493,13 @@ private function processRogueDaemons($grace_period, $warn, $force_stop) {
$survivors = $this->sendStopSignals($rogue_pids, $grace_period);
if ($survivors) {
$console->writeErr(
+ "%s\n",
pht(
'Unable to stop processes running without PID files. '.
- 'Try running this command again with sudo.')."\n");
+ 'Try running this command again with sudo.'));
}
} else if ($warn) {
- $console->writeErr($this->getForceStopHint($rogue_daemons)."\n");
+ $console->writeErr("%s\n", $this->getForceStopHint($rogue_daemons));
}
}
@@ -488,11 +512,11 @@ private function getForceStopHint($rogue_daemons) {
$debug_output .= $rogue['pid'].' '.$rogue['command']."\n";
}
return pht(
- 'There are processes running that look like Phabricator daemons but '.
- 'have no corresponding PID files:'."\n\n".'%s'."\n\n".
- 'Stop these processes by re-running this command with the --force '.
- 'parameter.',
- $debug_output);
+ "There are processes running that look like Phabricator daemons but ".
+ "have no corresponding PID files:\n\n%s\n\n".
+ "Stop these processes by re-running this command with the %s parameter.",
+ $debug_output,
+ '--force');
}
private function sendStopSignals($pids, $grace_period) {
diff --git a/src/applications/daemon/view/PhabricatorDaemonLogEventsView.php b/src/applications/daemon/view/PhabricatorDaemonLogEventsView.php
index b06ebdd7d2..4c0caa6fd7 100644
--- a/src/applications/daemon/view/PhabricatorDaemonLogEventsView.php
+++ b/src/applications/daemon/view/PhabricatorDaemonLogEventsView.php
@@ -99,7 +99,7 @@ public function render() {
array(
'href' => '/daemon/log/'.$event->getLogID().'/',
),
- 'Daemon '.$event->getLogID()));
+ pht('Daemon %s', $event->getLogID())));
}
$rows[] = $row;
diff --git a/src/applications/dashboard/controller/PhabricatorDashboardEditController.php b/src/applications/dashboard/controller/PhabricatorDashboardEditController.php
index cad74f7a5f..26ddd2870a 100644
--- a/src/applications/dashboard/controller/PhabricatorDashboardEditController.php
+++ b/src/applications/dashboard/controller/PhabricatorDashboardEditController.php
@@ -56,7 +56,7 @@ public function processRequest() {
$button = pht('Create Dashboard');
$cancel_uri = $this->getApplicationURI();
- $crumbs->addTextCrumb('Create Dashboard');
+ $crumbs->addTextCrumb(pht('Create Dashboard'));
} else {
$id = $dashboard->getID();
$cancel_uri = $this->getApplicationURI('manage/'.$id.'/');
@@ -226,11 +226,9 @@ private function processBuildTemplateRequest(AphrontRequest $request) {
"This is a simple template dashboard. You can edit this panel ".
"to change this text and replace it with a welcome message, or ".
"leave this placeholder text as-is to give your dashboard a ".
- "rustic, authentic feel.".
- "\n\n".
+ "rustic, authentic feel.\n\n".
"You can drag, remove, add, and edit panels to customize the ".
- "rest of this dashboard to show the information you want.".
- "\n\n".
+ "rest of this dashboard to show the information you want.\n\n".
"To install this dashboard on the home page, use the ".
"**Install Dashboard** action link above."),
));
diff --git a/src/applications/dashboard/layoutconfig/PhabricatorDashboardLayoutConfig.php b/src/applications/dashboard/layoutconfig/PhabricatorDashboardLayoutConfig.php
index af4a947c8e..9909515f06 100644
--- a/src/applications/dashboard/layoutconfig/PhabricatorDashboardLayoutConfig.php
+++ b/src/applications/dashboard/layoutconfig/PhabricatorDashboardLayoutConfig.php
@@ -124,10 +124,10 @@ public function getColumnSelectOptions() {
);
break;
case self::MODE_FULL:
- throw new Exception('There is only one column in mode full.');
+ throw new Exception(pht('There is only one column in mode full.'));
break;
default:
- throw new Exception('Unknown layout mode!');
+ throw new Exception(pht('Unknown layout mode!'));
break;
}
diff --git a/src/applications/differential/__tests__/DifferentialParseRenderTestCase.php b/src/applications/differential/__tests__/DifferentialParseRenderTestCase.php
index 9805cc7259..c278ff0c67 100644
--- a/src/applications/differential/__tests__/DifferentialParseRenderTestCase.php
+++ b/src/applications/differential/__tests__/DifferentialParseRenderTestCase.php
@@ -109,8 +109,7 @@ private function buildChangesetParsers($type, $data, $file) {
} else if ($type == 'two') {
$cparser->setRenderer(new DifferentialChangesetTwoUpTestRenderer());
} else {
- throw new Exception(
- pht('Unknown renderer type "%s"!', $type));
+ throw new Exception(pht('Unknown renderer type "%s"!', $type));
}
$parsers[] = $cparser;
diff --git a/src/applications/differential/application/PhabricatorDifferentialApplication.php b/src/applications/differential/application/PhabricatorDifferentialApplication.php
index 1aca323457..7bbe133427 100644
--- a/src/applications/differential/application/PhabricatorDifferentialApplication.php
+++ b/src/applications/differential/application/PhabricatorDifferentialApplication.php
@@ -50,11 +50,9 @@ public function getEventListeners() {
}
public function getOverview() {
- return pht(<< 'Revision was not found.',
+ 'ERR_NOT_FOUND' => pht('Revision was not found.'),
);
}
diff --git a/src/applications/differential/conduit/DifferentialCreateCommentConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialCreateCommentConduitAPIMethod.php
index fe1d57857d..c5d2bdb9dc 100644
--- a/src/applications/differential/conduit/DifferentialCreateCommentConduitAPIMethod.php
+++ b/src/applications/differential/conduit/DifferentialCreateCommentConduitAPIMethod.php
@@ -27,7 +27,7 @@ protected function defineReturnType() {
protected function defineErrorTypes() {
return array(
- 'ERR_BAD_REVISION' => 'Bad revision ID.',
+ 'ERR_BAD_REVISION' => pht('Bad revision ID.'),
);
}
diff --git a/src/applications/differential/conduit/DifferentialCreateDiffConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialCreateDiffConduitAPIMethod.php
index 8839eee6d7..91b5ca8653 100644
--- a/src/applications/differential/conduit/DifferentialCreateDiffConduitAPIMethod.php
+++ b/src/applications/differential/conduit/DifferentialCreateDiffConduitAPIMethod.php
@@ -8,7 +8,7 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return 'Create a new Differential diff.';
+ return pht('Create a new Differential diff.');
}
protected function defineParamTypes() {
diff --git a/src/applications/differential/conduit/DifferentialCreateInlineConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialCreateInlineConduitAPIMethod.php
index 98a567b0b8..6447385558 100644
--- a/src/applications/differential/conduit/DifferentialCreateInlineConduitAPIMethod.php
+++ b/src/applications/differential/conduit/DifferentialCreateInlineConduitAPIMethod.php
@@ -8,7 +8,7 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return 'Add an inline comment to a Differential revision.';
+ return pht('Add an inline comment to a Differential revision.');
}
protected function defineParamTypes() {
@@ -29,11 +29,16 @@ protected function defineReturnType() {
protected function defineErrorTypes() {
return array(
- 'ERR-BAD-REVISION' => 'Bad revision ID.',
- 'ERR-BAD-DIFF' => 'Bad diff ID, or diff does not belong to revision.',
- 'ERR-NEED-DIFF' => 'Neither revision ID nor diff ID was provided.',
- 'ERR-NEED-FILE' => 'A file path was not provided.',
- 'ERR-BAD-FILE' => "Requested file doesn't exist in this revision.",
+ 'ERR-BAD-REVISION' => pht(
+ 'Bad revision ID.'),
+ 'ERR-BAD-DIFF' => pht(
+ 'Bad diff ID, or diff does not belong to revision.'),
+ 'ERR-NEED-DIFF' => pht(
+ 'Neither revision ID nor diff ID was provided.'),
+ 'ERR-NEED-FILE' => pht(
+ 'A file path was not provided.'),
+ 'ERR-BAD-FILE' => pht(
+ "Requested file doesn't exist in this revision."),
);
}
diff --git a/src/applications/differential/conduit/DifferentialCreateRevisionConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialCreateRevisionConduitAPIMethod.php
index de0c3e02d5..95b4309c70 100644
--- a/src/applications/differential/conduit/DifferentialCreateRevisionConduitAPIMethod.php
+++ b/src/applications/differential/conduit/DifferentialCreateRevisionConduitAPIMethod.php
@@ -27,7 +27,7 @@ protected function defineReturnType() {
protected function defineErrorTypes() {
return array(
- 'ERR_BAD_DIFF' => 'Bad diff ID.',
+ 'ERR_BAD_DIFF' => pht('Bad diff ID.'),
);
}
diff --git a/src/applications/differential/conduit/DifferentialFindConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialFindConduitAPIMethod.php
index 56cb0f08da..92dce067fe 100644
--- a/src/applications/differential/conduit/DifferentialFindConduitAPIMethod.php
+++ b/src/applications/differential/conduit/DifferentialFindConduitAPIMethod.php
@@ -12,11 +12,11 @@ public function getMethodStatus() {
}
public function getMethodStatusDescription() {
- return "Replaced by 'differential.query'.";
+ return pht("Replaced by '%s'.", 'differential.query');
}
public function getMethodDescription() {
- return 'Query Differential revisions which match certain criteria.';
+ return pht('Query Differential revisions which match certain criteria.');
}
protected function defineParamTypes() {
diff --git a/src/applications/differential/conduit/DifferentialFinishPostponedLintersConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialFinishPostponedLintersConduitAPIMethod.php
index 093f06e117..f53340f06b 100644
--- a/src/applications/differential/conduit/DifferentialFinishPostponedLintersConduitAPIMethod.php
+++ b/src/applications/differential/conduit/DifferentialFinishPostponedLintersConduitAPIMethod.php
@@ -8,8 +8,9 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return 'Update diff with new lint messages and mark postponed '.
- 'linters as finished.';
+ return pht(
+ 'Update diff with new lint messages and mark postponed '.
+ 'linters as finished.');
}
protected function defineParamTypes() {
@@ -25,14 +26,13 @@ protected function defineReturnType() {
protected function defineErrorTypes() {
return array(
- 'ERR-BAD-DIFF' => 'Bad diff ID.',
- 'ERR-BAD-LINTER' => 'No postponed linter by the given name',
- 'ERR-NO-LINT' => 'No postponed lint field available in diff',
+ 'ERR-BAD-DIFF' => pht('Bad diff ID.'),
+ 'ERR-BAD-LINTER' => pht('No postponed linter by the given name.'),
+ 'ERR-NO-LINT' => pht('No postponed lint field available in diff.'),
);
}
protected function execute(ConduitAPIRequest $request) {
-
$diff_id = $request->getValue('diffID');
$linter_map = $request->getValue('linters');
diff --git a/src/applications/differential/conduit/DifferentialGetAllDiffsConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialGetAllDiffsConduitAPIMethod.php
index c4e2d35215..187e1aaaf4 100644
--- a/src/applications/differential/conduit/DifferentialGetAllDiffsConduitAPIMethod.php
+++ b/src/applications/differential/conduit/DifferentialGetAllDiffsConduitAPIMethod.php
@@ -13,11 +13,12 @@ public function getMethodStatus() {
public function getMethodStatusDescription() {
return pht(
- 'This method has been deprecated in favor of differential.querydiffs.');
+ 'This method has been deprecated in favor of %s.',
+ 'differential.querydiffs');
}
public function getMethodDescription() {
- return 'Load all diffs for given revisions from Differential.';
+ return pht('Load all diffs for given revisions from Differential.');
}
protected function defineParamTypes() {
diff --git a/src/applications/differential/conduit/DifferentialGetCommitMessageConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialGetCommitMessageConduitAPIMethod.php
index 8d7e71c030..288a8c4ca9 100644
--- a/src/applications/differential/conduit/DifferentialGetCommitMessageConduitAPIMethod.php
+++ b/src/applications/differential/conduit/DifferentialGetCommitMessageConduitAPIMethod.php
@@ -8,7 +8,7 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return 'Retrieve Differential commit messages or message templates.';
+ return pht('Retrieve Differential commit messages or message templates.');
}
protected function defineParamTypes() {
@@ -27,7 +27,7 @@ protected function defineReturnType() {
protected function defineErrorTypes() {
return array(
- 'ERR_NOT_FOUND' => 'Revision was not found.',
+ 'ERR_NOT_FOUND' => pht('Revision was not found.'),
);
}
diff --git a/src/applications/differential/conduit/DifferentialGetCommitPathsConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialGetCommitPathsConduitAPIMethod.php
index a025cd4983..bdd33b60fd 100644
--- a/src/applications/differential/conduit/DifferentialGetCommitPathsConduitAPIMethod.php
+++ b/src/applications/differential/conduit/DifferentialGetCommitPathsConduitAPIMethod.php
@@ -8,8 +8,9 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return 'Query which paths should be included when committing a '.
- 'Differential revision.';
+ return pht(
+ 'Query which paths should be included when committing a '.
+ 'Differential revision.');
}
protected function defineParamTypes() {
@@ -24,7 +25,7 @@ protected function defineReturnType() {
protected function defineErrorTypes() {
return array(
- 'ERR_NOT_FOUND' => 'No such revision exists.',
+ 'ERR_NOT_FOUND' => pht('No such revision exists.'),
);
}
diff --git a/src/applications/differential/conduit/DifferentialGetDiffConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialGetDiffConduitAPIMethod.php
index 92d9807dda..a47c9c616b 100644
--- a/src/applications/differential/conduit/DifferentialGetDiffConduitAPIMethod.php
+++ b/src/applications/differential/conduit/DifferentialGetDiffConduitAPIMethod.php
@@ -24,8 +24,8 @@ public function getMethodStatusDescription() {
public function getMethodDescription() {
return pht(
- 'Load the content of a diff from Differential by revision id '.
- 'or diff id.');
+ 'Load the content of a diff from Differential by revision ID '.
+ 'or diff ID.');
}
protected function defineParamTypes() {
@@ -41,7 +41,7 @@ protected function defineReturnType() {
protected function defineErrorTypes() {
return array(
- 'ERR_BAD_DIFF' => 'No such diff exists.',
+ 'ERR_BAD_DIFF' => pht('No such diff exists.'),
);
}
diff --git a/src/applications/differential/conduit/DifferentialGetRevisionCommentsConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialGetRevisionCommentsConduitAPIMethod.php
index 6a6770d3e8..1ea23e33a2 100644
--- a/src/applications/differential/conduit/DifferentialGetRevisionCommentsConduitAPIMethod.php
+++ b/src/applications/differential/conduit/DifferentialGetRevisionCommentsConduitAPIMethod.php
@@ -16,7 +16,7 @@ public function getMethodStatusDescription() {
}
public function getMethodDescription() {
- return 'Retrieve Differential Revision Comments.';
+ return pht('Retrieve Differential Revision Comments.');
}
protected function defineParamTypes() {
diff --git a/src/applications/differential/conduit/DifferentialQueryConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialQueryConduitAPIMethod.php
index 305b071be8..2bf43d295e 100644
--- a/src/applications/differential/conduit/DifferentialQueryConduitAPIMethod.php
+++ b/src/applications/differential/conduit/DifferentialQueryConduitAPIMethod.php
@@ -8,7 +8,7 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return 'Query Differential revisions which match certain criteria.';
+ return pht('Query Differential revisions which match certain criteria.');
}
protected function defineParamTypes() {
@@ -53,7 +53,7 @@ protected function defineReturnType() {
protected function defineErrorTypes() {
return array(
- 'ERR-INVALID-PARAMETER' => 'Missing or malformed parameter.',
+ 'ERR-INVALID-PARAMETER' => pht('Missing or malformed parameter.'),
);
}
@@ -103,7 +103,9 @@ protected function execute(ConduitAPIRequest $request) {
}
throw id(new ConduitException('ERR-INVALID-PARAMETER'))
->setErrorDescription(
- 'Unknown paths: '.implode(', ', $unknown_paths));
+ pht(
+ 'Unknown paths: %s',
+ implode(', ', $unknown_paths)));
}
$repos = array();
@@ -118,7 +120,9 @@ protected function execute(ConduitAPIRequest $request) {
if (!$repos[$callsign]) {
throw id(new ConduitException('ERR-INVALID-PARAMETER'))
->setErrorDescription(
- 'Unknown repo callsign: '.$callsign);
+ pht(
+ 'Unknown repo callsign: %s',
+ $callsign));
}
}
$repo = $repos[$callsign];
diff --git a/src/applications/differential/conduit/DifferentialSetDiffPropertyConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialSetDiffPropertyConduitAPIMethod.php
index d79be1363d..f9db11e3fb 100644
--- a/src/applications/differential/conduit/DifferentialSetDiffPropertyConduitAPIMethod.php
+++ b/src/applications/differential/conduit/DifferentialSetDiffPropertyConduitAPIMethod.php
@@ -8,7 +8,7 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return 'Attach properties to Differential diffs.';
+ return pht('Attach properties to Differential diffs.');
}
protected function defineParamTypes() {
@@ -25,7 +25,7 @@ protected function defineReturnType() {
protected function defineErrorTypes() {
return array(
- 'ERR_NOT_FOUND' => 'Diff was not found.',
+ 'ERR_NOT_FOUND' => pht('Diff was not found.'),
);
}
diff --git a/src/applications/differential/conduit/DifferentialUpdateRevisionConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialUpdateRevisionConduitAPIMethod.php
index e8a34fd133..232dbf79b4 100644
--- a/src/applications/differential/conduit/DifferentialUpdateRevisionConduitAPIMethod.php
+++ b/src/applications/differential/conduit/DifferentialUpdateRevisionConduitAPIMethod.php
@@ -26,10 +26,10 @@ protected function defineReturnType() {
protected function defineErrorTypes() {
return array(
- 'ERR_BAD_DIFF' => 'Bad diff ID.',
- 'ERR_BAD_REVISION' => 'Bad revision ID.',
- 'ERR_WRONG_USER' => 'You are not the author of this revision.',
- 'ERR_CLOSED' => 'This revision has already been closed.',
+ 'ERR_BAD_DIFF' => pht('Bad diff ID.'),
+ 'ERR_BAD_REVISION' => pht('Bad revision ID.'),
+ 'ERR_WRONG_USER' => pht('You are not the author of this revision.'),
+ 'ERR_CLOSED' => pht('This revision has already been closed.'),
);
}
diff --git a/src/applications/differential/conduit/DifferentialUpdateUnitResultsConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialUpdateUnitResultsConduitAPIMethod.php
index 0f0c14a6b8..7b1a250666 100644
--- a/src/applications/differential/conduit/DifferentialUpdateUnitResultsConduitAPIMethod.php
+++ b/src/applications/differential/conduit/DifferentialUpdateUnitResultsConduitAPIMethod.php
@@ -8,7 +8,7 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return 'Update arc unit results for a postponed test.';
+ return pht('Update arc unit results for a postponed test.');
}
protected function defineParamTypes() {
@@ -29,13 +29,12 @@ protected function defineReturnType() {
protected function defineErrorTypes() {
return array(
- 'ERR_BAD_DIFF' => 'Bad diff ID.',
- 'ERR_NO_RESULTS' => 'Could not find the postponed test',
+ 'ERR_BAD_DIFF' => pht('Bad diff ID.'),
+ 'ERR_NO_RESULTS' => pht('Could not find the postponed test'),
);
}
protected function execute(ConduitAPIRequest $request) {
-
$diff_id = $request->getValue('diff_id');
if (!$diff_id) {
throw new ConduitException('ERR_BAD_DIFF');
diff --git a/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php b/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php
index 6169d0df88..2c8f4e0bd9 100644
--- a/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php
+++ b/src/applications/differential/config/PhabricatorDifferentialConfigOptions.php
@@ -201,11 +201,12 @@ public function getOptions() {
))
->setSummary(pht('Allows any user to reopen a closed revision.'))
->setDescription(
- pht('If you set this to true, any user can reopen a revision so '.
- 'long as it has been closed. This can be useful if a revision '.
- 'is accidentally closed or if a developer changes his or her '.
- 'mind after closing a revision. If it is false, reopening '.
- 'is not allowed.')),
+ pht(
+ 'If you set this to true, any user can reopen a revision so '.
+ 'long as it has been closed. This can be useful if a revision '.
+ 'is accidentally closed or if a developer changes his or her '.
+ 'mind after closing a revision. If it is false, reopening '.
+ 'is not allowed.')),
$this->newOption('differential.close-on-accept', 'bool', false)
->setBoolOptions(
array(
@@ -242,8 +243,9 @@ public function getOptions() {
pht("After this many days, a revision will be considered 'stale'."))
->setDescription(
pht(
- "Similar to `differential.days-fresh` but marks stale revisions. ".
- "If the revision is even older than it is when marked as 'old'.")),
+ "Similar to `%s` but marks stale revisions. ".
+ "If the revision is even older than it is when marked as 'old'.",
+ 'differential.days-fresh')),
$this->newOption(
'metamta.differential.subject-prefix',
'string',
diff --git a/src/applications/differential/constants/DifferentialAction.php b/src/applications/differential/constants/DifferentialAction.php
index 48a263c45a..5b5fa9eb71 100644
--- a/src/applications/differential/constants/DifferentialAction.php
+++ b/src/applications/differential/constants/DifferentialAction.php
@@ -23,71 +23,88 @@ final class DifferentialAction {
public static function getBasicStoryText($action, $author_name) {
switch ($action) {
case self::ACTION_COMMENT:
- $title = pht('%s commented on this revision.',
+ $title = pht(
+ '%s commented on this revision.',
$author_name);
break;
case self::ACTION_ACCEPT:
- $title = pht('%s accepted this revision.',
+ $title = pht(
+ '%s accepted this revision.',
$author_name);
break;
case self::ACTION_REJECT:
- $title = pht('%s requested changes to this revision.',
+ $title = pht(
+ '%s requested changes to this revision.',
$author_name);
break;
case self::ACTION_RETHINK:
- $title = pht('%s planned changes to this revision.',
+ $title = pht(
+ '%s planned changes to this revision.',
$author_name);
break;
case self::ACTION_ABANDON:
- $title = pht('%s abandoned this revision.',
+ $title = pht(
+ '%s abandoned this revision.',
$author_name);
break;
case self::ACTION_CLOSE:
- $title = pht('%s closed this revision.',
+ $title = pht(
+ '%s closed this revision.',
$author_name);
break;
case self::ACTION_REQUEST:
- $title = pht('%s requested a review of this revision.',
+ $title = pht(
+ '%s requested a review of this revision.',
$author_name);
break;
case self::ACTION_RECLAIM:
- $title = pht('%s reclaimed this revision.',
+ $title = pht(
+ '%s reclaimed this revision.',
$author_name);
break;
case self::ACTION_UPDATE:
- $title = pht('%s updated this revision.',
+ $title = pht(
+ '%s updated this revision.',
$author_name);
break;
case self::ACTION_RESIGN:
- $title = pht('%s resigned from this revision.',
+ $title = pht(
+ '%s resigned from this revision.',
$author_name);
break;
case self::ACTION_SUMMARIZE:
- $title = pht('%s summarized this revision.',
+ $title = pht(
+ '%s summarized this revision.',
$author_name);
break;
case self::ACTION_TESTPLAN:
- $title = pht('%s explained the test plan for this revision.',
+ $title = pht(
+ '%s explained the test plan for this revision.',
$author_name);
break;
case self::ACTION_CREATE:
- $title = pht('%s created this revision.',
+ $title = pht(
+ '%s created this revision.',
$author_name);
break;
case self::ACTION_ADDREVIEWERS:
- $title = pht('%s added reviewers to this revision.',
+ $title = pht(
+ '%s added reviewers to this revision.',
$author_name);
break;
case self::ACTION_ADDCCS:
- $title = pht('%s added CCs to this revision.',
+ $title = pht(
+ '%s added CCs to this revision.',
$author_name);
break;
case self::ACTION_CLAIM:
- $title = pht('%s commandeered this revision.',
+ $title = pht(
+ '%s commandeered this revision.',
$author_name);
break;
case self::ACTION_REOPEN:
- $title = pht('%s reopened this revision.',
+ $title = pht(
+ '%s reopened this revision.',
$author_name);
break;
case DifferentialTransaction::TYPE_INLINE:
@@ -122,7 +139,7 @@ public static function getActionVerb($action) {
if (!empty($verbs[$action])) {
return $verbs[$action];
} else {
- return 'brazenly '.$action;
+ return pht('brazenly %s', $action);
}
}
diff --git a/src/applications/differential/constants/DifferentialChangeType.php b/src/applications/differential/constants/DifferentialChangeType.php
index 2ce5392165..7e037d29b5 100644
--- a/src/applications/differential/constants/DifferentialChangeType.php
+++ b/src/applications/differential/constants/DifferentialChangeType.php
@@ -105,7 +105,7 @@ public static function getFullNameForChangeType($type) {
self::TYPE_MESSAGE => pht('Commit Message'),
self::TYPE_CHILD => pht('Contents Modified'),
);
- return idx($types, coalesce($type, '?'), 'Unknown');
+ return idx($types, coalesce($type, '?'), pht('Unknown'));
}
}
diff --git a/src/applications/differential/controller/DifferentialChangesetViewController.php b/src/applications/differential/controller/DifferentialChangesetViewController.php
index abc19ab836..2373d3ef2c 100644
--- a/src/applications/differential/controller/DifferentialChangesetViewController.php
+++ b/src/applications/differential/controller/DifferentialChangesetViewController.php
@@ -191,6 +191,7 @@ public function handleRequest(AphrontRequest $request) {
if ($revision) {
$query = id(new DifferentialInlineCommentQuery())
->setViewer($viewer)
+ ->needHidden(true)
->withRevisionPHIDs(array($revision->getPHID()));
$inlines = $query->execute();
$inlines = $query->adjustInlinesForChangesets(
@@ -372,7 +373,7 @@ private function buildLintInlineComments($changeset) {
$inline = new DifferentialInlineComment();
$inline->setChangesetID($changeset->getID());
$inline->setIsNewFile(1);
- $inline->setSyntheticAuthor('Lint: '.$msg['name']);
+ $inline->setSyntheticAuthor(pht('Lint: %s', $msg['name']));
$inline->setLineNumber($msg['line']);
$inline->setLineLength(0);
diff --git a/src/applications/differential/controller/DifferentialDiffCreateController.php b/src/applications/differential/controller/DifferentialDiffCreateController.php
index 7781f22023..1eb4f88b1a 100644
--- a/src/applications/differential/controller/DifferentialDiffCreateController.php
+++ b/src/applications/differential/controller/DifferentialDiffCreateController.php
@@ -89,7 +89,7 @@ public function handleRequest(AphrontRequest $request) {
'href' => $arcanist_href,
'target' => '_blank',
),
- 'Learn More');
+ pht('Learn More'));
$cancel_uri = $this->getApplicationURI();
diff --git a/src/applications/differential/controller/DifferentialInlineCommentEditController.php b/src/applications/differential/controller/DifferentialInlineCommentEditController.php
index dcb48361dc..deba6af01b 100644
--- a/src/applications/differential/controller/DifferentialInlineCommentEditController.php
+++ b/src/applications/differential/controller/DifferentialInlineCommentEditController.php
@@ -29,7 +29,7 @@ protected function createComment() {
$revision = $this->loadRevision();
if (!id(new DifferentialChangeset())->load($changeset_id)) {
- throw new Exception('Invalid changeset ID!');
+ throw new Exception(pht('Invalid changeset ID!'));
}
return id(new DifferentialInlineComment())
@@ -42,6 +42,7 @@ protected function loadComment($id) {
->setViewer($this->getViewer())
->withIDs(array($id))
->withDeletedDrafts(true)
+ ->needHidden(true)
->executeOne();
}
@@ -50,6 +51,7 @@ protected function loadCommentByPHID($phid) {
->setViewer($this->getViewer())
->withPHIDs(array($phid))
->withDeletedDrafts(true)
+ ->needHidden(true)
->executeOne();
}
@@ -59,7 +61,7 @@ protected function loadCommentForEdit($id) {
$inline = $this->loadComment($id);
if (!$this->canEditInlineComment($user, $inline)) {
- throw new Exception('That comment is not editable!');
+ throw new Exception(pht('That comment is not editable!'));
}
return $inline;
}
@@ -152,4 +154,38 @@ protected function loadObjectOwnerPHID(
return $this->loadRevision()->getAuthorPHID();
}
+ protected function hideComments(array $ids) {
+ $viewer = $this->getViewer();
+ $table = new DifferentialHiddenComment();
+ $conn_w = $table->establishConnection('w');
+
+ $sql = array();
+ foreach ($ids as $id) {
+ $sql[] = qsprintf(
+ $conn_w,
+ '(%s, %d)',
+ $viewer->getPHID(),
+ $id);
+ }
+
+ queryfx(
+ $conn_w,
+ 'INSERT IGNORE INTO %T (userPHID, commentID) VALUES %Q',
+ $table->getTableName(),
+ implode(', ', $sql));
+ }
+
+ protected function showComments(array $ids) {
+ $viewer = $this->getViewer();
+ $table = new DifferentialHiddenComment();
+ $conn_w = $table->establishConnection('w');
+
+ queryfx(
+ $conn_w,
+ 'DELETE FROM %T WHERE userPHID = %s AND commentID IN (%Ld)',
+ $table->getTableName(),
+ $viewer->getPHID(),
+ $ids);
+ }
+
}
diff --git a/src/applications/differential/controller/DifferentialInlineCommentPreviewController.php b/src/applications/differential/controller/DifferentialInlineCommentPreviewController.php
index 846cab5439..519b08bb63 100644
--- a/src/applications/differential/controller/DifferentialInlineCommentPreviewController.php
+++ b/src/applications/differential/controller/DifferentialInlineCommentPreviewController.php
@@ -19,6 +19,7 @@ protected function loadInlineComments() {
->withDrafts(true)
->withAuthorPHIDs(array($viewer->getPHID()))
->withRevisionPHIDs(array($revision->getPHID()))
+ ->needHidden(true)
->execute();
}
diff --git a/src/applications/differential/controller/DifferentialRevisionCloseDetailsController.php b/src/applications/differential/controller/DifferentialRevisionCloseDetailsController.php
index 0f797d94d3..25051bcbb5 100644
--- a/src/applications/differential/controller/DifferentialRevisionCloseDetailsController.php
+++ b/src/applications/differential/controller/DifferentialRevisionCloseDetailsController.php
@@ -55,9 +55,10 @@ private function getRevisionMatchExplanation(
$body_why = array();
if ($revision_match_data['usedURI']) {
return pht(
- 'We found a "Differential Revision" field with value "%s" in the '.
- 'commit message, and the domain on the URI matches this install, so '.
+ 'We found a "%s" field with value "%s" in the commit message, '.
+ 'and the domain on the URI matches this install, so '.
'we linked this commit to %s.',
+ 'Differential Revision',
$revision_match_data['foundURI'],
phutil_tag(
'a',
@@ -67,16 +68,17 @@ private function getRevisionMatchExplanation(
$obj_handle->getName()));
} else if ($revision_match_data['foundURI']) {
$body_why[] = pht(
- 'We found a "Differential Revision" field with value "%s" in the '.
- 'commit message, but the domain on this URI did not match the '.
- 'configured domain for this install, "%s", so we ignored it under '.
+ 'We found a "%s" field with value "%s" in the commit message, '.
+ 'but the domain on this URI did not match the configured '.
+ 'domain for this install, "%s", so we ignored it under '.
'the assumption that it refers to some third-party revision.',
+ 'Differential Revision',
$revision_match_data['foundURI'],
$revision_match_data['validDomain']);
} else {
$body_why[] = pht(
- 'We didn\'t find a "Differential Revision" field in the commit '.
- 'message.');
+ 'We didn\'t find a "%s" field in the commit message.',
+ 'Differential Revision');
}
switch ($revision_match_data['matchHashType']) {
diff --git a/src/applications/differential/controller/DifferentialRevisionEditController.php b/src/applications/differential/controller/DifferentialRevisionEditController.php
index ea26693454..1c664f07d2 100644
--- a/src/applications/differential/controller/DifferentialRevisionEditController.php
+++ b/src/applications/differential/controller/DifferentialRevisionEditController.php
@@ -49,7 +49,8 @@ public function processRequest() {
}
if ($diff->getRevisionID()) {
// TODO: Redirect?
- throw new Exception('This diff is already attached to a revision!');
+ throw new Exception(
+ pht('This diff is already attached to a revision!'));
}
} else {
$diff = null;
diff --git a/src/applications/differential/controller/DifferentialRevisionLandController.php b/src/applications/differential/controller/DifferentialRevisionLandController.php
index 1c8ed0e9d3..e19762b44d 100644
--- a/src/applications/differential/controller/DifferentialRevisionLandController.php
+++ b/src/applications/differential/controller/DifferentialRevisionLandController.php
@@ -29,10 +29,12 @@ public function processRequest() {
$this->pushStrategy = newv($this->strategyClass, array());
} else {
throw new Exception(
- "Strategy type must be a valid class name and must subclass ".
- "DifferentialLandingStrategy. ".
- "'{$this->strategyClass}' is not a subclass of ".
- "DifferentialLandingStrategy.");
+ pht(
+ "Strategy type must be a valid class name and must subclass ".
+ "%s. '%s' is not a subclass of %s",
+ 'DifferentialLandingStrategy',
+ $this->strategyClass,
+ 'DifferentialLandingStrategy'));
}
if ($request->isDialogFormPost()) {
@@ -91,7 +93,7 @@ public function processRequest() {
$prompt = hsprintf('%s
%s',
pht(
'This will squash and rebase revision %s, and push it to '.
- 'the default / master branch.',
+ 'the default / master branch.',
$revision_id),
pht('It is an experimental feature and may not work.'));
@@ -109,13 +111,13 @@ public function processRequest() {
private function attemptLand($revision, $request) {
$status = $revision->getStatus();
if ($status != ArcanistDifferentialRevisionStatus::ACCEPTED) {
- throw new Exception('Only Accepted revisions can be landed.');
+ throw new Exception(pht('Only Accepted revisions can be landed.'));
}
$repository = $revision->getRepository();
if ($repository === null) {
- throw new Exception('revision is not attached to a repository.');
+ throw new Exception(pht('Revision is not attached to a repository.'));
}
$can_push = PhabricatorPolicyFilter::hasCapability(
diff --git a/src/applications/differential/controller/DifferentialRevisionViewController.php b/src/applications/differential/controller/DifferentialRevisionViewController.php
index 849ef056aa..7069e5ae97 100644
--- a/src/applications/differential/controller/DifferentialRevisionViewController.php
+++ b/src/applications/differential/controller/DifferentialRevisionViewController.php
@@ -38,7 +38,7 @@ public function processRequest() {
if (!$diffs) {
throw new Exception(
- 'This revision has no diffs. Something has gone quite wrong.');
+ pht('This revision has no diffs. Something has gone quite wrong.'));
}
$revision->attachActiveDiff(last($diffs));
@@ -151,7 +151,7 @@ public function processRequest() {
if (count($changesets) > $limit && !$large) {
$count = count($changesets);
$warning = new PHUIInfoView();
- $warning->setTitle('Very Large Diff');
+ $warning->setTitle(pht('Very Large Diff'));
$warning->setSeverity(PHUIInfoView::SEVERITY_WARNING);
$warning->appendChild(hsprintf(
'%s %s',
@@ -175,6 +175,7 @@ public function processRequest() {
$query = id(new DifferentialInlineCommentQuery())
->setViewer($user)
+ ->needHidden(true)
->withRevisionPHIDs(array($revision->getPHID()));
$inlines = $query->execute();
$inlines = $query->adjustInlinesForChangesets(
@@ -261,12 +262,11 @@ public function processRequest() {
$repository = $revision->getRepository();
if ($repository) {
- list($symbol_indexes, $repository_phids) = $this->buildSymbolIndexes(
+ $symbol_indexes = $this->buildSymbolIndexes(
$repository,
$visible_changesets);
} else {
$symbol_indexes = array();
- $repository_phids = null;
}
$revision_detail->setActions($actions);
@@ -306,15 +306,6 @@ public function processRequest() {
),
$comment_view);
- if ($repository) {
- Javelin::initBehavior(
- 'repository-crossreference',
- array(
- 'section' => $wrap_id,
- 'repositories' => $repository_phids,
- ));
- }
-
$changeset_view = new DifferentialChangesetListView();
$changeset_view->setChangesets($changesets);
$changeset_view->setVisibleChangesets($visible_changesets);
@@ -338,7 +329,7 @@ public function processRequest() {
$changeset_view->setRepository($repository);
}
$changeset_view->setSymbolIndexes($symbol_indexes);
- $changeset_view->setTitle('Diff '.$target->getID());
+ $changeset_view->setTitle(pht('Diff %s', $target->getID()));
$diff_history = id(new DifferentialRevisionUpdateHistoryView())
->setUser($user)
@@ -758,11 +749,22 @@ private function buildSymbolIndexes(
$langs = $repository->getSymbolLanguages();
$langs = nonempty($langs, array());
+ $sources = $repository->getSymbolSources();
+ $sources = nonempty($sources, array());
+
$symbol_indexes = array();
+ if ($langs && $sources) {
+ $have_symbols = id(new DiffusionSymbolQuery())
+ ->existsSymbolsInRepository($repository->getPHID());
+ if (!$have_symbols) {
+ return $symbol_indexes;
+ }
+ }
+
$repository_phids = array_merge(
array($repository->getPHID()),
- nonempty($repository->getSymbolSources(), array()));
+ $sources);
$indexed_langs = array_fill_keys($langs, true);
foreach ($visible_changesets as $key => $changeset) {
@@ -775,7 +777,7 @@ private function buildSymbolIndexes(
}
}
- return array($symbol_indexes, $repository_phids);
+ return $symbol_indexes;
}
private function loadOtherRevisions(
diff --git a/src/applications/differential/customfield/DifferentialBranchField.php b/src/applications/differential/customfield/DifferentialBranchField.php
index 5601d66625..35ed809f12 100644
--- a/src/applications/differential/customfield/DifferentialBranchField.php
+++ b/src/applications/differential/customfield/DifferentialBranchField.php
@@ -45,8 +45,9 @@ private function getBranchDescription(DifferentialDiff $diff) {
public function getProTips() {
return array(
pht(
- 'In Git and Mercurial, use a branch like "T123" to automatically '.
- 'associate changes with the corresponding task.'),
+ 'In Git and Mercurial, use a branch like "%s" to automatically '.
+ 'associate changes with the corresponding task.',
+ 'T123'),
);
}
diff --git a/src/applications/differential/customfield/DifferentialConflictsField.php b/src/applications/differential/customfield/DifferentialConflictsField.php
index ac5c75326f..590d9fd3a7 100644
--- a/src/applications/differential/customfield/DifferentialConflictsField.php
+++ b/src/applications/differential/customfield/DifferentialConflictsField.php
@@ -22,8 +22,8 @@ public function getFieldName() {
public function getFieldDescription() {
return pht(
- 'Parses the "Conflicts" field which Git can inject into commit '.
- 'messages.');
+ 'Parses the "%s" field which Git can inject into commit messages.',
+ 'Conflicts');
}
public function canDisableField() {
diff --git a/src/applications/differential/customfield/DifferentialDependsOnField.php b/src/applications/differential/customfield/DifferentialDependsOnField.php
index 555cb03688..17156fe240 100644
--- a/src/applications/differential/customfield/DifferentialDependsOnField.php
+++ b/src/applications/differential/customfield/DifferentialDependsOnField.php
@@ -45,7 +45,8 @@ public function getProTips() {
return array(
pht(
'Create a dependency between revisions by writing '.
- '"Depends on D123" in your summary.'),
+ '"%s" in your summary.',
+ 'Depends on D123'),
);
}
diff --git a/src/applications/differential/customfield/DifferentialGitSVNIDField.php b/src/applications/differential/customfield/DifferentialGitSVNIDField.php
index a671e10bd6..de45c54c7f 100644
--- a/src/applications/differential/customfield/DifferentialGitSVNIDField.php
+++ b/src/applications/differential/customfield/DifferentialGitSVNIDField.php
@@ -22,8 +22,8 @@ public function getFieldName() {
public function getFieldDescription() {
return pht(
- 'Parses the "git-svn-id" field which Git/SVN can inject into commit '.
- 'messages.');
+ 'Parses the "%s" field which Git/SVN can inject into commit messages.',
+ 'git-svn-id');
}
public function canDisableField() {
diff --git a/src/applications/differential/customfield/DifferentialLintField.php b/src/applications/differential/customfield/DifferentialLintField.php
index 56b7ec3ae6..c43034dd06 100644
--- a/src/applications/differential/customfield/DifferentialLintField.php
+++ b/src/applications/differential/customfield/DifferentialLintField.php
@@ -83,7 +83,7 @@ public function renderPropertyViewValue(array $handles) {
$name = idx($message, 'name');
$description = idx($message, 'description');
- $line_link = 'line '.intval($line);
+ $line_link = pht('line %d', intval($line));
if (isset($path_changesets[$path])) {
$href = '#C'.$path_changesets[$path].'NL'.max(1, $line);
@@ -130,7 +130,9 @@ public function renderPropertyViewValue(array $handles) {
idx($location, 'path', $path).
($other_line ? ":{$other_line}" : '');
}
- $description .= "\nOther locations: ".implode(', ', $locations);
+ $description .= "\n".pht(
+ 'Other locations: %s',
+ implode(', ', $locations));
}
if (strlen($description)) {
@@ -231,7 +233,9 @@ private function renderShowString(array $hidden) {
}
}
- return 'Show Full Lint Results ('.implode(', ', $show).')';
+ return pht(
+ 'Show Full Lint Results (%s)',
+ implode(', ', $show));
}
public function getWarningsForDetailView() {
diff --git a/src/applications/differential/customfield/DifferentialManiphestTasksField.php b/src/applications/differential/customfield/DifferentialManiphestTasksField.php
index b13cfcc304..56803f60c3 100644
--- a/src/applications/differential/customfield/DifferentialManiphestTasksField.php
+++ b/src/applications/differential/customfield/DifferentialManiphestTasksField.php
@@ -106,8 +106,9 @@ public function renderCommitMessageValue(array $handles) {
public function getProTips() {
return array(
pht(
- 'Write "Fixes T123" in your summary to automatically close the '.
- 'corresponding task when this change lands.'),
+ 'Write "%s" in your summary to automatically close the '.
+ 'corresponding task when this change lands.',
+ 'Fixes T123'),
);
}
diff --git a/src/applications/differential/customfield/DifferentialProjectReviewersField.php b/src/applications/differential/customfield/DifferentialProjectReviewersField.php
index aff5644a52..1eea4f51b9 100644
--- a/src/applications/differential/customfield/DifferentialProjectReviewersField.php
+++ b/src/applications/differential/customfield/DifferentialProjectReviewersField.php
@@ -61,7 +61,8 @@ public function getProTips() {
return array(
pht(
'You can add a project as a subscriber or reviewer by writing '.
- '"#projectname" in the appropriate field.'),
+ '"%s" in the appropriate field.',
+ '#projectname'),
);
}
diff --git a/src/applications/differential/customfield/DifferentialRepositoryField.php b/src/applications/differential/customfield/DifferentialRepositoryField.php
index 76f40d0957..fc6c88194a 100644
--- a/src/applications/differential/customfield/DifferentialRepositoryField.php
+++ b/src/applications/differential/customfield/DifferentialRepositoryField.php
@@ -155,7 +155,8 @@ public function updateTransactionMailBody(
return;
}
- $body->addTextSection(pht('REPOSITORY'),
+ $body->addTextSection(
+ pht('REPOSITORY'),
$repository->getMonogram().' '.$repository->getName());
}
diff --git a/src/applications/differential/customfield/DifferentialRevisionIDField.php b/src/applications/differential/customfield/DifferentialRevisionIDField.php
index bb54951dc4..9d23cf7658 100644
--- a/src/applications/differential/customfield/DifferentialRevisionIDField.php
+++ b/src/applications/differential/customfield/DifferentialRevisionIDField.php
@@ -19,8 +19,7 @@ public function getFieldName() {
public function getFieldDescription() {
return pht(
- 'Ties commits to revisions and provides a permananent link between '.
- 'them.');
+ 'Ties commits to revisions and provides a permanent link between them.');
}
public function canDisableField() {
diff --git a/src/applications/differential/customfield/DifferentialUnitField.php b/src/applications/differential/customfield/DifferentialUnitField.php
index cf183bf381..2cc86d2660 100644
--- a/src/applications/differential/customfield/DifferentialUnitField.php
+++ b/src/applications/differential/customfield/DifferentialUnitField.php
@@ -49,7 +49,7 @@ public function renderPropertyViewValue(array $handles) {
if ($excuse) {
$rows[] = array(
'style' => 'excuse',
- 'name' => 'Excuse',
+ 'name' => pht('Excuse'),
'value' => phutil_escape_html_newlines($excuse),
'show' => true,
);
@@ -83,8 +83,8 @@ public function renderPropertyViewValue(array $handles) {
$userdata = str_replace("\000", '', $userdata);
}
$markup_object = id(new PhabricatorMarkupOneOff())
- ->setContent($userdata)
- ->setPreserveLinebreaks(true);
+ ->setContent($userdata)
+ ->setPreserveLinebreaks(true);
$engine->addObject($markup_object, 'default');
$markup_objects[$key] = $markup_object;
}
@@ -189,12 +189,12 @@ private function renderShowString(array $hidden) {
)) + $hidden;
$noun = array(
- ArcanistUnitTestResult::RESULT_BROKEN => 'Broken',
- ArcanistUnitTestResult::RESULT_FAIL => 'Failed',
- ArcanistUnitTestResult::RESULT_UNSOUND => 'Unsound',
- ArcanistUnitTestResult::RESULT_SKIP => 'Skipped',
- ArcanistUnitTestResult::RESULT_POSTPONED => 'Postponed',
- ArcanistUnitTestResult::RESULT_PASS => 'Passed',
+ ArcanistUnitTestResult::RESULT_BROKEN => pht('Broken'),
+ ArcanistUnitTestResult::RESULT_FAIL => pht('Failed'),
+ ArcanistUnitTestResult::RESULT_UNSOUND => pht('Unsound'),
+ ArcanistUnitTestResult::RESULT_SKIP => pht('Skipped'),
+ ArcanistUnitTestResult::RESULT_POSTPONED => pht('Postponed'),
+ ArcanistUnitTestResult::RESULT_PASS => pht('Passed'),
);
$show = array();
@@ -206,7 +206,9 @@ private function renderShowString(array $hidden) {
}
}
- return 'Show Full Unit Results ('.implode(', ', $show).')';
+ return pht(
+ 'Show Full Unit Results (%s)',
+ implode(', ', $show));
}
public function getWarningsForDetailView() {
diff --git a/src/applications/differential/editor/DifferentialTransactionEditor.php b/src/applications/differential/editor/DifferentialTransactionEditor.php
index 0a02dec209..6a43f35d5a 100644
--- a/src/applications/differential/editor/DifferentialTransactionEditor.php
+++ b/src/applications/differential/editor/DifferentialTransactionEditor.php
@@ -908,8 +908,7 @@ private function validateDifferentialAction(
case DifferentialAction::ACTION_REJECT:
if ($actor_is_author) {
- return pht(
- 'You can not request changes to your own revision.');
+ return pht('You can not request changes to your own revision.');
}
if ($revision_status == $status_abandoned) {
@@ -1484,13 +1483,14 @@ private function renderInlineCommentsForMail(
$nested_comments = $this->nestCommentHistory(
$inline->getComment(), $comments_by_line_number, $authors_by_phid);
- $section->addFragment('================')
- ->addFragment('Comment at: '.$file.':'.$range)
- ->addPlaintextFragment($patch)
- ->addHTMLFragment($this->renderPatchHTMLForMail($patch))
- ->addFragment('----------------')
- ->addFragment($nested_comments)
- ->addFragment(null);
+ $section
+ ->addFragment('================')
+ ->addFragment(pht('Comment at: %s:%s', $file, $range))
+ ->addPlaintextFragment($patch)
+ ->addHTMLFragment($this->renderPatchHTMLForMail($patch))
+ ->addFragment('----------------')
+ ->addFragment($nested_comments)
+ ->addFragment(null);
}
}
}
@@ -1569,8 +1569,7 @@ protected function buildHeraldAdapter(
->executeOne();
if (!$revision) {
throw new Exception(
- pht(
- 'Failed to load revision for Herald adapter construction!'));
+ pht('Failed to load revision for Herald adapter construction!'));
}
$adapter = HeraldDifferentialRevisionAdapter::newLegacyAdapter(
diff --git a/src/applications/differential/landing/DifferentialGitHubLandingStrategy.php b/src/applications/differential/landing/DifferentialGitHubLandingStrategy.php
index 7160743bb9..b4ff727cbe 100644
--- a/src/applications/differential/landing/DifferentialGitHubLandingStrategy.php
+++ b/src/applications/differential/landing/DifferentialGitHubLandingStrategy.php
@@ -20,7 +20,7 @@ public function processLandRequest(
id(new DifferentialHostedGitLandingStrategy())
->commitRevisionToWorkspace($revision, $workspace, $viewer);
} catch (Exception $e) {
- throw new PhutilProxyException('Failed to commit patch', $e);
+ throw new PhutilProxyException(pht('Failed to commit patch.'), $e);
}
try {
@@ -33,7 +33,9 @@ public function processLandRequest(
}
// Else, throw what git said.
- throw new PhutilProxyException('Failed to push changes upstream', $e);
+ throw new PhutilProxyException(
+ pht('Failed to push changes upstream.'),
+ $e);
}
}
@@ -45,6 +47,11 @@ public function createMenuItem(
DifferentialRevision $revision,
PhabricatorRepository $repository) {
+ // TODO: This temporarily disables this action, because it doesn't work
+ // and is confusing to users. If you want to use it, comment out this line
+ // for now and we'll provide real support eventually.
+ return;
+
$vcs = $repository->getVersionControlSystem();
if ($vcs !== PhabricatorRepositoryType::REPOSITORY_TYPE_GIT) {
return;
@@ -103,13 +110,14 @@ private function init($viewer, $repository) {
if (!$this->account) {
throw new Exception(
- "No matching GitHub account found for {$repo_domain}.");
+ pht('No matching GitHub account found for %s.', $repo_domain));
}
$this->provider = PhabricatorAuthProvider::getEnabledProviderByKey(
$this->account->getProviderKey());
if (!$this->provider) {
- throw new Exception("GitHub provider for {$repo_domain} is not enabled.");
+ throw new Exception(
+ pht('GitHub provider for %s is not enabled.', $repo_domain));
}
}
@@ -152,8 +160,9 @@ private function verifyRemotePermissions($viewer, $revision, $repository) {
if ($no_permission) {
throw new Exception(
- "You don't have permission to push to this repository. \n".
- "Push permissions for this repository are managed on GitHub.");
+ pht(
+ "You don't have permission to push to this repository. ".
+ "Push permissions for this repository are managed on GitHub."));
}
$scopes = BaseHTTPFuture::getHeader($headers, 'X-OAuth-Scopes');
@@ -166,8 +175,8 @@ private function verifyRemotePermissions($viewer, $revision, $repository) {
->setUser($viewer)
->setTitle(pht('Stronger token needed'))
->appendChild(pht(
- 'In order to complete this action, you need a '.
- 'stronger GitHub token.'))
+ 'In order to complete this action, you need a '.
+ 'stronger GitHub token.'))
->setSubmitURI($refresh_token_uri)
->addCancelButton('/D'.$revision->getId())
->setDisableWorkflowOnSubmit(true)
diff --git a/src/applications/differential/landing/DifferentialHostedGitLandingStrategy.php b/src/applications/differential/landing/DifferentialHostedGitLandingStrategy.php
index 68f0980db1..cc0cf97998 100644
--- a/src/applications/differential/landing/DifferentialHostedGitLandingStrategy.php
+++ b/src/applications/differential/landing/DifferentialHostedGitLandingStrategy.php
@@ -14,13 +14,17 @@ public function processLandRequest(
try {
$this->commitRevisionToWorkspace($revision, $workspace, $viewer);
} catch (Exception $e) {
- throw new PhutilProxyException('Failed to commit patch', $e);
+ throw new PhutilProxyException(
+ pht('Failed to commit patch.'),
+ $e);
}
try {
$this->pushWorkspaceRepository($repository, $workspace, $viewer);
} catch (Exception $e) {
- throw new PhutilProxyException('Failed to push changes upstream', $e);
+ throw new PhutilProxyException(
+ pht('Failed to push changes upstream.'),
+ $e);
}
}
@@ -45,7 +49,7 @@ public function commitRevisionToWorkspace(
."0000000000000000000000000000000000000000.."
."0000000000000000000000000000000000000000\n";
if (strpos($raw_diff, $missing_binary) !== false) {
- throw new Exception('Patch is missing content for a binary file');
+ throw new Exception(pht('Patch is missing content for a binary file'));
}
$future = $workspace->execFutureLocal('apply --index -');
diff --git a/src/applications/differential/landing/DifferentialHostedMercurialLandingStrategy.php b/src/applications/differential/landing/DifferentialHostedMercurialLandingStrategy.php
index 0303be62af..38f7160958 100644
--- a/src/applications/differential/landing/DifferentialHostedMercurialLandingStrategy.php
+++ b/src/applications/differential/landing/DifferentialHostedMercurialLandingStrategy.php
@@ -15,13 +15,15 @@ public function processLandRequest(
try {
$this->commitRevisionToWorkspace($revision, $workspace, $viewer);
} catch (Exception $e) {
- throw new PhutilProxyException('Failed to commit patch', $e);
+ throw new PhutilProxyException(pht('Failed to commit patch.'), $e);
}
try {
$this->pushWorkspaceRepository($repository, $workspace, $viewer);
} catch (Exception $e) {
- throw new PhutilProxyException('Failed to push changes upstream', $e);
+ throw new PhutilProxyException(
+ pht('Failed to push changes upstream.'),
+ $e);
}
}
diff --git a/src/applications/differential/landing/DifferentialLandingStrategy.php b/src/applications/differential/landing/DifferentialLandingStrategy.php
index c62ca2ce23..d404511ed3 100644
--- a/src/applications/differential/landing/DifferentialLandingStrategy.php
+++ b/src/applications/differential/landing/DifferentialLandingStrategy.php
@@ -64,7 +64,9 @@ protected function getGitWorkspace(PhabricatorRepository $repository) {
try {
return DifferentialGetWorkingCopy::getCleanGitWorkspace($repository);
} catch (Exception $e) {
- throw new PhutilProxyException('Failed to allocate a workspace', $e);
+ throw new PhutilProxyException(
+ pht('Failed to allocate a workspace.'),
+ $e);
}
}
@@ -76,7 +78,9 @@ protected function getMercurialWorkspace(PhabricatorRepository $repository) {
return DifferentialGetWorkingCopy::getCleanMercurialWorkspace(
$repository);
} catch (Exception $e) {
- throw new PhutilProxyException('Failed to allocate a workspace', $e);
+ throw new PhutilProxyException(
+ pht('Failed to allocate a workspace.'),
+ $e);
}
}
diff --git a/src/applications/differential/lipsum/PhabricatorDifferentialRevisionTestDataGenerator.php b/src/applications/differential/lipsum/PhabricatorDifferentialRevisionTestDataGenerator.php
index db34f18418..ec346f26ae 100644
--- a/src/applications/differential/lipsum/PhabricatorDifferentialRevisionTestDataGenerator.php
+++ b/src/applications/differential/lipsum/PhabricatorDifferentialRevisionTestDataGenerator.php
@@ -53,10 +53,10 @@ public function generateDiff($author) {
$diff = id(new PhabricatorDifferenceEngine())
->generateRawDiffFromFileContent($code, $newcode);
$call = new ConduitCall(
- 'differential.createrawdiff',
- array(
- 'diff' => $diff,
- ));
+ 'differential.createrawdiff',
+ array(
+ 'diff' => $diff,
+ ));
$call->setUser($author);
$result = $call->execute();
$thediff = id(new DifferentialDiff())->load(
diff --git a/src/applications/differential/mail/DifferentialCreateMailReceiver.php b/src/applications/differential/mail/DifferentialCreateMailReceiver.php
index d54faffc40..c3198d3642 100644
--- a/src/applications/differential/mail/DifferentialCreateMailReceiver.php
+++ b/src/applications/differential/mail/DifferentialCreateMailReceiver.php
@@ -3,8 +3,8 @@
final class DifferentialCreateMailReceiver extends PhabricatorMailReceiver {
public function isEnabled() {
- $app_class = 'PhabricatorDifferentialApplication';
- return PhabricatorApplication::isClassInstalled($app_class);
+ return PhabricatorApplication::isClassInstalled(
+ 'PhabricatorDifferentialApplication');
}
public function canAcceptMail(PhabricatorMetaMTAReceivedMail $mail) {
diff --git a/src/applications/differential/mail/DifferentialReplyHandler.php b/src/applications/differential/mail/DifferentialReplyHandler.php
index 660fe7e034..b2d8d05665 100644
--- a/src/applications/differential/mail/DifferentialReplyHandler.php
+++ b/src/applications/differential/mail/DifferentialReplyHandler.php
@@ -5,7 +5,7 @@ final class DifferentialReplyHandler
public function validateMailReceiver($mail_receiver) {
if (!($mail_receiver instanceof DifferentialRevision)) {
- throw new Exception('Receiver is not a DifferentialRevision!');
+ throw new Exception(pht('Receiver is not a %s!', 'DifferentialRevision'));
}
}
diff --git a/src/applications/differential/mail/DifferentialRevisionMailReceiver.php b/src/applications/differential/mail/DifferentialRevisionMailReceiver.php
index b211a89ea9..6b27c5a371 100644
--- a/src/applications/differential/mail/DifferentialRevisionMailReceiver.php
+++ b/src/applications/differential/mail/DifferentialRevisionMailReceiver.php
@@ -4,8 +4,8 @@ final class DifferentialRevisionMailReceiver
extends PhabricatorObjectMailReceiver {
public function isEnabled() {
- $app_class = 'PhabricatorDifferentialApplication';
- return PhabricatorApplication::isClassInstalled($app_class);
+ return PhabricatorApplication::isClassInstalled(
+ 'PhabricatorDifferentialApplication');
}
protected function getObjectPattern() {
diff --git a/src/applications/differential/parser/DifferentialChangesetParser.php b/src/applications/differential/parser/DifferentialChangesetParser.php
index 82c0a47519..a34fe85064 100644
--- a/src/applications/differential/parser/DifferentialChangesetParser.php
+++ b/src/applications/differential/parser/DifferentialChangesetParser.php
@@ -906,11 +906,10 @@ public function render(
$shield = $renderer->renderShield(
pht('This file was completely deleted.'));
} else if ($this->changeset->getAffectedLineCount() > 2500) {
- $lines = number_format($this->changeset->getAffectedLineCount());
$shield = $renderer->renderShield(
pht(
'This file has a very large number of changes (%s lines).',
- $lines));
+ new PhutilNumber($this->changeset->getAffectedLineCount())));
}
}
@@ -1154,10 +1153,11 @@ public function render(
*
* @return array($gaps, $mask, $depths)
*/
- private function calculateGapsMaskAndDepths($mask_force,
- $feedback_mask,
- $range_start,
- $range_len) {
+ private function calculateGapsMaskAndDepths(
+ $mask_force,
+ $feedback_mask,
+ $range_start,
+ $range_len) {
// Calculate gaps and mask first
$gaps = array();
@@ -1263,7 +1263,7 @@ private function isCommentOnRightSideWhenDisplayed(
PhabricatorInlineCommentInterface $comment) {
if (!$this->isCommentVisibleOnRenderedDiff($comment)) {
- throw new Exception('Comment is not visible on changeset!');
+ throw new Exception(pht('Comment is not visible on changeset!'));
}
$changeset_id = $comment->getChangesetID();
diff --git a/src/applications/differential/parser/DifferentialCommitMessageParser.php b/src/applications/differential/parser/DifferentialCommitMessageParser.php
index 5e3c14aa34..00d2fe2c3f 100644
--- a/src/applications/differential/parser/DifferentialCommitMessageParser.php
+++ b/src/applications/differential/parser/DifferentialCommitMessageParser.php
@@ -73,8 +73,10 @@ public function parseCorpus($corpus) {
if (!$key_title || !$key_summary || ($label_map === null)) {
throw new Exception(
pht(
- 'Expected labelMap, summaryKey and titleKey to be set before '.
- 'parsing a corpus.'));
+ 'Expected %s, %s and %s to be set before parsing a corpus.',
+ 'labelMap',
+ 'summaryKey',
+ 'titleKey'));
}
$label_regexp = $this->buildLabelRegexp($label_map);
diff --git a/src/applications/differential/parser/DifferentialHunkParser.php b/src/applications/differential/parser/DifferentialHunkParser.php
index e381ca8346..d49f4e1e26 100644
--- a/src/applications/differential/parser/DifferentialHunkParser.php
+++ b/src/applications/differential/parser/DifferentialHunkParser.php
@@ -35,9 +35,7 @@ private function setVisibleLinesMask($mask) {
}
public function getVisibleLinesMask() {
if ($this->visibleLinesMask === null) {
- throw new Exception(
- 'You must generateVisibileLinesMask before accessing this data.'
- );
+ throw new PhutilInvalidStateException('generateVisibileLinesMask');
}
return $this->visibleLinesMask;
}
@@ -48,9 +46,7 @@ private function setIntraLineDiffs($intra_line_diffs) {
}
public function getIntraLineDiffs() {
if ($this->intraLineDiffs === null) {
- throw new Exception(
- 'You must generateIntraLineDiffs before accessing this data.'
- );
+ throw new PhutilInvalidStateException('generateIntraLineDiffs');
}
return $this->intraLineDiffs;
}
@@ -61,9 +57,7 @@ private function setNewLines($new_lines) {
}
public function getNewLines() {
if ($this->newLines === null) {
- throw new Exception(
- 'You must parseHunksForLineData before accessing this data.'
- );
+ throw new PhutilInvalidStateException('parseHunksForLineData');
}
return $this->newLines;
}
@@ -74,9 +68,7 @@ private function setOldLines($old_lines) {
}
public function getOldLines() {
if ($this->oldLines === null) {
- throw new Exception(
- 'You must parseHunksForLineData before accessing this data.'
- );
+ throw new PhutilInvalidStateException('parseHunksForLineData');
}
return $this->oldLines;
}
@@ -132,8 +124,9 @@ public function setWhitespaceMode($white_space_mode) {
private function getWhitespaceMode() {
if ($this->whitespaceMode === null) {
throw new Exception(
- 'You must setWhitespaceMode before accessing this data.'
- );
+ pht(
+ 'You must %s before accessing this data.',
+ 'setWhitespaceMode'));
}
return $this->whitespaceMode;
}
@@ -173,7 +166,7 @@ public function getHasAnyChanges() {
private function getHasChanges($filter) {
if ($filter !== 'any' && $filter !== 'text') {
- throw new Exception("Unknown change filter '{$filter}'.");
+ throw new Exception(pht("Unknown change filter '%s'.", $filter));
}
$old = $this->getOldLines();
diff --git a/src/applications/differential/parser/__tests__/DifferentialCommitMessageParserTestCase.php b/src/applications/differential/parser/__tests__/DifferentialCommitMessageParserTestCase.php
index 8396237bc5..669cfed220 100644
--- a/src/applications/differential/parser/__tests__/DifferentialCommitMessageParserTestCase.php
+++ b/src/applications/differential/parser/__tests__/DifferentialCommitMessageParserTestCase.php
@@ -18,8 +18,9 @@ public function testDifferentialCommitMessageParser() {
throw new Exception(
pht(
'Expected test file "%s" to contain four parts (message, fields, '.
- 'output, errors) divided by "~~~~~~~~~~".',
- $file));
+ 'output, errors) divided by "%s".',
+ $file,
+ '~~~~~~~~~~'));
}
list($message, $fields, $output, $errors) = $parts;
diff --git a/src/applications/differential/parser/__tests__/DifferentialHunkParserTestCase.php b/src/applications/differential/parser/__tests__/DifferentialHunkParserTestCase.php
index 45c7ac9225..d1d2501b94 100644
--- a/src/applications/differential/parser/__tests__/DifferentialHunkParserTestCase.php
+++ b/src/applications/differential/parser/__tests__/DifferentialHunkParserTestCase.php
@@ -37,7 +37,7 @@ private function createHunksFromFile($name) {
$parser = new ArcanistDiffParser();
$changes = $parser->parseDiff($data);
if (count($changes) !== 1) {
- throw new Exception("Expected 1 changeset for '{$name}'!");
+ throw new Exception(pht("Expected 1 changeset for '%s'!", $name));
}
$diff = DifferentialDiff::newFromRawChanges(
@@ -113,10 +113,10 @@ public function testOverlapAfterEndOfHunk() {
public function testInclusionOfNewFileInOldCommentFromStart() {
$parser = new DifferentialHunkParser();
$hunks = $this->createSingleChange(2, 3,
- "+n1\n".
- " e1/2\n".
- "-o2\n".
- "+n3\n");
+ "+n1\n".
+ " e1/2\n".
+ "-o2\n".
+ "+n3\n");
$context = $parser->makeContextDiff(
$hunks,
0,
@@ -124,18 +124,18 @@ public function testInclusionOfNewFileInOldCommentFromStart() {
1,
0);
$this->assertEqual(
- "@@ -1,2 +2,1 @@\n".
- " e1/2\n".
- "-o2", $context);
+ "@@ -1,2 +2,1 @@\n".
+ " e1/2\n".
+ "-o2", $context);
}
public function testInclusionOfOldFileInNewCommentFromStart() {
$parser = new DifferentialHunkParser();
$hunks = $this->createSingleChange(2, 2,
- "-o1\n".
- " e2/1\n".
- "-o3\n".
- "+n2\n");
+ "-o1\n".
+ " e2/1\n".
+ "-o3\n".
+ "+n2\n");
$context = $parser->makeContextDiff(
$hunks,
1,
@@ -143,16 +143,16 @@ public function testInclusionOfOldFileInNewCommentFromStart() {
1,
0);
$this->assertEqual(
- "@@ -2,1 +1,2 @@\n".
- " e2/1\n".
- "+n2", $context);
+ "@@ -2,1 +1,2 @@\n".
+ " e2/1\n".
+ "+n2", $context);
}
public function testNoNewlineAtEndOfFile() {
$parser = new DifferentialHunkParser();
$hunks = $this->createSingleChange(0, 1,
- "+a\n".
- "\\No newline at end of file");
+ "+a\n".
+ "\\No newline at end of file");
// Note that this only works with additional context.
$context = $parser->makeContextDiff(
$hunks,
@@ -161,23 +161,23 @@ public function testNoNewlineAtEndOfFile() {
0,
1);
$this->assertEqual(
- "@@ +1,1 @@\n".
- "+a\n".
- "\\No newline at end of file", $context);
+ "@@ +1,1 @@\n".
+ "+a\n".
+ "\\No newline at end of file", $context);
}
public function testMultiLineNewComment() {
$parser = new DifferentialHunkParser();
$hunks = $this->createSingleChange(7, 7,
- " e1\n".
- " e2\n".
- "-o3\n".
- "-o4\n".
- "+n3\n".
- " e5/4\n".
- " e6/5\n".
- "+n6\n".
- " e7\n");
+ " e1\n".
+ " e2\n".
+ "-o3\n".
+ "-o4\n".
+ "+n3\n".
+ " e5/4\n".
+ " e6/5\n".
+ "+n6\n".
+ " e7\n");
$context = $parser->makeContextDiff(
$hunks,
1,
@@ -185,28 +185,28 @@ public function testMultiLineNewComment() {
4,
0);
$this->assertEqual(
- "@@ -2,5 +2,5 @@\n".
- " e2\n".
- "-o3\n".
- "-o4\n".
- "+n3\n".
- " e5/4\n".
- " e6/5\n".
- "+n6", $context);
+ "@@ -2,5 +2,5 @@\n".
+ " e2\n".
+ "-o3\n".
+ "-o4\n".
+ "+n3\n".
+ " e5/4\n".
+ " e6/5\n".
+ "+n6", $context);
}
public function testMultiLineOldComment() {
$parser = new DifferentialHunkParser();
$hunks = $this->createSingleChange(7, 7,
- " e1\n".
- " e2\n".
- "-o3\n".
- "-o4\n".
- "+n3\n".
- " e5/4\n".
- " e6/5\n".
- "+n6\n".
- " e7\n");
+ " e1\n".
+ " e2\n".
+ "-o3\n".
+ "-o4\n".
+ "+n3\n".
+ " e5/4\n".
+ " e6/5\n".
+ "+n6\n".
+ " e7\n");
$context = $parser->makeContextDiff(
$hunks,
0,
@@ -214,22 +214,22 @@ public function testMultiLineOldComment() {
4,
0);
$this->assertEqual(
- "@@ -2,5 +2,4 @@\n".
- " e2\n".
- "-o3\n".
- "-o4\n".
- "+n3\n".
- " e5/4\n".
- " e6/5", $context);
+ "@@ -2,5 +2,4 @@\n".
+ " e2\n".
+ "-o3\n".
+ "-o4\n".
+ "+n3\n".
+ " e5/4\n".
+ " e6/5", $context);
}
public function testInclusionOfNewFileInOldCommentFromStartWithContext() {
$parser = new DifferentialHunkParser();
$hunks = $this->createSingleChange(2, 3,
- "+n1\n".
- " e1/2\n".
- "-o2\n".
- "+n3\n");
+ "+n1\n".
+ " e1/2\n".
+ "-o2\n".
+ "+n3\n");
$context = $parser->makeContextDiff(
$hunks,
0,
@@ -237,19 +237,19 @@ public function testInclusionOfNewFileInOldCommentFromStartWithContext() {
1,
1);
$this->assertEqual(
- "@@ -1,2 +1,2 @@\n".
- "+n1\n".
- " e1/2\n".
- "-o2", $context);
+ "@@ -1,2 +1,2 @@\n".
+ "+n1\n".
+ " e1/2\n".
+ "-o2", $context);
}
public function testInclusionOfOldFileInNewCommentFromStartWithContext() {
$parser = new DifferentialHunkParser();
$hunks = $this->createSingleChange(2, 2,
- "-o1\n".
- " e2/1\n".
- "-o3\n".
- "+n2\n");
+ "-o1\n".
+ " e2/1\n".
+ "-o3\n".
+ "+n2\n");
$context = $parser->makeContextDiff(
$hunks,
1,
@@ -257,11 +257,11 @@ public function testInclusionOfOldFileInNewCommentFromStartWithContext() {
1,
1);
$this->assertEqual(
- "@@ -1,3 +1,2 @@\n".
- "-o1\n".
- " e2/1\n".
- "-o3\n".
- "+n2", $context);
+ "@@ -1,3 +1,2 @@\n".
+ "-o1\n".
+ " e2/1\n".
+ "-o3\n".
+ "+n2", $context);
}
public function testMissingContext() {
diff --git a/src/applications/differential/query/DifferentialHunkQuery.php b/src/applications/differential/query/DifferentialHunkQuery.php
index 3c9f898810..09beb0b6f7 100644
--- a/src/applications/differential/query/DifferentialHunkQuery.php
+++ b/src/applications/differential/query/DifferentialHunkQuery.php
@@ -95,7 +95,9 @@ protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
if (!$this->changesets) {
throw new Exception(
- pht('You must load hunks via changesets, with withChangesets()!'));
+ pht(
+ 'You must load hunks via changesets, with %s!',
+ 'withChangesets()'));
}
$where[] = qsprintf(
diff --git a/src/applications/differential/query/DifferentialInlineCommentQuery.php b/src/applications/differential/query/DifferentialInlineCommentQuery.php
index 3fb26739c0..7e986bdc60 100644
--- a/src/applications/differential/query/DifferentialInlineCommentQuery.php
+++ b/src/applications/differential/query/DifferentialInlineCommentQuery.php
@@ -15,6 +15,7 @@ final class DifferentialInlineCommentQuery
private $authorPHIDs;
private $revisionPHIDs;
private $deletedDrafts;
+ private $needHidden;
public function setViewer(PhabricatorUser $viewer) {
$this->viewer = $viewer;
@@ -55,6 +56,11 @@ public function withDeletedDrafts($deleted_drafts) {
return $this;
}
+ public function needHidden($need) {
+ $this->needHidden = $need;
+ return $this;
+ }
+
public function execute() {
$table = new DifferentialTransactionComment();
$conn_r = $table->establishConnection('r');
@@ -68,6 +74,26 @@ public function execute() {
$comments = $table->loadAllFromArray($data);
+ if ($this->needHidden) {
+ $viewer_phid = $this->getViewer()->getPHID();
+ if ($viewer_phid && $comments) {
+ $hidden = queryfx_all(
+ $conn_r,
+ 'SELECT commentID FROM %T WHERE userPHID = %s
+ AND commentID IN (%Ls)',
+ id(new DifferentialHiddenComment())->getTableName(),
+ $viewer_phid,
+ mpull($comments, 'getID'));
+ $hidden = array_fuse(ipull($hidden, 'commentID'));
+ } else {
+ $hidden = array();
+ }
+
+ foreach ($comments as $inline) {
+ $inline->attachIsHidden(isset($hidden[$inline->getID()]));
+ }
+ }
+
foreach ($comments as $key => $value) {
$comments[$key] = DifferentialInlineComment::newFromModernComment(
$value);
diff --git a/src/applications/differential/query/DifferentialRevisionQuery.php b/src/applications/differential/query/DifferentialRevisionQuery.php
index d49ef34887..69e9477e0d 100644
--- a/src/applications/differential/query/DifferentialRevisionQuery.php
+++ b/src/applications/differential/query/DifferentialRevisionQuery.php
@@ -820,7 +820,7 @@ protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
break;
default:
throw new Exception(
- "Unknown revision status filter constant '{$this->status}'!");
+ pht("Unknown revision status filter constant '%s'!", $this->status));
}
$where[] = $this->buildWhereClauseParts($conn_r);
@@ -1035,7 +1035,7 @@ private function loadReviewers(
// The author can never have authority unless we allow self-accept.
$has_authority = false;
} else {
- // Otherwise, look up whether th viewer has authority.
+ // Otherwise, look up whether the viewer has authority.
$has_authority = isset($authority[$reviewer_phid]);
}
diff --git a/src/applications/differential/render/DifferentialChangesetHTMLRenderer.php b/src/applications/differential/render/DifferentialChangesetHTMLRenderer.php
index ce1a35f365..30acc71c88 100644
--- a/src/applications/differential/render/DifferentialChangesetHTMLRenderer.php
+++ b/src/applications/differential/render/DifferentialChangesetHTMLRenderer.php
@@ -265,8 +265,7 @@ protected function renderUndershieldHeader() {
'This file was converted from %s for display.',
phutil_tag('strong', array(), $encoding));
} else {
- $messages[] = pht(
- 'This file uses an unknown character encoding.');
+ $messages[] = pht('This file uses an unknown character encoding.');
}
}
}
@@ -371,7 +370,11 @@ public function renderShield($message, $force = 'default') {
$force !== 'whitespace' &&
$force !== 'none' &&
$force !== 'default') {
- throw new Exception("Invalid 'force' parameter '{$force}'!");
+ throw new Exception(
+ pht(
+ "Invalid '%s' parameter '%s'!",
+ 'force',
+ $force));
}
$range = "0-{$end}";
@@ -516,7 +519,7 @@ protected function renderShowContextLinks($top, $len, $changeset_length) {
if ($is_last_block) {
$text = pht('Show Last %d Line(s)', $block_size);
} else {
- $text = pht("\xE2\x96\xBC Show %d Line(s)", $block_size);
+ $text = "\xE2\x96\xBC ".pht('Show %d Line(s)', $block_size);
}
$links[] = $this->renderShowContextLink(
diff --git a/src/applications/differential/render/DifferentialChangesetOneUpRenderer.php b/src/applications/differential/render/DifferentialChangesetOneUpRenderer.php
index 2634d037d7..dfc990d4d4 100644
--- a/src/applications/differential/render/DifferentialChangesetOneUpRenderer.php
+++ b/src/applications/differential/render/DifferentialChangesetOneUpRenderer.php
@@ -41,8 +41,10 @@ protected function renderPrimitives(array $primitives, $rows) {
$column_width = 4;
+ $hidden = new PHUIDiffRevealIconView();
+
$out = array();
- foreach ($primitives as $p) {
+ foreach ($primitives as $k => $p) {
$type = $p['type'];
switch ($type) {
case 'old':
@@ -51,6 +53,27 @@ protected function renderPrimitives(array $primitives, $rows) {
case 'new-file':
$is_old = ($type == 'old' || $type == 'old-file');
+ $o_hidden = array();
+ $n_hidden = array();
+
+ for ($look = $k + 1; isset($primitives[$look]); $look++) {
+ $next = $primitives[$look];
+ switch ($next['type']) {
+ case 'inline':
+ $comment = $next['comment'];
+ if ($comment->isHidden()) {
+ if ($next['right']) {
+ $n_hidden[] = $comment;
+ } else {
+ $o_hidden[] = $comment;
+ }
+ }
+ break;
+ default:
+ break 2;
+ }
+ }
+
$cells = array();
if ($is_old) {
if ($p['htype']) {
@@ -68,7 +91,13 @@ protected function renderPrimitives(array $primitives, $rows) {
} else {
$left_id = null;
}
- $cells[] = phutil_tag('th', array('id' => $left_id), $p['line']);
+
+ $line = $p['line'];
+ if ($o_hidden) {
+ $line = array($hidden, $line);
+ }
+
+ $cells[] = phutil_tag('th', array('id' => $left_id), $line);
$cells[] = phutil_tag('th', array());
$cells[] = $no_copy;
@@ -85,7 +114,13 @@ protected function renderPrimitives(array $primitives, $rows) {
} else {
$left_id = null;
}
- $cells[] = phutil_tag('th', array('id' => $left_id), $p['oline']);
+
+ $oline = $p['oline'];
+ if ($o_hidden) {
+ $oline = array($hidden, $oline);
+ }
+
+ $cells[] = phutil_tag('th', array('id' => $left_id), $oline);
}
if ($type == 'new-file') {
@@ -97,8 +132,13 @@ protected function renderPrimitives(array $primitives, $rows) {
} else {
$right_id = null;
}
- $cells[] = phutil_tag('th', array('id' => $right_id), $p['line']);
+ $line = $p['line'];
+ if ($n_hidden) {
+ $line = array($hidden, $line);
+ }
+
+ $cells[] = phutil_tag('th', array('id' => $right_id), $line);
$cells[] = $no_copy;
$cells[] = phutil_tag('td', array('class' => $class), $p['render']);
diff --git a/src/applications/differential/render/DifferentialChangesetRenderer.php b/src/applications/differential/render/DifferentialChangesetRenderer.php
index 22255ece7e..461ce668bb 100644
--- a/src/applications/differential/render/DifferentialChangesetRenderer.php
+++ b/src/applications/differential/render/DifferentialChangesetRenderer.php
@@ -599,7 +599,7 @@ private function processPrimitivesForOneUp(array $primitives) {
}
} else {
- throw new Exception("Unknown primitive type '{$primitive}'!");
+ throw new Exception(pht("Unknown primitive type '%s'!", $primitive));
}
}
diff --git a/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php b/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php
index 3eb0190664..16752b9402 100644
--- a/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php
+++ b/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php
@@ -69,6 +69,8 @@ public function renderTextChange(
$depths = $this->getDepths();
$mask = $this->getMask();
+ $hidden = new PHUIDiffRevealIconView();
+
for ($ii = $range_start; $ii < $range_start + $range_len; $ii++) {
if (empty($mask[$ii])) {
// If we aren't going to show this line, we've just entered a gap.
@@ -235,32 +237,12 @@ public function renderTextChange(
$n_id = null;
}
- // NOTE: This is a unicode zero-width space, which we use as a hint when
- // intercepting 'copy' events to make sure sensible text ends up on the
- // clipboard. See the 'phabricator-oncopy' behavior.
- $zero_space = "\xE2\x80\x8B";
-
- $html[] = phutil_tag('tr', array(), array(
- phutil_tag('th', array('id' => $o_id), $o_num),
- phutil_tag('td', array('class' => $o_classes), $o_text),
- phutil_tag('th', array('id' => $n_id), $n_num),
- $n_copy,
- phutil_tag(
- 'td',
- array('class' => $n_classes, 'colspan' => $n_colspan),
- array(
- phutil_tag('span', array('class' => 'zwsp'), $zero_space),
- $n_text,
- )),
- $n_cov,
- ));
-
- if ($context_not_available && ($ii == $rows - 1)) {
- $html[] = $context_not_available;
- }
-
$old_comments = $this->getOldComments();
$new_comments = $this->getNewComments();
+ $scaffolds = array();
+
+ $o_hidden = array();
+ $n_hidden = array();
if ($o_num && isset($old_comments[$o_num])) {
foreach ($old_comments[$o_num] as $comment) {
@@ -269,6 +251,10 @@ public function renderTextChange(
$on_right = false);
$scaffold = $this->getRowScaffoldForInline($inline);
+ if ($comment->isHidden()) {
+ $o_hidden[] = $comment;
+ }
+
if ($n_num && isset($new_comments[$n_num])) {
foreach ($new_comments[$n_num] as $key => $new_comment) {
if ($comment->isCompatible($new_comment)) {
@@ -276,6 +262,10 @@ public function renderTextChange(
$new_comment,
$on_right = true);
+ if ($new_comment->isHidden()) {
+ $n_hidden = $new_comment;
+ }
+
$scaffold->addInlineView($companion);
unset($new_comments[$n_num][$key]);
break;
@@ -283,26 +273,71 @@ public function renderTextChange(
}
}
- $html[] = $scaffold;
+
+ $scaffolds[] = $scaffold;
}
}
+
if ($n_num && isset($new_comments[$n_num])) {
foreach ($new_comments[$n_num] as $comment) {
$inline = $this->buildInlineComment(
$comment,
$on_right = true);
- $html[] = $this->getRowScaffoldForInline($inline);
+
+ if ($comment->isHidden()) {
+ $n_hidden[] = $comment;
+ }
+
+ $scaffolds[] = $this->getRowScaffoldForInline($inline);
}
}
+
+ if ($o_hidden) {
+ $o_num = array($hidden, $o_num);
+ }
+
+ if ($n_hidden) {
+ $n_num = array($hidden, $n_num);
+ }
+
+ // NOTE: This is a unicode zero-width space, which we use as a hint when
+ // intercepting 'copy' events to make sure sensible text ends up on the
+ // clipboard. See the 'phabricator-oncopy' behavior.
+ $zero_space = "\xE2\x80\x8B";
+
+ $html[] = phutil_tag('tr', array(), array(
+ phutil_tag('th', array('id' => $o_id), $o_num),
+ phutil_tag('td', array('class' => $o_classes), $o_text),
+ phutil_tag('th', array('id' => $n_id), $n_num),
+ $n_copy,
+ phutil_tag(
+ 'td',
+ array('class' => $n_classes, 'colspan' => $n_colspan),
+ array(
+ phutil_tag('span', array('class' => 'zwsp'), $zero_space),
+ $n_text,
+ )),
+ $n_cov,
+ ));
+
+ if ($context_not_available && ($ii == $rows - 1)) {
+ $html[] = $context_not_available;
+ }
+
+ foreach ($scaffolds as $scaffold) {
+ $html[] = $scaffold;
+ }
}
return $this->wrapChangeInTable(phutil_implode_html('', $html));
}
- public function renderFileChange($old_file = null,
- $new_file = null,
- $id = 0,
- $vs = 0) {
+ public function renderFileChange(
+ $old_file = null,
+ $new_file = null,
+ $id = 0,
+ $vs = 0) {
+
$old = null;
if ($old_file) {
$old = $this->renderImageStage($old_file);
diff --git a/src/applications/differential/search/DifferentialSearchIndexer.php b/src/applications/differential/search/DifferentialSearchIndexer.php
index 66a89a6fb9..9976503127 100644
--- a/src/applications/differential/search/DifferentialSearchIndexer.php
+++ b/src/applications/differential/search/DifferentialSearchIndexer.php
@@ -14,7 +14,7 @@ protected function loadDocumentByPHID($phid) {
->needReviewerStatus(true)
->executeOne();
if (!$object) {
- throw new Exception("Unable to load object by phid '{$phid}'!");
+ throw new Exception(pht("Unable to load object by PHID '%s'!", $phid));
}
return $object;
}
diff --git a/src/applications/differential/storage/DifferentialHiddenComment.php b/src/applications/differential/storage/DifferentialHiddenComment.php
new file mode 100644
index 0000000000..90dbb527f2
--- /dev/null
+++ b/src/applications/differential/storage/DifferentialHiddenComment.php
@@ -0,0 +1,24 @@
+ false,
+ self::CONFIG_KEY_SCHEMA => array(
+ 'key_user' => array(
+ 'columns' => array('userPHID', 'commentID'),
+ 'unique' => true,
+ ),
+ 'key_comment' => array(
+ 'columns' => array('commentID'),
+ ),
+ ),
+ ) + parent::getConfiguration();
+ }
+
+}
diff --git a/src/applications/differential/storage/DifferentialInlineComment.php b/src/applications/differential/storage/DifferentialInlineComment.php
index 65ea64773b..979220fc02 100644
--- a/src/applications/differential/storage/DifferentialInlineComment.php
+++ b/src/applications/differential/storage/DifferentialInlineComment.php
@@ -24,6 +24,7 @@ public function getTransactionCommentForSave() {
->setViewPolicy('public')
->setEditPolicy($this->getAuthorPHID())
->setContentSource($content_source)
+ ->attachIsHidden(false)
->setCommentVersion(1);
return $this->proxy;
@@ -49,6 +50,14 @@ public function delete() {
return $this;
}
+ public function supportsHiding() {
+ return true;
+ }
+
+ public function isHidden() {
+ return $this->proxy->getIsHidden();
+ }
+
public function getID() {
return $this->proxy->getID();
}
diff --git a/src/applications/differential/storage/DifferentialReviewer.php b/src/applications/differential/storage/DifferentialReviewer.php
index b5a339efbb..e3b1e0ac20 100644
--- a/src/applications/differential/storage/DifferentialReviewer.php
+++ b/src/applications/differential/storage/DifferentialReviewer.php
@@ -41,7 +41,7 @@ public function hasAuthority(PhabricatorUser $viewer) {
$viewer_phid = $viewer->getPHID();
if (!array_key_exists($viewer_phid, $this->authority)) {
- throw new Exception('You must attachAuthority() first!');
+ throw new Exception(pht('You must %s first!', 'attachAuthority()'));
}
return $this->authority[$viewer_phid];
}
diff --git a/src/applications/differential/storage/DifferentialRevision.php b/src/applications/differential/storage/DifferentialRevision.php
index e6baa678e9..0a4d459568 100644
--- a/src/applications/differential/storage/DifferentialRevision.php
+++ b/src/applications/differential/storage/DifferentialRevision.php
@@ -316,8 +316,7 @@ public function describeAutomaticCapability($capability) {
switch ($capability) {
case PhabricatorPolicyCapability::CAN_VIEW:
- $description[] = pht(
- "A revision's reviewers can always view it.");
+ $description[] = pht("A revision's reviewers can always view it.");
$description[] = pht(
'If a revision belongs to a repository, other users must be able '.
'to view the repository in order to view the revision.');
@@ -523,6 +522,7 @@ public function willRenderTimeline(
}
$query = id(new DifferentialInlineCommentQuery())
+ ->needHidden(true)
->setViewer($viewer);
// NOTE: This is a bit sketchy: this method adjusts the inlines as a
diff --git a/src/applications/differential/storage/DifferentialTransaction.php b/src/applications/differential/storage/DifferentialTransaction.php
index 2857d24272..23f6a45c2a 100644
--- a/src/applications/differential/storage/DifferentialTransaction.php
+++ b/src/applications/differential/storage/DifferentialTransaction.php
@@ -274,14 +274,11 @@ public function getTitle() {
case self::TYPE_STATUS:
switch ($this->getNewValue()) {
case ArcanistDifferentialRevisionStatus::ACCEPTED:
- return pht(
- 'This revision is now accepted and ready to land.');
+ return pht('This revision is now accepted and ready to land.');
case ArcanistDifferentialRevisionStatus::NEEDS_REVISION:
- return pht(
- 'This revision now requires changes to proceed.');
+ return pht('This revision now requires changes to proceed.');
case ArcanistDifferentialRevisionStatus::NEEDS_REVIEW:
- return pht(
- 'This revision now requires review to proceed.');
+ return pht('This revision now requires review to proceed.');
}
}
@@ -595,11 +592,9 @@ public function getNoEffectDescription() {
'You can not commandeer this revision because you already own '.
'it.');
case DifferentialAction::ACTION_ACCEPT:
- return pht(
- 'You have already accepted this revision.');
+ return pht('You have already accepted this revision.');
case DifferentialAction::ACTION_REJECT:
- return pht(
- 'You have already requested changes to this revision.');
+ return pht('You have already requested changes to this revision.');
}
break;
}
diff --git a/src/applications/differential/storage/DifferentialTransactionComment.php b/src/applications/differential/storage/DifferentialTransactionComment.php
index 0d1e6ea33a..5a9b031dad 100644
--- a/src/applications/differential/storage/DifferentialTransactionComment.php
+++ b/src/applications/differential/storage/DifferentialTransactionComment.php
@@ -13,6 +13,7 @@ final class DifferentialTransactionComment
protected $replyToCommentPHID;
private $replyToComment = self::ATTACHABLE;
+ private $isHidden = self::ATTACHABLE;
public function getApplicationTransactionObject() {
return new DifferentialTransaction();
@@ -99,4 +100,13 @@ public static function sortAndGroupInlines(
return $inline_groups;
}
+ public function getIsHidden() {
+ return $this->assertAttached($this->isHidden);
+ }
+
+ public function attachIsHidden($hidden) {
+ $this->isHidden = $hidden;
+ return $this;
+ }
+
}
diff --git a/src/applications/differential/view/DifferentialChangesetListView.php b/src/applications/differential/view/DifferentialChangesetListView.php
index 3e7bfb677c..0dd40f39c3 100644
--- a/src/applications/differential/view/DifferentialChangesetListView.php
+++ b/src/applications/differential/view/DifferentialChangesetListView.php
@@ -232,8 +232,9 @@ public function render() {
if ($this->inlineURI) {
Javelin::initBehavior('differential-edit-inline-comments', array(
- 'uri' => $this->inlineURI,
- 'stage' => 'differential-review-stage',
+ 'uri' => $this->inlineURI,
+ 'stage' => 'differential-review-stage',
+ 'revealIcon' => hsprintf('%s', new PHUIDiffRevealIconView()),
));
}
diff --git a/src/applications/differential/view/DifferentialDiffTableOfContentsView.php b/src/applications/differential/view/DifferentialDiffTableOfContentsView.php
index 94b9907ecb..953444a199 100644
--- a/src/applications/differential/view/DifferentialDiffTableOfContentsView.php
+++ b/src/applications/differential/view/DifferentialDiffTableOfContentsView.php
@@ -137,9 +137,9 @@ public function render() {
($changeset->getOldProperties() === $changeset->getNewProperties())
? ''
: phutil_tag(
- 'span',
- array('title' => pht('Properties Changed')),
- 'M');
+ 'span',
+ array('title' => pht('Properties Changed')),
+ 'M');
$fname = $changeset->getFilename();
$cov = $this->renderCoverage($coverage, $fname);
@@ -246,8 +246,8 @@ public function render() {
false,
));
$anchor = id(new PhabricatorAnchorView())
- ->setAnchorName('toc')
- ->setNavigationMarker(true);
+ ->setAnchorName('toc')
+ ->setNavigationMarker(true);
return id(new PHUIObjectBoxView())
->setHeaderText(pht('Table of Contents'))
diff --git a/src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php b/src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php
index 4f99c19c7d..6f8ee6db93 100644
--- a/src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php
+++ b/src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php
@@ -365,7 +365,7 @@ public static function getDiffLintMessage(DifferentialDiff $diff) {
case DifferentialLintStatus::LINT_POSTPONED:
return pht('Lint Postponed');
}
- return '???';
+ return pht('Unknown');
}
public static function getDiffUnitMessage(DifferentialDiff $diff) {
@@ -386,7 +386,7 @@ public static function getDiffUnitMessage(DifferentialDiff $diff) {
case DifferentialUnitStatus::UNIT_POSTPONED:
return pht('Unit Tests Postponed');
}
- return '???';
+ return pht('Unknown');
}
private static function renderDiffStar($star) {
diff --git a/src/applications/differential/view/DifferentialTransactionView.php b/src/applications/differential/view/DifferentialTransactionView.php
index 3312f717c7..ea0b2bb893 100644
--- a/src/applications/differential/view/DifferentialTransactionView.php
+++ b/src/applications/differential/view/DifferentialTransactionView.php
@@ -104,7 +104,7 @@ protected function renderTransactionContent(
$inlines[] = $xaction;
break;
default:
- throw new Exception('Unknown grouped transaction type!');
+ throw new Exception(pht('Unknown grouped transaction type!'));
}
}
diff --git a/src/applications/diffusion/DiffusionLintSaveRunner.php b/src/applications/diffusion/DiffusionLintSaveRunner.php
index 629c887924..7b652cf5f0 100644
--- a/src/applications/diffusion/DiffusionLintSaveRunner.php
+++ b/src/applications/diffusion/DiffusionLintSaveRunner.php
@@ -172,7 +172,7 @@ private function runArcLint(array $files) {
try {
$paths = phutil_json_decode($json);
} catch (PhutilJSONParserException $ex) {
- fprintf(STDERR, pht("Invalid JSON: %s\n", $json));
+ fprintf(STDERR, pht('Invalid JSON: %s', $json)."\n");
continue;
}
diff --git a/src/applications/diffusion/application/PhabricatorDiffusionApplication.php b/src/applications/diffusion/application/PhabricatorDiffusionApplication.php
index 14a3338f5e..0f44db3d13 100644
--- a/src/applications/diffusion/application/PhabricatorDiffusionApplication.php
+++ b/src/applications/diffusion/application/PhabricatorDiffusionApplication.php
@@ -101,6 +101,7 @@ public function getRoutes() {
'(?Pserve)/' => 'DiffusionRepositoryEditHostingController',
'update/' => 'DiffusionRepositoryEditUpdateController',
'symbol/' => 'DiffusionRepositorySymbolsController',
+ 'staging/' => 'DiffusionRepositoryEditStagingController',
),
'pathtree/(?P.*)' => 'DiffusionPathTreeController',
'mirror/' => array(
diff --git a/src/applications/diffusion/conduit/DiffusionBrowseQueryConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionBrowseQueryConduitAPIMethod.php
index f8854ac0f2..e2d3a941bf 100644
--- a/src/applications/diffusion/conduit/DiffusionBrowseQueryConduitAPIMethod.php
+++ b/src/applications/diffusion/conduit/DiffusionBrowseQueryConduitAPIMethod.php
@@ -8,9 +8,9 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return
+ return pht(
'File(s) information for a repository at an (optional) path and '.
- '(optional) commit.';
+ '(optional) commit.');
}
protected function defineReturnType() {
diff --git a/src/applications/diffusion/conduit/DiffusionCreateCommentConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionCreateCommentConduitAPIMethod.php
index 8d978e3f25..5543b759d0 100644
--- a/src/applications/diffusion/conduit/DiffusionCreateCommentConduitAPIMethod.php
+++ b/src/applications/diffusion/conduit/DiffusionCreateCommentConduitAPIMethod.php
@@ -12,9 +12,15 @@ public function getMethodStatus() {
}
public function getMethodDescription() {
- return 'Add a comment to a Diffusion commit. By specifying an action of '.
- '"concern", "accept", "resign", or "close", auditing actions can '.
- 'be triggered. Defaults to "comment".';
+ return pht(
+ 'Add a comment to a Diffusion commit. By specifying an action '.
+ 'of "%s", "%s", "%s", or "%s", auditing actions can '.
+ 'be triggered. Defaults to "%s".',
+ 'concern',
+ 'accept',
+ 'resign',
+ 'close',
+ 'comment');
}
protected function defineParamTypes() {
@@ -32,9 +38,9 @@ protected function defineReturnType() {
protected function defineErrorTypes() {
return array(
- 'ERR_BAD_COMMIT' => 'No commit found with that PHID',
- 'ERR_BAD_ACTION' => 'Invalid action type',
- 'ERR_MISSING_MESSAGE' => 'Message is required',
+ 'ERR_BAD_COMMIT' => pht('No commit found with that PHID.'),
+ 'ERR_BAD_ACTION' => pht('Invalid action type.'),
+ 'ERR_MISSING_MESSAGE' => pht('Message is required.'),
);
}
diff --git a/src/applications/diffusion/conduit/DiffusionDiffQueryConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionDiffQueryConduitAPIMethod.php
index 0ec00bc762..19295f2b20 100644
--- a/src/applications/diffusion/conduit/DiffusionDiffQueryConduitAPIMethod.php
+++ b/src/applications/diffusion/conduit/DiffusionDiffQueryConduitAPIMethod.php
@@ -10,9 +10,9 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return
+ return pht(
'Get diff information from a repository for a specific path at an '.
- '(optional) commit.';
+ '(optional) commit.');
}
protected function defineReturnType() {
diff --git a/src/applications/diffusion/conduit/DiffusionExistsQueryConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionExistsQueryConduitAPIMethod.php
index d0d5453a34..3c6d09ebda 100644
--- a/src/applications/diffusion/conduit/DiffusionExistsQueryConduitAPIMethod.php
+++ b/src/applications/diffusion/conduit/DiffusionExistsQueryConduitAPIMethod.php
@@ -8,7 +8,7 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return 'Determine if code exists in a version control system.';
+ return pht('Determine if code exists in a version control system.');
}
protected function defineReturnType() {
@@ -51,7 +51,7 @@ protected function getMercurialResult(ConduitAPIRequest $request) {
list($err, $stdout) = $repository->execLocalCommand(
'id --rev %s',
$commit);
- return !$err;
+ return !$err;
}
}
diff --git a/src/applications/diffusion/conduit/DiffusionFileContentQueryConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionFileContentQueryConduitAPIMethod.php
index 9204a84bbc..671ec3ef6f 100644
--- a/src/applications/diffusion/conduit/DiffusionFileContentQueryConduitAPIMethod.php
+++ b/src/applications/diffusion/conduit/DiffusionFileContentQueryConduitAPIMethod.php
@@ -8,7 +8,7 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return 'Retrieve file content from a repository.';
+ return pht('Retrieve file content from a repository.');
}
protected function defineReturnType() {
diff --git a/src/applications/diffusion/conduit/DiffusionGetCommitsConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionGetCommitsConduitAPIMethod.php
index cdc89807cd..15dd1f53f6 100644
--- a/src/applications/diffusion/conduit/DiffusionGetCommitsConduitAPIMethod.php
+++ b/src/applications/diffusion/conduit/DiffusionGetCommitsConduitAPIMethod.php
@@ -16,7 +16,7 @@ public function getMethodStatus() {
}
public function getMethodStatusDescription() {
- return pht('Obsoleted by diffusion.querycommits.');
+ return pht('Obsoleted by %s.', 'diffusion.querycommits');
}
protected function defineParamTypes() {
diff --git a/src/applications/diffusion/conduit/DiffusionGetRecentCommitsByPathConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionGetRecentCommitsByPathConduitAPIMethod.php
index 89e40c69ba..002805ac4e 100644
--- a/src/applications/diffusion/conduit/DiffusionGetRecentCommitsByPathConduitAPIMethod.php
+++ b/src/applications/diffusion/conduit/DiffusionGetRecentCommitsByPathConduitAPIMethod.php
@@ -10,7 +10,8 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return 'Get commit identifiers for recent commits affecting a given path.';
+ return pht(
+ 'Get commit identifiers for recent commits affecting a given path.');
}
protected function defineParamTypes() {
diff --git a/src/applications/diffusion/conduit/DiffusionHistoryQueryConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionHistoryQueryConduitAPIMethod.php
index 939a47ab64..dcc8f56e8f 100644
--- a/src/applications/diffusion/conduit/DiffusionHistoryQueryConduitAPIMethod.php
+++ b/src/applications/diffusion/conduit/DiffusionHistoryQueryConduitAPIMethod.php
@@ -10,8 +10,9 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return 'Returns history information for a repository at a specific '.
- 'commit and path.';
+ return pht(
+ 'Returns history information for a repository at a specific '.
+ 'commit and path.');
}
protected function defineReturnType() {
diff --git a/src/applications/diffusion/conduit/DiffusionMergedCommitsQueryConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionMergedCommitsQueryConduitAPIMethod.php
index fd618a291e..9d2d6caadc 100644
--- a/src/applications/diffusion/conduit/DiffusionMergedCommitsQueryConduitAPIMethod.php
+++ b/src/applications/diffusion/conduit/DiffusionMergedCommitsQueryConduitAPIMethod.php
@@ -8,8 +8,8 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return
- 'Merged commit information for a specific commit in a repository.';
+ return pht(
+ 'Merged commit information for a specific commit in a repository.');
}
protected function defineReturnType() {
diff --git a/src/applications/diffusion/conduit/DiffusionQueryConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionQueryConduitAPIMethod.php
index 22c4adad45..e9f5681f9f 100644
--- a/src/applications/diffusion/conduit/DiffusionQueryConduitAPIMethod.php
+++ b/src/applications/diffusion/conduit/DiffusionQueryConduitAPIMethod.php
@@ -13,7 +13,7 @@ public function getMethodStatus() {
public function getMethodStatusDescription() {
return pht(
- 'See T2784 - migrating diffusion working copy calls to conduit methods. '.
+ 'See T2784 - migrating Diffusion working copy calls to conduit methods. '.
'Until that task is completed (and possibly after) these methods are '.
'unstable.');
}
diff --git a/src/applications/diffusion/conduit/DiffusionRawDiffQueryConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionRawDiffQueryConduitAPIMethod.php
index a7e217d2aa..282dc7eb9b 100644
--- a/src/applications/diffusion/conduit/DiffusionRawDiffQueryConduitAPIMethod.php
+++ b/src/applications/diffusion/conduit/DiffusionRawDiffQueryConduitAPIMethod.php
@@ -8,9 +8,9 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return
+ return pht(
'Get raw diff information from a repository for a specific commit at an '.
- '(optional) path.';
+ '(optional) path.');
}
protected function defineReturnType() {
diff --git a/src/applications/diffusion/conduit/DiffusionRefsQueryConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionRefsQueryConduitAPIMethod.php
index 2d025e9d4a..00bb28b385 100644
--- a/src/applications/diffusion/conduit/DiffusionRefsQueryConduitAPIMethod.php
+++ b/src/applications/diffusion/conduit/DiffusionRefsQueryConduitAPIMethod.php
@@ -8,8 +8,8 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return
- 'Query a git repository for ref information at a specific commit.';
+ return pht(
+ 'Query a git repository for ref information at a specific commit.');
}
protected function defineReturnType() {
diff --git a/src/applications/diffusion/conduit/DiffusionSearchQueryConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionSearchQueryConduitAPIMethod.php
index 5cf91a10f0..16b9762e1d 100644
--- a/src/applications/diffusion/conduit/DiffusionSearchQueryConduitAPIMethod.php
+++ b/src/applications/diffusion/conduit/DiffusionSearchQueryConduitAPIMethod.php
@@ -8,7 +8,7 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return 'Search (grep) a repository at a specific path and commit.';
+ return pht('Search (grep) a repository at a specific path and commit.');
}
protected function defineReturnType() {
@@ -27,7 +27,7 @@ protected function defineCustomParamTypes() {
protected function defineCustomErrorTypes() {
return array(
- 'ERR-GREP-COMMAND' => 'Grep command failed.',
+ 'ERR-GREP-COMMAND' => pht('Grep command failed.'),
);
}
diff --git a/src/applications/diffusion/config/PhabricatorDiffusionConfigOptions.php b/src/applications/diffusion/config/PhabricatorDiffusionConfigOptions.php
index 644556cd66..9c3d7eff81 100644
--- a/src/applications/diffusion/config/PhabricatorDiffusionConfigOptions.php
+++ b/src/applications/diffusion/config/PhabricatorDiffusionConfigOptions.php
@@ -20,6 +20,22 @@ public function getGroup() {
}
public function getOptions() {
+ $custom_field_type = 'custom:PhabricatorCustomFieldConfigOptionType';
+
+ $fields = array(
+ new PhabricatorCommitRepositoryField(),
+ new PhabricatorCommitBranchesField(),
+ new PhabricatorCommitTagsField(),
+ new PhabricatorCommitMergedCommitsField(),
+ );
+
+ $default_fields = array();
+ foreach ($fields as $field) {
+ $default_fields[$field->getFieldKey()] = array(
+ 'disabled' => $field->shouldDisableByDefault(),
+ );
+ }
+
return array(
$this->newOption(
'metamta.diffusion.subject-prefix',
@@ -35,9 +51,10 @@ public function getOptions() {
pht('Attach Patches'),
pht('Do Not Attach Patches'),
))
- ->setDescription(pht(
- 'Set this to true if you want patches to be attached to commit '.
- 'notifications from Diffusion.')),
+ ->setDescription(
+ pht(
+ 'Set this to true if you want patches to be attached to commit '.
+ 'notifications from Diffusion.')),
$this->newOption('metamta.diffusion.inline-patches', 'int', 0)
->setSummary(pht('Include patches in Diffusion mail as body text.'))
->setDescription(
@@ -63,10 +80,11 @@ public function getOptions() {
$this->newOption('bugtraq.url', 'string', null)
->addExample('https://bugs.php.net/%BUGID%', pht('PHP bugs'))
->addExample('/%BUGID%', pht('Local Maniphest URL'))
- ->setDescription(pht(
- 'URL of external bug tracker used by Diffusion. %s will be '.
+ ->setDescription(
+ pht(
+ 'URL of external bug tracker used by Diffusion. %s will be '.
'substituted by the bug ID.',
- '%BUGID%')),
+ '%BUGID%')),
$this->newOption('bugtraq.logregex', 'list', array())
->addExample(array('/\B#([1-9]\d*)\b/'), pht('Issue #123'))
->addExample(
@@ -74,8 +92,9 @@ public function getOptions() {
pht('Issue #123, #456'))
->addExample(array('/(?addExample('/[A-Z]{2,}-\d+/', pht('JIRA-1234'))
- ->setDescription(pht(
- 'Regular expression to link external bug tracker. See '.
+ ->setDescription(
+ pht(
+ 'Regular expression to link external bug tracker. See '.
'http://tortoisesvn.net/docs/release/TortoiseSVN_en/'.
'tsvn-dug-bugtracker.html for further explanation.')),
$this->newOption('diffusion.allow-http-auth', 'bool', false)
@@ -121,6 +140,12 @@ public function getOptions() {
'from web traffic (for example, if you use different SSH and '.
'web load balancers), you can set the SSH hostname here. This '.
'is an advanced option.')),
+ $this->newOption('diffusion.fields', $custom_field_type, $default_fields)
+ ->setCustomData(
+ id(new PhabricatorRepositoryCommit())
+ ->getCustomFieldBaseClass())
+ ->setDescription(
+ pht('Select and reorder Diffusion fields.')),
);
}
diff --git a/src/applications/diffusion/controller/DiffusionBrowseDirectoryController.php b/src/applications/diffusion/controller/DiffusionBrowseDirectoryController.php
index 833e108648..0d54aba087 100644
--- a/src/applications/diffusion/controller/DiffusionBrowseDirectoryController.php
+++ b/src/applications/diffusion/controller/DiffusionBrowseDirectoryController.php
@@ -98,7 +98,9 @@ protected function processDiffusionRequest(AphrontRequest $request) {
array(
'title' => array(
nonempty(basename($drequest->getPath()), '/'),
- $drequest->getRepository()->getCallsign().' Repository',
+ pht(
+ '%s Repository',
+ $drequest->getRepository()->getCallsign()),
),
));
}
diff --git a/src/applications/diffusion/controller/DiffusionBrowseFileController.php b/src/applications/diffusion/controller/DiffusionBrowseFileController.php
index 731906943c..c55d217bfe 100644
--- a/src/applications/diffusion/controller/DiffusionBrowseFileController.php
+++ b/src/applications/diffusion/controller/DiffusionBrowseFileController.php
@@ -124,13 +124,15 @@ protected function processDiffusionRequest(AphrontRequest $request) {
switch ($follow) {
case 'first':
$notice->appendChild(
- pht('Unable to continue tracing the history of this file because '.
- 'this commit is the first commit in the repository.'));
+ pht(
+ 'Unable to continue tracing the history of this file because '.
+ 'this commit is the first commit in the repository.'));
break;
case 'created':
$notice->appendChild(
- pht('Unable to continue tracing the history of this file because '.
- 'this commit created the file.'));
+ pht(
+ 'Unable to continue tracing the history of this file because '.
+ 'this commit created the file.'));
break;
}
$content[] = $notice;
@@ -142,7 +144,8 @@ protected function processDiffusionRequest(AphrontRequest $request) {
$notice->setSeverity(PHUIInfoView::SEVERITY_NOTICE);
$notice->setTitle(pht('File Renamed'));
$notice->appendChild(
- pht("File history passes through a rename from '%s' to '%s'.",
+ pht(
+ "File history passes through a rename from '%s' to '%s'.",
$drequest->getPath(), $renamed));
$content[] = $notice;
}
@@ -267,13 +270,28 @@ private function buildCorpus(
$id = celerity_generate_unique_node_id();
$repo = $drequest->getRepository();
- $symbol_repos = $repo->getSymbolSources();
+ $symbol_repos = nonempty($repo->getSymbolSources(), array());
$symbol_repos[] = $repo;
$lang = last(explode('.', $drequest->getPath()));
$repo_languages = $repo->getSymbolLanguages();
+ $repo_languages = nonempty($repo_languages, array());
$repo_languages = array_fill_keys($repo_languages, true);
- if (empty($repo_languages) || isset($repo_languages[$lang])) {
+
+ $needs_symbols = true;
+ if ($repo_languages && $symbol_repos) {
+ $have_symbols = id(new DiffusionSymbolQuery())
+ ->existsSymbolsInRepository($repo->getPHID());
+ if (!$have_symbols) {
+ $needs_symbols = false;
+ }
+ }
+
+ if ($needs_symbols && $repo_languages) {
+ $needs_symbols = isset($repo_languages[$lang]);
+ }
+
+ if ($needs_symbols) {
Javelin::initBehavior(
'repository-crossreference',
array(
diff --git a/src/applications/diffusion/controller/DiffusionBrowseSearchController.php b/src/applications/diffusion/controller/DiffusionBrowseSearchController.php
index ac0f74e79e..550fe38773 100644
--- a/src/applications/diffusion/controller/DiffusionBrowseSearchController.php
+++ b/src/applications/diffusion/controller/DiffusionBrowseSearchController.php
@@ -33,7 +33,9 @@ protected function processDiffusionRequest(AphrontRequest $request) {
array(
'title' => array(
nonempty(basename($drequest->getPath()), '/'),
- $drequest->getRepository()->getCallsign().' Repository',
+ pht(
+ '%s Repository',
+ $drequest->getRepository()->getCallsign()),
),
));
}
diff --git a/src/applications/diffusion/controller/DiffusionCommitBranchesController.php b/src/applications/diffusion/controller/DiffusionCommitBranchesController.php
index 0be218fac8..4f12e17656 100644
--- a/src/applications/diffusion/controller/DiffusionCommitBranchesController.php
+++ b/src/applications/diffusion/controller/DiffusionCommitBranchesController.php
@@ -39,6 +39,6 @@ protected function processDiffusionRequest(AphrontRequest $request) {
}
return id(new AphrontAjaxResponse())
- ->setContent($branch_links ? implode(', ', $branch_links) : 'None');
+ ->setContent($branch_links ? implode(', ', $branch_links) : pht('None'));
}
}
diff --git a/src/applications/diffusion/controller/DiffusionCommitController.php b/src/applications/diffusion/controller/DiffusionCommitController.php
index 1126cb659d..7a795e1099 100644
--- a/src/applications/diffusion/controller/DiffusionCommitController.php
+++ b/src/applications/diffusion/controller/DiffusionCommitController.php
@@ -83,10 +83,12 @@ protected function processDiffusionRequest(AphrontRequest $request) {
$error_panel->setTitle(pht('Commit Not Tracked'));
$error_panel->setSeverity(PHUIInfoView::SEVERITY_WARNING);
$error_panel->appendChild(
- pht("This Diffusion repository is configured to track only one ".
- "subdirectory of the entire Subversion repository, and this commit ".
- "didn't affect the tracked subdirectory ('%s'), so no ".
- "information is available.", $subpath));
+ pht(
+ "This Diffusion repository is configured to track only one ".
+ "subdirectory of the entire Subversion repository, and this commit ".
+ "didn't affect the tracked subdirectory ('%s'), so no ".
+ "information is available.",
+ $subpath));
$content[] = $error_panel;
} else {
$engine = PhabricatorMarkupEngine::newDifferentialMarkupEngine();
@@ -238,10 +240,10 @@ protected function processDiffusionRequest(AphrontRequest $request) {
$change_panel = new PHUIObjectBoxView();
$header = new PHUIHeaderView();
- $header->setHeader('Changes ('.number_format($count).')');
+ $header->setHeader(pht('Changes (%s)', new PhutilNumber($count)));
$change_panel->setID('toc');
- if ($count > self::CHANGES_LIMIT && !$show_all_details) {
+ if ($count > self::CHANGES_LIMIT && !$show_all_details) {
$icon = id(new PHUIIconView())
->setIconFont('fa-files-o');
@@ -253,7 +255,7 @@ protected function processDiffusionRequest(AphrontRequest $request) {
$warning_view = id(new PHUIInfoView())
->setSeverity(PHUIInfoView::SEVERITY_WARNING)
- ->setTitle('Very Large Commit')
+ ->setTitle(pht('Very Large Commit'))
->appendChild(
pht('This commit is very large. Load each file individually.'));
@@ -280,7 +282,7 @@ protected function processDiffusionRequest(AphrontRequest $request) {
$vcs_supports_directory_changes = false;
break;
default:
- throw new Exception('Unknown VCS.');
+ throw new Exception(pht('Unknown VCS.'));
}
$references = array();
@@ -901,8 +903,8 @@ private function buildMergesTable(PhabricatorRepositoryCommit $commit) {
$caption->setSeverity(PHUIInfoView::SEVERITY_NOTICE);
$caption->appendChild(
pht(
- 'This commit merges a very large number of changes. Only the first '.
- '%s are shown.',
+ 'This commit merges a very large number of changes. '.
+ 'Only the first %s are shown.',
new PhutilNumber($limit)));
}
diff --git a/src/applications/diffusion/controller/DiffusionController.php b/src/applications/diffusion/controller/DiffusionController.php
index 0b3e97a097..262223c6f9 100644
--- a/src/applications/diffusion/controller/DiffusionController.php
+++ b/src/applications/diffusion/controller/DiffusionController.php
@@ -11,7 +11,7 @@ public function setDiffusionRequest(DiffusionRequest $request) {
protected function getDiffusionRequest() {
if (!$this->diffusionRequest) {
- throw new Exception('No Diffusion request object!');
+ throw new Exception(pht('No Diffusion request object!'));
}
return $this->diffusionRequest;
}
diff --git a/src/applications/diffusion/controller/DiffusionExternalController.php b/src/applications/diffusion/controller/DiffusionExternalController.php
index c48553842f..4ab698b07c 100644
--- a/src/applications/diffusion/controller/DiffusionExternalController.php
+++ b/src/applications/diffusion/controller/DiffusionExternalController.php
@@ -75,9 +75,11 @@ protected function processDiffusionRequest(AphrontRequest $request) {
->appendChild(phutil_tag(
'p',
array(),
- pht('This external (%s) does not appear in any tracked '.
- 'repository. It may exist in an untracked repository that '.
- 'Diffusion does not know about.', $desc)));
+ pht(
+ 'This external (%s) does not appear in any tracked '.
+ 'repository. It may exist in an untracked repository that '.
+ 'Diffusion does not know about.',
+ $desc)));
} else if (count($commits) == 1) {
$commit = head($commits);
$repo = $repositories[$commit->getRepositoryID()];
diff --git a/src/applications/diffusion/controller/DiffusionHistoryController.php b/src/applications/diffusion/controller/DiffusionHistoryController.php
index 36667c5dfe..887e4cbd2e 100644
--- a/src/applications/diffusion/controller/DiffusionHistoryController.php
+++ b/src/applications/diffusion/controller/DiffusionHistoryController.php
@@ -168,6 +168,4 @@ protected function buildPropertyView(
return $view;
}
-
-
}
diff --git a/src/applications/diffusion/controller/DiffusionInlineCommentController.php b/src/applications/diffusion/controller/DiffusionInlineCommentController.php
index fb3d87167f..09f5f06ad5 100644
--- a/src/applications/diffusion/controller/DiffusionInlineCommentController.php
+++ b/src/applications/diffusion/controller/DiffusionInlineCommentController.php
@@ -33,7 +33,7 @@ protected function createComment() {
PhabricatorRepository::TABLE_PATH,
$path_id);
if (!$path) {
- throw new Exception('Invalid path ID!');
+ throw new Exception(pht('Invalid path ID!'));
}
return id(new PhabricatorAuditInlineComment())
@@ -55,7 +55,7 @@ protected function loadCommentForEdit($id) {
$inline = $this->loadComment($id);
if (!$this->canEditInlineComment($user, $inline)) {
- throw new Exception('That comment is not editable!');
+ throw new Exception(pht('That comment is not editable!'));
}
return $inline;
}
diff --git a/src/applications/diffusion/controller/DiffusionPathValidateController.php b/src/applications/diffusion/controller/DiffusionPathValidateController.php
index 1b839aab47..d54ddd7af6 100644
--- a/src/applications/diffusion/controller/DiffusionPathValidateController.php
+++ b/src/applications/diffusion/controller/DiffusionPathValidateController.php
@@ -58,7 +58,7 @@ protected function processDiffusionRequest(AphrontRequest $request) {
if ($branch) {
$message = pht('Not found in %s', $branch);
} else {
- $message = pht('Not found at HEAD');
+ $message = pht('Not found at %s', 'HEAD');
}
} else {
$message = pht('OK');
diff --git a/src/applications/diffusion/controller/DiffusionRepositoryController.php b/src/applications/diffusion/controller/DiffusionRepositoryController.php
index 7eb99b7096..ff81c02ab4 100644
--- a/src/applications/diffusion/controller/DiffusionRepositoryController.php
+++ b/src/applications/diffusion/controller/DiffusionRepositoryController.php
@@ -60,8 +60,7 @@ protected function processDiffusionRequest(AphrontRequest $request) {
}
} else {
$empty_title = pht('Empty Repository');
- $empty_message = pht(
- 'This repository does not have any commits yet.');
+ $empty_message = pht('This repository does not have any commits yet.');
}
}
@@ -391,9 +390,9 @@ private function buildBranchListTable(DiffusionRequest $drequest) {
$button->setTag('a');
$button->setIcon($icon);
$button->setHref($drequest->generateURI(
- array(
- 'action' => 'branches',
- )));
+ array(
+ 'action' => 'branches',
+ )));
$header->addActionLink($button);
$panel->setHeader($header);
diff --git a/src/applications/diffusion/controller/DiffusionRepositoryCreateController.php b/src/applications/diffusion/controller/DiffusionRepositoryCreateController.php
index d077d031f0..269523915e 100644
--- a/src/applications/diffusion/controller/DiffusionRepositoryCreateController.php
+++ b/src/applications/diffusion/controller/DiffusionRepositoryCreateController.php
@@ -71,7 +71,7 @@ protected function processDiffusionRequest(AphrontRequest $request) {
$cancel_uri = $this->getApplicationURI('new/');
break;
default:
- throw new Exception('Invalid edit operation!');
+ throw new Exception(pht('Invalid edit operation!'));
}
$form = id(new PHUIPagedFormView())
@@ -483,7 +483,7 @@ public function adjustRemoteURIPage(PHUIFormPageView $page) {
$is_mercurial = true;
break;
default:
- throw new Exception('Unsupported VCS!');
+ throw new Exception(pht('Unsupported VCS!'));
}
$has_local = ($is_git || $is_mercurial);
@@ -527,7 +527,7 @@ public function adjustRemoteURIPage(PHUIFormPageView $page) {
"repository, use the //Import Only// option at the end of this ".
"workflow.)");
} else {
- throw new Exception('Unsupported VCS!');
+ throw new Exception(pht('Unsupported VCS!'));
}
$page->addRemarkupInstructions($instructions, 'remoteURI');
@@ -623,7 +623,7 @@ public function adjustAuthPage($page) {
$remote_uri),
'credential');
} else {
- throw new Exception('Unknown URI protocol!');
+ throw new Exception(pht('Unknown URI protocol!'));
}
if ($provides_type) {
@@ -734,8 +734,7 @@ private function buildPolicyPage() {
->setAdjustFormPageCallback(array($this, 'adjustPolicyPage'))
->setUser($viewer)
->addRemarkupInstructions(
- pht(
- 'Select access policies for this repository.'))
+ pht('Select access policies for this repository.'))
->addControl($view_policy)
->addControl($edit_policy)
->addControl($push_policy);
diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditActionsController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditActionsController.php
index 3c149e8cea..2b0bc674be 100644
--- a/src/applications/diffusion/controller/DiffusionRepositoryEditActionsController.php
+++ b/src/applications/diffusion/controller/DiffusionRepositoryEditActionsController.php
@@ -75,8 +75,7 @@ protected function processDiffusionRequest(AphrontRequest $request) {
"new commits. You can disable publishing for this repository by ".
"turning off **Notify/Publish**. This will disable notifications, ".
"feed, and Herald (including audits and build plans) for this ".
- "repository.".
- "\n\n".
+ "repository.\n\n".
"When Phabricator discovers a new commit, it can automatically ".
"close associated revisions and tasks. If you don't want ".
"Phabricator to close objects when it discovers new commits in ".
diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditBasicController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditBasicController.php
index 986f46cec5..80771f65c4 100644
--- a/src/applications/diffusion/controller/DiffusionRepositoryEditBasicController.php
+++ b/src/applications/diffusion/controller/DiffusionRepositoryEditBasicController.php
@@ -152,19 +152,25 @@ protected function processDiffusionRequest(AphrontRequest $request) {
private function getReadmeInstructions() {
return pht(<< $row) {
@@ -167,8 +167,7 @@ protected function processDiffusionRequest(AphrontRequest $request) {
$form = id(new AphrontFormView())
->setUser($viewer)
->appendRemarkupInstructions(
- pht(
- 'You can choose a **Default Branch** for viewing this repository.'))
+ pht('You can choose a **Default Branch** for viewing this repository.'))
->appendChild(
id(new AphrontFormTextControl())
->setName('default')
@@ -196,7 +195,8 @@ protected function processDiffusionRequest(AphrontRequest $request) {
pht(
'When specifying branches, you should enter one branch name per '.
'line. You can use regular expressions to match branches by '.
- 'wrapping an expression in `regexp(...)`. For example:'))
+ 'wrapping an expression in `%s`. For example:',
+ 'regexp(...)'))
->appendChild(
id(new AphrontFormMarkupControl())
->setValue($example_table))
diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditDeleteController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditDeleteController.php
index 34a8431651..f39708fe1b 100644
--- a/src/applications/diffusion/controller/DiffusionRepositoryEditDeleteController.php
+++ b/src/applications/diffusion/controller/DiffusionRepositoryEditDeleteController.php
@@ -30,8 +30,9 @@ protected function processDiffusionRequest(AphrontRequest $request) {
$command = csprintf(
'phabricator/ $ ./bin/remove destroy %R',
$repository->getMonogram());
- $text_2 = pht('Repositories touch many objects and as such deletes are '.
- 'prohibitively expensive to run from the web UI.');
+ $text_2 = pht(
+ 'Repositories touch many objects and as such deletes are '.
+ 'prohibitively expensive to run from the web UI.');
$body = phutil_tag(
'div',
array(
diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditEncodingController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditEncodingController.php
index 1abbad6521..f71516e6ca 100644
--- a/src/applications/diffusion/controller/DiffusionRepositoryEditEncodingController.php
+++ b/src/applications/diffusion/controller/DiffusionRepositoryEditEncodingController.php
@@ -104,8 +104,7 @@ private function getEncodingInstructions() {
Phabricator handles text encodings.
EOT
,
- PhabricatorEnv::getDoclink(
- 'User Guide: UTF-8 and Character Encoding'));
+ PhabricatorEnv::getDoclink('User Guide: UTF-8 and Character Encoding'));
}
}
diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php
index a5ad77f87e..824a7afe1d 100644
--- a/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php
+++ b/src/applications/diffusion/controller/DiffusionRepositoryEditMainController.php
@@ -30,6 +30,7 @@ protected function processDiffusionRequest(AphrontRequest $request) {
$has_branches = ($is_git || $is_hg);
$has_local = $repository->usesLocalWorkingCopy();
+ $supports_staging = $repository->supportsStaging();
$crumbs = $this->buildApplicationCrumbs($is_main = true);
@@ -92,6 +93,13 @@ protected function processDiffusionRequest(AphrontRequest $request) {
$this->buildStorageActions($repository));
}
+ $staging_properties = null;
+ if ($supports_staging) {
+ $staging_properties = $this->buildStagingProperties(
+ $repository,
+ $this->buildStagingActions($repository));
+ }
+
$actions_properties = $this->buildActionsProperties(
$repository,
$this->buildActionsActions($repository));
@@ -157,6 +165,12 @@ protected function processDiffusionRequest(AphrontRequest $request) {
->addPropertyList($storage_properties);
}
+ if ($staging_properties) {
+ $boxes[] = id(new PHUIObjectBoxView())
+ ->setHeaderText(pht('Staging'))
+ ->addPropertyList($staging_properties);
+ }
+
$boxes[] = id(new PHUIObjectBoxView())
->setHeaderText(pht('Text Encoding'))
->addPropertyList($encoding_properties);
@@ -609,6 +623,45 @@ private function buildStorageProperties(
return $view;
}
+
+ private function buildStagingActions(PhabricatorRepository $repository) {
+ $viewer = $this->getViewer();
+
+ $view = id(new PhabricatorActionListView())
+ ->setObjectURI($this->getRequest()->getRequestURI())
+ ->setUser($viewer);
+
+ $edit = id(new PhabricatorActionView())
+ ->setIcon('fa-pencil')
+ ->setName(pht('Edit Staging'))
+ ->setHref(
+ $this->getRepositoryControllerURI($repository, 'edit/staging/'));
+ $view->addAction($edit);
+
+ return $view;
+ }
+
+ private function buildStagingProperties(
+ PhabricatorRepository $repository,
+ PhabricatorActionListView $actions) {
+ $viewer = $this->getViewer();
+
+ $view = id(new PHUIPropertyListView())
+ ->setUser($viewer)
+ ->setActionList($actions);
+
+ $staging_uri = $repository->getStagingURI();
+ if (!$staging_uri) {
+ $staging_uri = phutil_tag('em', array(), pht('No Staging Area'));
+ }
+
+ $view->addProperty(
+ pht('Staging Area'),
+ $staging_uri);
+
+ return $view;
+ }
+
private function buildHostingActions(PhabricatorRepository $repository) {
$user = $this->getRequest()->getUser();
@@ -819,8 +872,9 @@ private function buildRepositoryStatus(
->setTarget(
pht('Missing Binary %s', phutil_tag('tt', array(), $binary)))
->setNote(pht(
- 'Unable to find this binary in `environment.append-paths`. '.
+ 'Unable to find this binary in `%s`. '.
'You need to configure %s and include %s.',
+ 'environment.append-paths',
$this->getEnvConfigLink(),
$path)));
}
diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditStagingController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditStagingController.php
new file mode 100644
index 0000000000..9fcfd767c0
--- /dev/null
+++ b/src/applications/diffusion/controller/DiffusionRepositoryEditStagingController.php
@@ -0,0 +1,92 @@
+getUser();
+ $drequest = $this->diffusionRequest;
+ $repository = $drequest->getRepository();
+
+ $repository = id(new PhabricatorRepositoryQuery())
+ ->setViewer($user)
+ ->requireCapabilities(
+ array(
+ PhabricatorPolicyCapability::CAN_VIEW,
+ PhabricatorPolicyCapability::CAN_EDIT,
+ ))
+ ->withIDs(array($repository->getID()))
+ ->executeOne();
+ if (!$repository) {
+ return new Aphront404Response();
+ }
+
+ if (!$repository->supportsStaging()) {
+ return new Aphront404Response();
+ }
+
+ $edit_uri = $this->getRepositoryControllerURI($repository, 'edit/');
+
+ $v_area = $repository->getHumanReadableDetail('staging-uri');
+ if ($request->isFormPost()) {
+ $v_area = $request->getStr('area');
+
+ $xactions = array();
+ $template = id(new PhabricatorRepositoryTransaction());
+
+ $type_encoding = PhabricatorRepositoryTransaction::TYPE_STAGING_URI;
+
+ $xactions[] = id(clone $template)
+ ->setTransactionType($type_encoding)
+ ->setNewValue($v_area);
+
+ id(new PhabricatorRepositoryEditor())
+ ->setContinueOnNoEffect(true)
+ ->setContentSourceFromRequest($request)
+ ->setActor($user)
+ ->applyTransactions($repository, $xactions);
+
+ return id(new AphrontRedirectResponse())->setURI($edit_uri);
+ }
+
+ $crumbs = $this->buildApplicationCrumbs();
+ $crumbs->addTextCrumb(pht('Edit Staging'));
+
+ $title = pht('Edit %s', $repository->getName());
+
+ $form = id(new AphrontFormView())
+ ->setUser($user)
+ ->appendRemarkupInstructions(
+ pht(
+ "To make it easier to run integration tests and builds on code ".
+ "under review, you can configure a **Staging Area**. When `arc` ".
+ "creates a diff, it will push a copy of the changes to the ".
+ "configured staging area with a corresponding tag.".
+ "\n\n".
+ "IMPORTANT: This feature is new, experimental, and not supported. ".
+ "Use it at your own risk."))
+ ->appendChild(
+ id(new AphrontFormTextControl())
+ ->setLabel(pht('Staging Area URI'))
+ ->setName('area')
+ ->setValue($v_area))
+ ->appendChild(
+ id(new AphrontFormSubmitControl())
+ ->setValue(pht('Save'))
+ ->addCancelButton($edit_uri));
+
+ $object_box = id(new PHUIObjectBoxView())
+ ->setHeaderText($title)
+ ->setForm($form);
+
+ return $this->buildApplicationPage(
+ array(
+ $crumbs,
+ $object_box,
+ ),
+ array(
+ 'title' => $title,
+ ));
+ }
+
+}
diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditStorageController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditStorageController.php
index 07da9a6442..345464a005 100644
--- a/src/applications/diffusion/controller/DiffusionRepositoryEditStorageController.php
+++ b/src/applications/diffusion/controller/DiffusionRepositoryEditStorageController.php
@@ -57,10 +57,11 @@ protected function processDiffusionRequest(AphrontRequest $request) {
->appendRemarkupInstructions(
pht(
"You can not adjust the local path for this repository from the ".
- "web interface. To edit it, run this command:\n\n".
- " phabricator/ $ ./bin/repository edit %s --as %s --local-path ...",
- $repository->getCallsign(),
- $user->getUsername()))
+ "web interface. To edit it, run this command:\n\n %s",
+ sprintf(
+ 'phabricator/ $ ./bin/repository edit %s --as %s --local-path ...',
+ $repository->getCallsign(),
+ $user->getUsername())))
->appendChild(
id(new AphrontFormSubmitControl())
->addCancelButton($edit_uri, pht('Done')));
diff --git a/src/applications/diffusion/controller/DiffusionRepositoryEditSubversionController.php b/src/applications/diffusion/controller/DiffusionRepositoryEditSubversionController.php
index 83cda151d7..b125f26cae 100644
--- a/src/applications/diffusion/controller/DiffusionRepositoryEditSubversionController.php
+++ b/src/applications/diffusion/controller/DiffusionRepositoryEditSubversionController.php
@@ -84,11 +84,11 @@ protected function processDiffusionRequest(AphrontRequest $request) {
pht(
"You can set the **Repository UUID**, which will help Phabriactor ".
"provide better context in some cases. You can find the UUID of a ".
- "repository by running `svn info`.".
- "\n\n".
+ "repository by running `%s`.\n\n".
"If you want to import only part of a repository, like `trunk/`, ".
"you can set a path in **Import Only**. Phabricator will ignore ".
- "commits which do not affect this path."))
+ "commits which do not affect this path.",
+ 'svn info'))
->appendChild(
id(new AphrontFormTextControl())
->setName('uuid')
diff --git a/src/applications/diffusion/controller/DiffusionRepositoryNewController.php b/src/applications/diffusion/controller/DiffusionRepositoryNewController.php
index efab745433..f7fac7b183 100644
--- a/src/applications/diffusion/controller/DiffusionRepositoryNewController.php
+++ b/src/applications/diffusion/controller/DiffusionRepositoryNewController.php
@@ -53,11 +53,11 @@ protected function processDiffusionRequest(AphrontRequest $request) {
'import',
pht('Import an Existing External Repository'),
pht(
- 'Import a repository hosted somewhere else, like GitHub, '.
- 'Bitbucket, or your organization\'s existing servers. '.
- 'Phabricator will read changes from the repository but will '.
- 'not host or manage it. The authoritative master version of '.
- 'the repository will stay where it is now.')))
+ "Import a repository hosted somewhere else, like GitHub, ".
+ "Bitbucket, or your organization's existing servers. ".
+ "Phabricator will read changes from the repository but will ".
+ "not host or manage it. The authoritative master version of ".
+ "the repository will stay where it is now.")))
->appendChild(
id(new AphrontFormSubmitControl())
->setValue(pht('Continue'))
diff --git a/src/applications/diffusion/controller/DiffusionServeController.php b/src/applications/diffusion/controller/DiffusionServeController.php
index 2b82bde43d..a76acd704c 100644
--- a/src/applications/diffusion/controller/DiffusionServeController.php
+++ b/src/applications/diffusion/controller/DiffusionServeController.php
@@ -342,7 +342,11 @@ private function serveGitRequest(
// resolve the binary first.
$bin = Filesystem::resolveBinary('git-http-backend');
if (!$bin) {
- throw new Exception('Unable to find `git-http-backend` in PATH!');
+ throw new Exception(
+ pht(
+ 'Unable to find `%s` in %s!',
+ 'git-http-backend',
+ '$PATH'));
}
$env = array(
@@ -485,7 +489,11 @@ private function serveMercurialRequest(
$bin = Filesystem::resolveBinary('hg');
if (!$bin) {
- throw new Exception('Unable to find `hg` in PATH!');
+ throw new Exception(
+ pht(
+ 'Unable to find `%s` in %s!',
+ 'hg',
+ '$PATH'));
}
$env = $this->getCommonEnvironment($viewer);
diff --git a/src/applications/diffusion/data/DiffusionGitBranch.php b/src/applications/diffusion/data/DiffusionGitBranch.php
index 925ede568c..8f69645b73 100644
--- a/src/applications/diffusion/data/DiffusionGitBranch.php
+++ b/src/applications/diffusion/data/DiffusionGitBranch.php
@@ -42,7 +42,10 @@ public static function parseRemoteBranchOutput(
continue;
}
if (!preg_match('/^ *(\S+)\s+([a-z0-9]{40})/', $line, $matches)) {
- throw new Exception("Failed to parse {$line}!");
+ throw new Exception(
+ pht(
+ 'Failed to parse %s!',
+ $line));
}
$remote_branch = $matches[1];
@@ -57,7 +60,9 @@ public static function parseRemoteBranchOutput(
$matches = null;
if (!preg_match('#^([^/]+)/(.*)$#', $remote_branch, $matches)) {
throw new Exception(
- "Failed to parse remote branch '{$remote_branch}'!");
+ pht(
+ "Failed to parse remote branch '%s'!",
+ $remote_branch));
}
$remote_name = $matches[1];
$branch_name = $matches[2];
@@ -84,7 +89,10 @@ public static function parseLocalBranchOutput($stdout) {
foreach ($lines as $line) {
$matches = null;
if (!preg_match($regex, $line, $matches)) {
- throw new Exception("Failed to parse {$line}!");
+ throw new Exception(
+ pht(
+ 'Failed to parse %s!',
+ $line));
}
$branch = $matches[1];
diff --git a/src/applications/diffusion/data/DiffusionRepositoryTag.php b/src/applications/diffusion/data/DiffusionRepositoryTag.php
index 12e71185bf..555e082700 100644
--- a/src/applications/diffusion/data/DiffusionRepositoryTag.php
+++ b/src/applications/diffusion/data/DiffusionRepositoryTag.php
@@ -72,7 +72,7 @@ public function attachMessage($message) {
public function getMessage() {
if ($this->message === false) {
- throw new Exception('Message is not attached!');
+ throw new Exception(pht('Message is not attached!'));
}
return $this->message;
}
diff --git a/src/applications/diffusion/engine/DiffusionCommitHookEngine.php b/src/applications/diffusion/engine/DiffusionCommitHookEngine.php
index 13c7127e08..f84eb13bdf 100644
--- a/src/applications/diffusion/engine/DiffusionCommitHookEngine.php
+++ b/src/applications/diffusion/engine/DiffusionCommitHookEngine.php
@@ -697,7 +697,10 @@ private function findMercurialRefUpdates() {
private function findMercurialChangegroupRefUpdates() {
$hg_node = getenv('HG_NODE');
if (!$hg_node) {
- throw new Exception(pht('Expected HG_NODE in environment!'));
+ throw new Exception(
+ pht(
+ 'Expected %s in environment!',
+ 'HG_NODE'));
}
// NOTE: We need to make sure this is passed to subprocesses, or they won't
diff --git a/src/applications/diffusion/exception/DiffusionSetupException.php b/src/applications/diffusion/exception/DiffusionSetupException.php
index eecf7a81fc..0ce5994b7e 100644
--- a/src/applications/diffusion/exception/DiffusionSetupException.php
+++ b/src/applications/diffusion/exception/DiffusionSetupException.php
@@ -3,7 +3,7 @@
final class DiffusionSetupException extends AphrontUsageException {
public function __construct($message) {
- parent::__construct('Diffusion Setup Exception', $message);
+ parent::__construct(pht('Diffusion Setup Exception'), $message);
}
}
diff --git a/src/applications/diffusion/protocol/DiffusionMercurialWireProtocol.php b/src/applications/diffusion/protocol/DiffusionMercurialWireProtocol.php
index 578196ff69..6d52573656 100644
--- a/src/applications/diffusion/protocol/DiffusionMercurialWireProtocol.php
+++ b/src/applications/diffusion/protocol/DiffusionMercurialWireProtocol.php
@@ -28,7 +28,7 @@ public static function getCommandArgs($command) {
);
if (!isset($commands[$command])) {
- throw new Exception("Unknown Mercurial command '{$command}!");
+ throw new Exception(pht("Unknown Mercurial command '%s!", $command));
}
return $commands[$command];
@@ -65,7 +65,7 @@ public static function isReadOnlyBatchCommand($cmds) {
// on the side of caution and throw if we don't get any data here. This
// either indicates a mangled command from the client or a programming
// error in our code.
- throw new Exception("Expected nonempty 'cmds' specification!");
+ throw new Exception(pht("Expected nonempty '%s' specification!", 'cmds'));
}
// For "batch" we get a "cmds" argument like:
diff --git a/src/applications/diffusion/protocol/DiffusionSubversionWireProtocol.php b/src/applications/diffusion/protocol/DiffusionSubversionWireProtocol.php
index e5645859a4..1cb0f107aa 100644
--- a/src/applications/diffusion/protocol/DiffusionSubversionWireProtocol.php
+++ b/src/applications/diffusion/protocol/DiffusionSubversionWireProtocol.php
@@ -93,7 +93,7 @@ public function writeData($data) {
$this->state = 'item';
}
} else {
- throw new Exception("Invalid state '{$this->state}'!");
+ throw new Exception(pht("Invalid state '%s'!", $this->state));
}
}
@@ -124,7 +124,10 @@ public function serializeStruct(array $struct) {
$out[] = self::serializeStruct($value);
break;
default:
- throw new Exception("Unknown SVN wire protocol structure '{$type}'!");
+ throw new Exception(
+ pht(
+ "Unknown SVN wire protocol structure '%s'!",
+ $type));
}
if ($type != 'list') {
$out[] = ' ';
@@ -139,7 +142,9 @@ public function isReadOnlyCommand(array $struct) {
if (empty($struct[0]['type']) || ($struct[0]['type'] != 'word')) {
// This isn't what we expect; fail defensively.
throw new Exception(
- pht("Unexpected command structure, expected '( word ... )'."));
+ pht(
+ "Unexpected command structure, expected '%s'.",
+ '( word ... )'));
}
switch ($struct[0]['value']) {
diff --git a/src/applications/diffusion/query/DiffusionCachedResolveRefsQuery.php b/src/applications/diffusion/query/DiffusionCachedResolveRefsQuery.php
index 8190a035f2..55e86ce879 100644
--- a/src/applications/diffusion/query/DiffusionCachedResolveRefsQuery.php
+++ b/src/applications/diffusion/query/DiffusionCachedResolveRefsQuery.php
@@ -42,7 +42,7 @@ protected function executeQuery() {
$result = $this->resolveSubversionRefs();
break;
default:
- throw new Exception('Unsupported repository type!');
+ throw new Exception(pht('Unsupported repository type!'));
}
if ($this->types !== null) {
diff --git a/src/applications/diffusion/query/DiffusionCommitQuery.php b/src/applications/diffusion/query/DiffusionCommitQuery.php
index 23f886154b..93efb1df12 100644
--- a/src/applications/diffusion/query/DiffusionCommitQuery.php
+++ b/src/applications/diffusion/query/DiffusionCommitQuery.php
@@ -144,7 +144,9 @@ public function withAuditStatus($status) {
public function getIdentifierMap() {
if ($this->identifierMap === null) {
throw new Exception(
- 'You must execute() the query before accessing the identifier map.');
+ pht(
+ 'You must %s the query before accessing the identifier map.',
+ 'execute()'));
}
return $this->identifierMap;
}
@@ -491,8 +493,10 @@ protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
self::AUDIT_STATUS_PARTIAL,
);
throw new Exception(
- "Unknown audit status '{$status}'! Valid statuses are: ".
- implode(', ', $valid));
+ pht(
+ "Unknown audit status '%s'! Valid statuses are: %s.",
+ $status,
+ implode(', ', $valid)));
}
}
diff --git a/src/applications/diffusion/query/DiffusionQuery.php b/src/applications/diffusion/query/DiffusionQuery.php
index 24f58583bf..a180a61f5a 100644
--- a/src/applications/diffusion/query/DiffusionQuery.php
+++ b/src/applications/diffusion/query/DiffusionQuery.php
@@ -32,7 +32,7 @@ final protected static function initQueryObject(
$name = idx($map, $repository->getVersionControlSystem());
if (!$name) {
- throw new Exception('Unsupported VCS!');
+ throw new Exception(pht('Unsupported VCS!'));
}
$class = str_replace('Diffusion', 'Diffusion'.$name, $base_class);
diff --git a/src/applications/diffusion/query/DiffusionSymbolQuery.php b/src/applications/diffusion/query/DiffusionSymbolQuery.php
index 6017c45f6f..0e08b7b32d 100644
--- a/src/applications/diffusion/query/DiffusionSymbolQuery.php
+++ b/src/applications/diffusion/query/DiffusionSymbolQuery.php
@@ -113,6 +113,26 @@ public function needRepositories($need_repositories) {
}
+/* -( Specialized Query )-------------------------------------------------- */
+
+ public function existsSymbolsInRepository($repository_phid) {
+ $this
+ ->withRepositoryPHIDs(array($repository_phid))
+ ->setLimit(1);
+
+ $symbol = new PhabricatorRepositorySymbol();
+ $conn_r = $symbol->establishConnection('r');
+
+ $data = queryfx_all(
+ $conn_r,
+ 'SELECT * FROM %T %Q %Q',
+ $symbol->getTableName(),
+ $this->buildWhereClause($conn_r),
+ $this->buildLimitClause($conn_r));
+
+ return (!empty($data));
+ }
+
/* -( Executing the Query )------------------------------------------------ */
diff --git a/src/applications/diffusion/query/filecontent/DiffusionGitFileContentQuery.php b/src/applications/diffusion/query/filecontent/DiffusionGitFileContentQuery.php
index ec0729d453..67c6369940 100644
--- a/src/applications/diffusion/query/filecontent/DiffusionGitFileContentQuery.php
+++ b/src/applications/diffusion/query/filecontent/DiffusionGitFileContentQuery.php
@@ -45,8 +45,10 @@ public static function match($line) {
// 8220d5d54f6d5d5552a636576cbe9c35f15b65b2
// (Andrew Gallagher 2010-12-03 324)
// // Add the lines for trailing context
- preg_match('/^\s*?(\S+?)\s*\(\s*(.*?)\s+\d{4}-\d{2}-\d{2}\s+\d+\)(.*)?$/',
- $line, $m);
+ preg_match(
+ '/^\s*?(\S+?)\s*\(\s*(.*?)\s+\d{4}-\d{2}-\d{2}\s+\d+\)(.*)?$/',
+ $line,
+ $m);
$rev_id = $m[1];
$author = $m[2];
$text = idx($m, 3);
diff --git a/src/applications/diffusion/query/filecontent/DiffusionSvnFileContentQuery.php b/src/applications/diffusion/query/filecontent/DiffusionSvnFileContentQuery.php
index d87db3ec87..be7487969b 100644
--- a/src/applications/diffusion/query/filecontent/DiffusionSvnFileContentQuery.php
+++ b/src/applications/diffusion/query/filecontent/DiffusionSvnFileContentQuery.php
@@ -26,9 +26,10 @@ protected function executeQueryFromFuture(Future $future) {
// nuked; Diffusion will think it still exists and try to grab content
// at HEAD.
throw new Exception(
- 'Failed to retrieve file content from Subversion. The file may '.
- 'have been recently deleted, or the Diffusion cache may be out of '.
- 'date.');
+ pht(
+ 'Failed to retrieve file content from Subversion. The file may '.
+ 'have been recently deleted, or the Diffusion cache may be out of '.
+ 'date.'));
} else {
throw $ex;
}
diff --git a/src/applications/diffusion/query/lowlevel/DiffusionLowLevelCommitQuery.php b/src/applications/diffusion/query/lowlevel/DiffusionLowLevelCommitQuery.php
index 4aaf85d930..43862ce451 100644
--- a/src/applications/diffusion/query/lowlevel/DiffusionLowLevelCommitQuery.php
+++ b/src/applications/diffusion/query/lowlevel/DiffusionLowLevelCommitQuery.php
@@ -17,8 +17,7 @@ public function withIdentifier($identifier) {
protected function executeQuery() {
if (!strlen($this->identifier)) {
- throw new Exception(
- pht('You must provide an identifier with withIdentifier()!'));
+ throw new PhutilInvalidStateException('withIdentifier');
}
$type = $this->getRepository()->getVersionControlSystem();
diff --git a/src/applications/diffusion/query/lowlevel/DiffusionLowLevelParentsQuery.php b/src/applications/diffusion/query/lowlevel/DiffusionLowLevelParentsQuery.php
index 2b264bc35c..60ee4b5fe2 100644
--- a/src/applications/diffusion/query/lowlevel/DiffusionLowLevelParentsQuery.php
+++ b/src/applications/diffusion/query/lowlevel/DiffusionLowLevelParentsQuery.php
@@ -12,8 +12,7 @@ public function withIdentifier($identifier) {
protected function executeQuery() {
if (!strlen($this->identifier)) {
- throw new Exception(
- pht('You must provide an identifier with withIdentifier()!'));
+ throw new PhutilInvalidStateException('withIdentifier');
}
$type = $this->getRepository()->getVersionControlSystem();
diff --git a/src/applications/diffusion/query/lowlevel/DiffusionLowLevelResolveRefsQuery.php b/src/applications/diffusion/query/lowlevel/DiffusionLowLevelResolveRefsQuery.php
index 3926dbf398..53dc6b30da 100644
--- a/src/applications/diffusion/query/lowlevel/DiffusionLowLevelResolveRefsQuery.php
+++ b/src/applications/diffusion/query/lowlevel/DiffusionLowLevelResolveRefsQuery.php
@@ -42,7 +42,7 @@ protected function executeQuery() {
$result = $this->resolveSubversionRefs();
break;
default:
- throw new Exception('Unsupported repository type!');
+ throw new Exception(pht('Unsupported repository type!'));
}
if ($this->types !== null) {
@@ -112,7 +112,10 @@ private function resolveGitRefs() {
$lines = explode("\n", rtrim($stdout, "\n"));
if (count($lines) !== count($unresolved)) {
- throw new Exception('Unexpected line count from `git cat-file`!');
+ throw new Exception(
+ pht(
+ 'Unexpected line count from `%s`!',
+ 'git cat-file'));
}
$hits = array();
@@ -122,7 +125,11 @@ private function resolveGitRefs() {
foreach ($lines as $ref => $line) {
$parts = explode(' ', $line);
if (count($parts) < 2) {
- throw new Exception("Failed to parse `git cat-file` output: {$line}");
+ throw new Exception(
+ pht(
+ 'Failed to parse `%s` output: %s',
+ 'git cat-file',
+ $line));
}
list($identifier, $type) = $parts;
@@ -143,7 +150,10 @@ private function resolveGitRefs() {
break;
default:
throw new Exception(
- "Unexpected object type from `git cat-file`: {$line}");
+ pht(
+ 'Unexpected object type from `%s`: %s',
+ 'git cat-file',
+ $line));
}
$hits[] = array(
@@ -177,7 +187,10 @@ private function resolveGitRefs() {
$alternate = $identifier;
$identifier = idx($tag_map, $ref);
if (!$identifier) {
- throw new Exception("Failed to look up tag '{$ref}'!");
+ throw new Exception(
+ pht(
+ "Failed to look up tag '%s'!",
+ $ref));
}
}
diff --git a/src/applications/diffusion/query/pathid/__tests__/DiffusionPathQueryTestCase.php b/src/applications/diffusion/query/pathid/__tests__/DiffusionPathQueryTestCase.php
index b0c6183761..a3ab67e60d 100644
--- a/src/applications/diffusion/query/pathid/__tests__/DiffusionPathQueryTestCase.php
+++ b/src/applications/diffusion/query/pathid/__tests__/DiffusionPathQueryTestCase.php
@@ -6,19 +6,19 @@ public function testParentEdgeCases() {
$this->assertEqual(
'/',
DiffusionPathIDQuery::getParentPath('/'),
- 'Parent of /');
+ pht('Parent of %s', '/'));
$this->assertEqual(
'/',
DiffusionPathIDQuery::getParentPath('x.txt'),
- 'Parent of x.txt');
+ pht('Parent of %s', 'x.txt'));
$this->assertEqual(
'/a',
DiffusionPathIDQuery::getParentPath('/a/b'),
- 'Parent of /a/b');
+ pht('Parent of %s', '/a/b'));
$this->assertEqual(
'/a',
DiffusionPathIDQuery::getParentPath('/a///b'),
- 'Parent of /a///b');
+ pht('Parent of %s', '/a///b'));
}
public function testExpandEdgeCases() {
diff --git a/src/applications/diffusion/request/DiffusionGitRequest.php b/src/applications/diffusion/request/DiffusionGitRequest.php
index 48d0761506..6e30886eec 100644
--- a/src/applications/diffusion/request/DiffusionGitRequest.php
+++ b/src/applications/diffusion/request/DiffusionGitRequest.php
@@ -17,7 +17,7 @@ public function getBranch() {
if ($this->repository) {
return $this->repository->getDefaultBranch();
}
- throw new Exception('Unable to determine branch!');
+ throw new Exception(pht('Unable to determine branch!'));
}
}
diff --git a/src/applications/diffusion/request/DiffusionMercurialRequest.php b/src/applications/diffusion/request/DiffusionMercurialRequest.php
index 5966ffaaa0..a43cb089dd 100644
--- a/src/applications/diffusion/request/DiffusionMercurialRequest.php
+++ b/src/applications/diffusion/request/DiffusionMercurialRequest.php
@@ -19,7 +19,7 @@ public function getBranch() {
return $this->repository->getDefaultBranch();
}
- throw new Exception('Unable to determine branch!');
+ throw new Exception(pht('Unable to determine branch!'));
}
}
diff --git a/src/applications/diffusion/request/DiffusionRequest.php b/src/applications/diffusion/request/DiffusionRequest.php
index e7296e9cc1..2ed8e1f88e 100644
--- a/src/applications/diffusion/request/DiffusionRequest.php
+++ b/src/applications/diffusion/request/DiffusionRequest.php
@@ -62,13 +62,22 @@ protected function didInitialize() {
final public static function newFromDictionary(array $data) {
if (isset($data['repository']) && isset($data['callsign'])) {
throw new Exception(
- "Specify 'repository' or 'callsign', but not both.");
+ pht(
+ "Specify '%s' or '%s', but not both.",
+ 'repository',
+ 'callsign'));
} else if (!isset($data['repository']) && !isset($data['callsign'])) {
throw new Exception(
- "One of 'repository' and 'callsign' is required.");
+ pht(
+ "One of '%s' and '%s' is required.",
+ 'repository',
+ 'callsign'));
} else if (isset($data['callsign']) && empty($data['user'])) {
throw new Exception(
- "Parameter 'user' is required if 'callsign' is provided.");
+ pht(
+ "Parameter '%s' is required if '%s' is provided.",
+ 'user',
+ 'callsign'));
}
if (isset($data['repository'])) {
@@ -147,7 +156,7 @@ final private static function newFromCallsign(
->executeOne();
if (!$repository) {
- throw new Exception("No such repository '{$callsign}'.");
+ throw new Exception(pht("No such repository '%s'.", $callsign));
}
return self::newFromRepository($repository);
@@ -174,7 +183,7 @@ final private static function newFromRepository(
$class = idx($map, $repository->getVersionControlSystem());
if (!$class) {
- throw new Exception('Unknown version control system!');
+ throw new Exception(pht('Unknown version control system!'));
}
$object = new $class();
@@ -207,7 +216,9 @@ final private function initializeFromDictionary(array $data) {
$user = idx($data, 'user');
if (!$user) {
throw new Exception(
- 'You must provide a PhabricatorUser in the dictionary!');
+ pht(
+ 'You must provide a %s in the dictionary!',
+ 'PhabricatorUser'));
}
$this->setUser($user);
}
@@ -409,7 +420,7 @@ public function loadCommitData() {
if (!$data) {
$data = new PhabricatorRepositoryCommitData();
$data->setCommitMessage(
- '(This commit has not been fully parsed yet.)');
+ pht('(This commit has not been fully parsed yet.)'));
}
$this->repositoryCommitData = $data;
}
@@ -533,12 +544,16 @@ public static function generateDiffusionURI(array $params) {
if ($req_callsign && !strlen($callsign)) {
throw new Exception(
- "Diffusion URI action '{$action}' requires callsign!");
+ pht(
+ "Diffusion URI action '%s' requires callsign!",
+ $action));
}
if ($req_commit && !strlen($commit)) {
throw new Exception(
- "Diffusion URI action '{$action}' requires commit!");
+ pht(
+ "Diffusion URI action '%s' requires commit!",
+ $action));
}
switch ($action) {
@@ -576,7 +591,7 @@ public static function generateDiffusionURI(array $params) {
$uri = "/r{$callsign}{$commit}";
break;
default:
- throw new Exception("Unknown Diffusion URI action '{$action}'!");
+ throw new Exception(pht("Unknown Diffusion URI action '%s'!", $action));
}
if ($action == 'rendering-ref') {
@@ -663,7 +678,7 @@ public static function parseRequestBlob($blob, $supports_branches) {
// Prevent any hyjinx since we're ultimately shipping this to the
// filesystem under a lot of workflows.
if ($part == '..') {
- throw new Exception('Invalid path URI.');
+ throw new Exception(pht('Invalid path URI.'));
}
}
@@ -689,21 +704,27 @@ protected function raisePermissionException() {
$host = php_uname('n');
$callsign = $this->getRepository()->getCallsign();
throw new DiffusionSetupException(
- "The clone of this repository ('{$callsign}') on the local machine ".
- "('{$host}') could not be read. Ensure that the repository is in a ".
- "location where the web server has read permissions.");
+ pht(
+ "The clone of this repository ('%s') on the local machine ('%s') ".
+ "could not be read. Ensure that the repository is in a ".
+ "location where the web server has read permissions.",
+ $callsign,
+ $host));
}
protected function raiseCloneException() {
$host = php_uname('n');
$callsign = $this->getRepository()->getCallsign();
throw new DiffusionSetupException(
- "The working copy for this repository ('{$callsign}') hasn't been ".
- "cloned yet on this machine ('{$host}'). Make sure you've started the ".
- "Phabricator daemons. If this problem persists for longer than a clone ".
- "should take, check the daemon logs (in the Daemon Console) to see if ".
- "there were errors cloning the repository. Consult the 'Diffusion User ".
- "Guide' in the documentation for help setting up repositories.");
+ pht(
+ "The working copy for this repository ('%s') hasn't been cloned yet ".
+ "on this machine ('%s'). Make sure you've started the Phabricator ".
+ "daemons. If this problem persists for longer than a clone should ".
+ "take, check the daemon logs (in the Daemon Console) to see if there ".
+ "were errors cloning the repository. Consult the 'Diffusion User ".
+ "Guide' in the documentation for help setting up repositories.",
+ $callsign,
+ $host));
}
private function queryStableCommit() {
diff --git a/src/applications/diffusion/request/__tests__/DiffusionURITestCase.php b/src/applications/diffusion/request/__tests__/DiffusionURITestCase.php
index a6c9eeb27d..43a2bd3404 100644
--- a/src/applications/diffusion/request/__tests__/DiffusionURITestCase.php
+++ b/src/applications/diffusion/request/__tests__/DiffusionURITestCase.php
@@ -67,7 +67,7 @@ public function testBlobDecode() {
$this->assertEqual(
$expect,
$actual,
- "Parsing '{$input}'");
+ pht("Parsing '%s'", $input));
}
}
diff --git a/src/applications/diffusion/ssh/DiffusionMercurialServeSSHWorkflow.php b/src/applications/diffusion/ssh/DiffusionMercurialServeSSHWorkflow.php
index b6c22b3a7e..51ffdeb3bd 100644
--- a/src/applications/diffusion/ssh/DiffusionMercurialServeSSHWorkflow.php
+++ b/src/applications/diffusion/ssh/DiffusionMercurialServeSSHWorkflow.php
@@ -35,11 +35,11 @@ protected function executeRepositoryOperations() {
$args = $this->getArgs();
if (!$args->getArg('stdio')) {
- throw new Exception('Expected `hg ... --stdio`!');
+ throw new Exception(pht('Expected `%s`!', 'hg ... --stdio'));
}
if ($args->getArg('command') !== array('serve')) {
- throw new Exception('Expected `hg ... serve`!');
+ throw new Exception(pht('Expected `%s`!', 'hg ... serve'));
}
if ($this->shouldProxy()) {
diff --git a/src/applications/diffusion/ssh/DiffusionMercurialWireClientSSHProtocolChannel.php b/src/applications/diffusion/ssh/DiffusionMercurialWireClientSSHProtocolChannel.php
index e82a62a251..5150ef9352 100644
--- a/src/applications/diffusion/ssh/DiffusionMercurialWireClientSSHProtocolChannel.php
+++ b/src/applications/diffusion/ssh/DiffusionMercurialWireClientSSHProtocolChannel.php
@@ -207,7 +207,7 @@ protected function decodeStream($data) {
break;
}
} else {
- throw new Exception("Bad parser state '{$this->state}'!");
+ throw new Exception(pht("Bad parser state '%s'!", $this->state));
}
}
diff --git a/src/applications/diffusion/ssh/DiffusionSSHWorkflow.php b/src/applications/diffusion/ssh/DiffusionSSHWorkflow.php
index 5190f8d3d1..2b2c820773 100644
--- a/src/applications/diffusion/ssh/DiffusionSSHWorkflow.php
+++ b/src/applications/diffusion/ssh/DiffusionSSHWorkflow.php
@@ -154,8 +154,7 @@ protected function loadRepositoryWithPath($path) {
if (!preg_match($regex, $path, $matches)) {
throw new Exception(
pht(
- 'Unrecognized repository path "%s". Expected a path like '.
- '"%s".',
+ 'Unrecognized repository path "%s". Expected a path like "%s".',
$path,
'/diffusion/X/'));
}
diff --git a/src/applications/diffusion/ssh/DiffusionSubversionServeSSHWorkflow.php b/src/applications/diffusion/ssh/DiffusionSubversionServeSSHWorkflow.php
index 4c5fd6740a..4d085302c9 100644
--- a/src/applications/diffusion/ssh/DiffusionSubversionServeSSHWorkflow.php
+++ b/src/applications/diffusion/ssh/DiffusionSubversionServeSSHWorkflow.php
@@ -83,7 +83,8 @@ protected function identifyRepository() {
if (!$exec_channel->isOpenForReading()) {
throw new Exception(
pht(
- 'svnserve subprocess exited before emitting a protocol frame.'));
+ '%s subprocess exited before emitting a protocol frame.',
+ 'svnserve'));
}
}
@@ -141,7 +142,7 @@ protected function executeRepositoryOperations() {
$args = $this->getArgs();
if (!$args->getArg('tunnel')) {
- throw new Exception('Expected `svnserve -t`!');
+ throw new Exception(pht('Expected `%s`!', 'svnserve -t'));
}
if ($this->shouldProxy()) {
@@ -350,8 +351,9 @@ private function getPathFromSubversionURI($uri_string) {
if ($proto !== 'svn+ssh') {
throw new Exception(
pht(
- 'Protocol for URI "%s" MUST be "svn+ssh".',
- $uri_string));
+ 'Protocol for URI "%s" MUST be "%s".',
+ $uri_string,
+ 'svn+ssh'));
}
$path = $uri->getPath();
@@ -360,7 +362,8 @@ private function getPathFromSubversionURI($uri_string) {
if (preg_match('(/\\.\\./)', $path)) {
throw new Exception(
pht(
- 'String "/../" is invalid in path specification "%s".',
+ 'String "%s" is invalid in path specification "%s".',
+ '/../',
$uri_string));
}
diff --git a/src/applications/diffusion/ssh/__tests__/DiffusionMercurialWireSSHTestCase.php b/src/applications/diffusion/ssh/__tests__/DiffusionMercurialWireSSHTestCase.php
index 694f4cd11d..0154805dd3 100644
--- a/src/applications/diffusion/ssh/__tests__/DiffusionMercurialWireSSHTestCase.php
+++ b/src/applications/diffusion/ssh/__tests__/DiffusionMercurialWireSSHTestCase.php
@@ -50,7 +50,7 @@ private function assertParserResult(array $expect, $input, $file) {
$this->assertTrue(
($caught instanceof Exception),
- "No extra messages for '{$file}'.");
+ pht("No extra messages for '%s'.", $file));
}
}
diff --git a/src/applications/diffusion/typeahead/DiffusionArcanistProjectDatasource.php b/src/applications/diffusion/typeahead/DiffusionArcanistProjectDatasource.php
deleted file mode 100644
index 4f58acfa59..0000000000
--- a/src/applications/diffusion/typeahead/DiffusionArcanistProjectDatasource.php
+++ /dev/null
@@ -1,39 +0,0 @@
-getViewer();
- $raw_query = $this->getRawQuery();
-
- $results = array();
-
- $arcprojs = id(new PhabricatorRepositoryArcanistProject())->loadAll();
- foreach ($arcprojs as $proj) {
- $results[] = id(new PhabricatorTypeaheadResult())
- ->setName($proj->getName())
- ->setPHID($proj->getPHID());
- }
-
- return $results;
- }
-
-}
diff --git a/src/applications/diffusion/view/DiffusionEmptyResultView.php b/src/applications/diffusion/view/DiffusionEmptyResultView.php
index 798fc7cf07..74a131e9d7 100644
--- a/src/applications/diffusion/view/DiffusionEmptyResultView.php
+++ b/src/applications/diffusion/view/DiffusionEmptyResultView.php
@@ -55,7 +55,7 @@ public function render() {
$title = pht('Path Was Deleted');
$body = pht(
'This path does not exist at %s. It was deleted in %s and last %s '.
- 'at %s.',
+ 'at %s.',
$commit,
self::linkCommit($drequest->getRepository(), $deleted),
$browse,
@@ -66,14 +66,15 @@ public function render() {
$subdir = $drequest->getRepository()->getDetail('svn-subpath');
$title = pht('Directory Not Tracked');
$body =
- pht("This repository is configured to track only one subdirectory ".
- "of the entire repository ('%s'), ".
- "but you aren't looking at something in that subdirectory, so no ".
- "information is available.", $subdir);
+ pht(
+ "This repository is configured to track only one subdirectory ".
+ "of the entire repository ('%s'), but you aren't looking at ".
+ "something in that subdirectory, so no information is available.",
+ $subdir);
$severity = PHUIInfoView::SEVERITY_WARNING;
break;
default:
- throw new Exception("Unknown failure reason: $reason");
+ throw new Exception(pht('Unknown failure reason: %s', $reason));
}
$error_view = new PHUIInfoView();
diff --git a/src/applications/diffusion/view/DiffusionView.php b/src/applications/diffusion/view/DiffusionView.php
index 44613f05cc..0bc51f8347 100644
--- a/src/applications/diffusion/view/DiffusionView.php
+++ b/src/applications/diffusion/view/DiffusionView.php
@@ -13,8 +13,11 @@ final public function getDiffusionRequest() {
return $this->diffusionRequest;
}
- final public function linkChange($change_type, $file_type, $path = null,
- $commit_identifier = null) {
+ final public function linkChange(
+ $change_type,
+ $file_type,
+ $path = null,
+ $commit_identifier = null) {
$text = DifferentialChangeType::getFullNameForChangeType($change_type);
if ($change_type == DifferentialChangeType::TYPE_CHILD) {
diff --git a/src/applications/diviner/atom/DivinerAtom.php b/src/applications/diviner/atom/DivinerAtom.php
index ef1a079a41..adeac36808 100644
--- a/src/applications/diviner/atom/DivinerAtom.php
+++ b/src/applications/diviner/atom/DivinerAtom.php
@@ -396,7 +396,7 @@ public static function getThisAtomIsNotDocumentedString($type) {
case self::TYPE_METHOD:
return pht('This method is not documented.');
default:
- phlog("Need translation for '{$type}'.");
+ phlog(pht("Need translation for '%s'.", $type));
return pht('This %s is not documented.', $type);
}
}
@@ -427,7 +427,7 @@ public static function getAtomTypeNameString($type) {
case self::TYPE_METHOD:
return pht('Method');
default:
- phlog("Need translation for '{$type}'.");
+ phlog(pht("Need translation for '%s'.", $type));
return ucwords($type);
}
}
diff --git a/src/applications/diviner/atomizer/DivinerArticleAtomizer.php b/src/applications/diviner/atomizer/DivinerArticleAtomizer.php
index 62f568d3ef..e973a49447 100644
--- a/src/applications/diviner/atomizer/DivinerArticleAtomizer.php
+++ b/src/applications/diviner/atomizer/DivinerArticleAtomizer.php
@@ -16,7 +16,7 @@ protected function executeAtomize($file_name, $file_data) {
$title = idx($meta, 'title');
if (!strlen($title)) {
$title = pht('Untitled Article "%s"', basename($file_name));
- $atom->addWarning('Article has no @title!');
+ $atom->addWarning(pht('Article has no %s!', '@title'));
$atom->setDocblockMetaValue('title', $title);
}
diff --git a/src/applications/doorkeeper/worker/DoorkeeperAsanaFeedWorker.php b/src/applications/doorkeeper/worker/DoorkeeperAsanaFeedWorker.php
index 7cd7af0b3f..1d293956b3 100644
--- a/src/applications/doorkeeper/worker/DoorkeeperAsanaFeedWorker.php
+++ b/src/applications/doorkeeper/worker/DoorkeeperAsanaFeedWorker.php
@@ -65,7 +65,7 @@ protected function publishFeedStory() {
$phid_aid_map = $this->lookupAsanaUserIDs($all_phids);
if (!$phid_aid_map) {
throw new PhabricatorWorkerPermanentFailureException(
- 'No related users have linked Asana accounts.');
+ pht('No related users have linked Asana accounts.'));
}
$owner_asana_id = idx($phid_aid_map, $owner_phid);
@@ -86,8 +86,9 @@ protected function publishFeedStory() {
if (!$oauth_token) {
throw new PhabricatorWorkerPermanentFailureException(
- 'Unable to find any Asana user with valid credentials to '.
- 'pull an OAuth token out of.');
+ pht(
+ 'Unable to find any Asana user with valid credentials to '.
+ 'pull an OAuth token out of.'));
}
$etype_main = PhabricatorObjectHasAsanaTaskEdgeType::EDGECONST;
@@ -124,21 +125,23 @@ protected function publishFeedStory() {
$parent_ref = head($refs);
if (!$parent_ref) {
throw new PhabricatorWorkerPermanentFailureException(
- 'DoorkeeperExternalObject could not be loaded.');
+ pht('%s could not be loaded.', 'DoorkeeperExternalObject'));
}
if ($parent_ref->getSyncFailed()) {
throw new Exception(
- 'Synchronization of parent task from Asana failed!');
+ pht('Synchronization of parent task from Asana failed!'));
} else if (!$parent_ref->getIsVisible()) {
- $this->log("Skipping main task update, object is no longer visible.\n");
+ $this->log(
+ "%s\n",
+ pht('Skipping main task update, object is no longer visible.'));
$extra_data['gone'] = true;
} else {
$edge_cursor = idx($main_edge['data'], 'cursor', 0);
// TODO: This probably breaks, very rarely, on 32-bit systems.
if ($edge_cursor <= $story->getChronologicalKey()) {
- $this->log("Updating main task.\n");
+ $this->log("%s\n", pht('Updating main task.'));
$task_id = $parent_ref->getObjectID();
$this->makeAsanaAPICall(
@@ -148,7 +151,8 @@ protected function publishFeedStory() {
$main_data);
} else {
$this->log(
- "Skipping main task update, cursor is ahead of the story.\n");
+ "%s\n",
+ pht('Skipping main task update, cursor is ahead of the story.'));
}
}
} else {
@@ -156,7 +160,9 @@ protected function publishFeedStory() {
// (reviewers or auditors), and we haven't synchronized the object before,
// don't synchronize the object.
if (!$active_phids && !$passive_phids && !$follow_phids) {
- $this->log("Object has no followers or active/passive users.\n");
+ $this->log(
+ "%s\n",
+ pht('Object has no followers or active/passive users.'));
return;
}
@@ -240,8 +246,10 @@ protected function publishFeedStory() {
if (!$parent_ref->getIsVisible()) {
throw new PhabricatorWorkerPermanentFailureException(
- 'DoorkeeperExternalObject has no visible object on the other side; '.
- 'this likely indicates the Asana task has been deleted.');
+ pht(
+ '%s has no visible object on the other side; this '.
+ 'likely indicates the Asana task has been deleted.',
+ 'DoorkeeperExternalObject'));
}
// Now, handle the subtasks.
@@ -264,7 +272,7 @@ protected function publishFeedStory() {
foreach ($refs as $ref) {
if ($ref->getSyncFailed()) {
throw new Exception(
- 'Synchronization of child task from Asana failed!');
+ pht('Synchronization of child task from Asana failed!'));
}
if (!$ref->getIsVisible()) {
$ref->getExternalObject()->delete();
@@ -283,8 +291,10 @@ protected function publishFeedStory() {
}
$this->log(
- "Removing subtask edge to %s, foreign object is not visible.\n",
- $sub_phid);
+ "%s\n",
+ pht(
+ 'Removing subtask edge to %s, foreign object is not visible.',
+ $sub_phid));
$sub_editor->removeEdge($src_phid, $etype_sub, $sub_phid);
unset($sub_edges[$sub_phid]);
}
@@ -448,7 +458,7 @@ private function getProvider() {
$provider = PhabricatorAsanaAuthProvider::getAsanaProvider();
if (!$provider) {
throw new PhabricatorWorkerPermanentFailureException(
- 'No Asana provider configured.');
+ pht('No Asana provider configured.'));
}
$this->provider = $provider;
}
@@ -500,11 +510,11 @@ private function getAsanaSubtaskData($object) {
}
private function getSynchronizationWarning() {
- return
+ return pht(
"\xE2\x9A\xA0 DO NOT EDIT THIS TASK \xE2\x9A\xA0\n".
"\xE2\x98\xA0 Your changes will not be reflected in Phabricator.\n".
"\xE2\x98\xA0 Your changes will be destroyed the next time state ".
- "is synchronized.";
+ "is synchronized.");
}
private function lookupAsanaUserIDs($all_phids) {
diff --git a/src/applications/doorkeeper/worker/DoorkeeperFeedWorker.php b/src/applications/doorkeeper/worker/DoorkeeperFeedWorker.php
index a280e85fbb..d015b19791 100644
--- a/src/applications/doorkeeper/worker/DoorkeeperFeedWorker.php
+++ b/src/applications/doorkeeper/worker/DoorkeeperFeedWorker.php
@@ -158,21 +158,23 @@ private function loadPublisher() {
*/
final protected function doWork() {
if (PhabricatorEnv::getEnvConfig('phabricator.silent')) {
- $this->log(pht('Phabricator is running in silent mode.'));
+ $this->log("%s\n", pht('Phabricator is running in silent mode.'));
return;
}
if (!$this->isEnabled()) {
- $this->log("Doorkeeper worker '%s' is not enabled.\n", get_class($this));
+ $this->log(
+ "%s\n",
+ pht("Doorkeeper worker '%s' is not enabled.", get_class($this)));
return;
}
$publisher = $this->loadPublisher();
if (!$publisher) {
- $this->log("Story is about an unsupported object type.\n");
+ $this->log("%s\n", pht('Story is about an unsupported object type.'));
return;
} else {
- $this->log("Using publisher '%s'.\n", get_class($publisher));
+ $this->log("%s\n", pht("Using publisher '%s'.", get_class($publisher)));
}
$this->publishFeedStory();
diff --git a/src/applications/doorkeeper/worker/DoorkeeperJIRAFeedWorker.php b/src/applications/doorkeeper/worker/DoorkeeperJIRAFeedWorker.php
index 3334a3cd7c..7c6f15cf04 100644
--- a/src/applications/doorkeeper/worker/DoorkeeperJIRAFeedWorker.php
+++ b/src/applications/doorkeeper/worker/DoorkeeperJIRAFeedWorker.php
@@ -34,7 +34,9 @@ protected function publishFeedStory() {
$object->getPHID(),
PhabricatorJiraIssueHasObjectEdgeType::EDGECONST);
if (!$jira_issue_phids) {
- $this->log("Story is about an object with no linked JIRA issues.\n");
+ $this->log(
+ "%s\n",
+ pht('Story is about an object with no linked JIRA issues.'));
return;
}
@@ -44,13 +46,17 @@ protected function publishFeedStory() {
->execute();
if (!$xobjs) {
- $this->log("Story object has no corresponding external JIRA objects.\n");
+ $this->log(
+ "%s\n",
+ pht('Story object has no corresponding external JIRA objects.'));
return;
}
$try_users = $this->findUsersToPossess();
if (!$try_users) {
- $this->log("No users to act on linked JIRA objects.\n");
+ $this->log(
+ "%s\n",
+ pht('No users to act on linked JIRA objects.'));
return;
}
@@ -89,9 +95,11 @@ protected function publishFeedStory() {
} catch (HTTPFutureResponseStatus $ex) {
phlog($ex);
$this->log(
- "Failed to update object %s using user %s.\n",
- $xobj->getObjectID(),
- $account->getUserPHID());
+ "%s\n",
+ pht(
+ 'Failed to update object %s using user %s.',
+ $xobj->getObjectID(),
+ $account->getUserPHID()));
}
}
}
@@ -113,7 +121,7 @@ private function getProvider() {
$provider = PhabricatorJIRAAuthProvider::getJIRAProvider();
if (!$provider) {
throw new PhabricatorWorkerPermanentFailureException(
- 'No JIRA provider configured.');
+ pht('No JIRA provider configured.'));
}
$this->provider = $provider;
}
diff --git a/src/applications/drydock/blueprint/DrydockBlueprintImplementation.php b/src/applications/drydock/blueprint/DrydockBlueprintImplementation.php
index 223d974541..226815a642 100644
--- a/src/applications/drydock/blueprint/DrydockBlueprintImplementation.php
+++ b/src/applications/drydock/blueprint/DrydockBlueprintImplementation.php
@@ -36,7 +36,7 @@ protected function loadLease($lease_id) {
$lease = idx($query, $lease_id);
if (!$lease) {
- throw new Exception("No such lease '{$lease_id}'!");
+ throw new Exception(pht("No such lease '%d'!", $lease_id));
}
return $lease;
@@ -45,7 +45,7 @@ protected function loadLease($lease_id) {
protected function getInstance() {
if (!$this->instance) {
throw new Exception(
- 'Attach the blueprint instance to the implementation.');
+ pht('Attach the blueprint instance to the implementation.'));
}
return $this->instance;
@@ -116,7 +116,7 @@ final public function allocateLease(
$scope = $this->pushActiveScope($resource, $lease);
- $this->log('Trying to Allocate Lease');
+ $this->log(pht('Trying to Allocate Lease'));
$lease->setStatus(DrydockLeaseStatus::STATUS_ACQUIRING);
$lease->setResourceID($resource->getID());
@@ -158,7 +158,7 @@ final public function allocateLease(
$this->log('Allocated Lease');
} else {
$resource->killTransaction();
- $this->log('Failed to Allocate Lease');
+ $this->log(pht('Failed to Allocate Lease'));
}
if ($allocation_exception) {
@@ -221,7 +221,7 @@ final public function acquireLease(
$scope = $this->pushActiveScope($resource, $lease);
- $this->log('Acquiring Lease');
+ $this->log(pht('Acquiring Lease'));
$lease->setStatus(DrydockLeaseStatus::STATUS_ACTIVE);
$lease->setResourceID($resource->getID());
$lease->attachResource($resource);
@@ -237,7 +237,7 @@ final public function acquireLease(
$lease->setAttributes($ephemeral_lease->getAttributes());
$lease->save();
- $this->log('Acquired Lease');
+ $this->log(pht('Acquired Lease'));
}
@@ -287,7 +287,7 @@ final public function releaseLease(
$lease->saveTransaction();
if (!$released) {
- throw new Exception('Unable to release lease: lease not active!');
+ throw new Exception(pht('Unable to release lease: lease not active!'));
}
}
@@ -428,9 +428,12 @@ private function validateAllocatedResource($resource) {
if (!($resource instanceof DrydockResource)) {
throw new Exception(
- "Blueprint '{$blueprint}' is not properly implemented: ".
- "executeAllocateResource() must return an object of type ".
- "DrydockResource or throw, but returned something else.");
+ pht(
+ "Blueprint '%s' is not properly implemented: %s must return an ".
+ "object of type %s or throw, but returned something else.",
+ $blueprint,
+ 'executeAllocateResource()',
+ 'DrydockResource'));
}
$current_status = $resource->getStatus();
@@ -439,10 +442,14 @@ private function validateAllocatedResource($resource) {
$current_name = DrydockResourceStatus::getNameForStatus($current_status);
$req_name = DrydockResourceStatus::getNameForStatus($req_status);
throw new Exception(
- "Blueprint '{$blueprint}' is not properly implemented: ".
- "executeAllocateResource() must return a DrydockResource with ".
- "status '{$req_name}', but returned one with status ".
- "'{$current_name}'.");
+ pht(
+ "Blueprint '%s' is not properly implemented: %s must return a %s ".
+ "with status '%s', but returned one with status '%s'.",
+ $blueprint,
+ 'executeAllocateResource()',
+ 'DrydockResource',
+ $req_name,
+ $current_name));
}
}
@@ -452,7 +459,7 @@ private function pushActiveScope(
if (($this->activeResource !== null) ||
($this->activeLease !== null)) {
- throw new Exception('There is already an active resource or lease!');
+ throw new Exception(pht('There is already an active resource or lease!'));
}
$this->activeResource = $resource;
diff --git a/src/applications/drydock/blueprint/DrydockPreallocatedHostBlueprintImplementation.php b/src/applications/drydock/blueprint/DrydockPreallocatedHostBlueprintImplementation.php
index e256ed4bb9..af6a9e5f2f 100644
--- a/src/applications/drydock/blueprint/DrydockPreallocatedHostBlueprintImplementation.php
+++ b/src/applications/drydock/blueprint/DrydockPreallocatedHostBlueprintImplementation.php
@@ -20,7 +20,8 @@ public function canAllocateMoreResources(array $pool) {
}
protected function executeAllocateResource(DrydockLease $lease) {
- throw new Exception("Preallocated hosts can't be dynamically allocated.");
+ throw new Exception(
+ pht("Preallocated hosts can't be dynamically allocated."));
}
protected function canAllocateLease(
@@ -84,7 +85,9 @@ protected function executeAcquireLease(
// inaccurate sanity checking since we can't safely escape the path.
if (preg_match('/^[A-Z]\\:\\\\[a-zA-Z0-9\\\\\\ ]/', $full_path) === 0) {
throw new Exception(
- 'Unsafe path detected for Windows platform: "'.$full_path.'".');
+ pht(
+ 'Unsafe path detected for Windows platform: "%s".',
+ $full_path));
}
$cmd->execx('mkdir %C', $full_path);
}
@@ -120,7 +123,7 @@ public function getInterface(
));
}
- throw new Exception("No interface of type '{$type}'.");
+ throw new Exception(pht("No interface of type '%s'.", $type));
}
}
diff --git a/src/applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php b/src/applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php
index 3f6adb19b9..54d2b3b0f0 100644
--- a/src/applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php
+++ b/src/applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php
@@ -37,7 +37,9 @@ protected function executeAllocateResource(DrydockLease $lease) {
$repository_id = $lease->getAttribute('repositoryID');
if (!$repository_id) {
throw new Exception(
- "Lease is missing required 'repositoryID' attribute.");
+ pht(
+ "Lease is missing required '%s' attribute.",
+ 'repositoryID'));
}
$repository = id(new PhabricatorRepositoryQuery())
@@ -47,14 +49,16 @@ protected function executeAllocateResource(DrydockLease $lease) {
if (!$repository) {
throw new Exception(
- "Repository '{$repository_id}' does not exist!");
+ pht(
+ "Repository '%s' does not exist!",
+ $repository_id));
}
switch ($repository->getVersionControlSystem()) {
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
break;
default:
- throw new Exception('Unsupported VCS!');
+ throw new Exception(pht('Unsupported VCS!'));
}
// TODO: Policy stuff here too.
@@ -108,7 +112,7 @@ public function getInterface(
->getInterface($type);
}
- throw new Exception("No interface of type '{$type}'.");
+ throw new Exception(pht("No interface of type '%s'.", $type));
}
}
diff --git a/src/applications/drydock/constants/DrydockResourceStatus.php b/src/applications/drydock/constants/DrydockResourceStatus.php
index 7d11d93cba..d653138faf 100644
--- a/src/applications/drydock/constants/DrydockResourceStatus.php
+++ b/src/applications/drydock/constants/DrydockResourceStatus.php
@@ -17,7 +17,7 @@ public static function getNameForStatus($status) {
self::STATUS_DESTROYED => pht('Destroyed'),
);
- return idx($map, $status, 'Unknown');
+ return idx($map, $status, pht('Unknown'));
}
public static function getAllStatuses() {
diff --git a/src/applications/drydock/controller/DrydockConsoleController.php b/src/applications/drydock/controller/DrydockConsoleController.php
index 28647c67a9..923e43a44e 100644
--- a/src/applications/drydock/controller/DrydockConsoleController.php
+++ b/src/applications/drydock/controller/DrydockConsoleController.php
@@ -43,24 +43,19 @@ public function processRequest() {
->setHeader(pht('Resources'))
->setHref($this->getApplicationURI('resource/'))
->addAttribute(
- pht(
- 'View and manage resources Drydock has built, like hosts.')));
+ pht('View and manage resources Drydock has built, like hosts.')));
$menu->addItem(
id(new PHUIObjectItemView())
->setHeader(pht('Leases'))
->setHref($this->getApplicationURI('lease/'))
- ->addAttribute(
- pht(
- 'Manage leases on resources.')));
+ ->addAttribute(pht('Manage leases on resources.')));
$menu->addItem(
id(new PHUIObjectItemView())
->setHeader(pht('Logs'))
->setHref($this->getApplicationURI('log/'))
- ->addAttribute(
- pht(
- 'View logs.')));
+ ->addAttribute(pht('View logs.')));
$crumbs = $this->buildApplicationCrumbs();
diff --git a/src/applications/drydock/controller/DrydockLeaseReleaseController.php b/src/applications/drydock/controller/DrydockLeaseReleaseController.php
index 580e0660e4..1779edf1b2 100644
--- a/src/applications/drydock/controller/DrydockLeaseReleaseController.php
+++ b/src/applications/drydock/controller/DrydockLeaseReleaseController.php
@@ -27,8 +27,11 @@ public function processRequest() {
$dialog = id(new AphrontDialogView())
->setUser($user)
->setTitle(pht('Lease Not Active'))
- ->appendChild(phutil_tag('p', array(), pht(
- 'You can only release "active" leases.')))
+ ->appendChild(
+ phutil_tag(
+ 'p',
+ array(),
+ pht('You can only release "active" leases.')))
->addCancelButton($lease_uri);
return id(new AphrontDialogResponse())->setDialog($dialog);
@@ -38,10 +41,14 @@ public function processRequest() {
$dialog = id(new AphrontDialogView())
->setUser($user)
->setTitle(pht('Really release lease?'))
- ->appendChild(phutil_tag('p', array(), pht(
- 'Releasing a lease may cause trouble for the lease holder and '.
- 'trigger cleanup of the underlying resource. It can not be '.
- 'undone. Continue?')))
+ ->appendChild(
+ phutil_tag(
+ 'p',
+ array(),
+ pht(
+ 'Releasing a lease may cause trouble for the lease holder and '.
+ 'trigger cleanup of the underlying resource. It can not be '.
+ 'undone. Continue?')))
->addSubmitButton(pht('Release Lease'))
->addCancelButton($lease_uri);
diff --git a/src/applications/drydock/controller/DrydockResourceViewController.php b/src/applications/drydock/controller/DrydockResourceViewController.php
index 2a534a4d96..0070b9cf56 100644
--- a/src/applications/drydock/controller/DrydockResourceViewController.php
+++ b/src/applications/drydock/controller/DrydockResourceViewController.php
@@ -20,7 +20,7 @@ public function processRequest() {
return new Aphront404Response();
}
- $title = 'Resource '.$resource->getID().' '.$resource->getName();
+ $title = pht('Resource %s %s', $resource->getID(), $resource->getName());
$header = id(new PHUIHeaderView())
->setHeader($title);
diff --git a/src/applications/drydock/interface/command/DrydockSSHCommandInterface.php b/src/applications/drydock/interface/command/DrydockSSHCommandInterface.php
index 1ec2c124f5..e691e0ecff 100644
--- a/src/applications/drydock/interface/command/DrydockSSHCommandInterface.php
+++ b/src/applications/drydock/interface/command/DrydockSSHCommandInterface.php
@@ -17,14 +17,15 @@ private function openCredentialsIfNotOpen() {
->executeOne();
if ($credential === null) {
- throw new Exception(pht(
- 'There is no credential with ID %d.',
- $this->getConfig('credential')));
+ throw new Exception(
+ pht(
+ 'There is no credential with ID %d.',
+ $this->getConfig('credential')));
}
if ($credential->getProvidesType() !==
PassphraseCredentialTypeSSHPrivateKey::PROVIDES_TYPE) {
- throw new Exception('Only private key credentials are supported.');
+ throw new Exception(pht('Only private key credentials are supported.'));
}
$this->passphraseSSHKey = PassphraseSSHKey::loadFromPHID(
diff --git a/src/applications/drydock/interface/filesystem/DrydockSFTPFilesystemInterface.php b/src/applications/drydock/interface/filesystem/DrydockSFTPFilesystemInterface.php
index 6d6265ac69..fe7d2d1cd3 100644
--- a/src/applications/drydock/interface/filesystem/DrydockSFTPFilesystemInterface.php
+++ b/src/applications/drydock/interface/filesystem/DrydockSFTPFilesystemInterface.php
@@ -17,7 +17,7 @@ private function openCredentialsIfNotOpen() {
if ($credential->getProvidesType() !==
PassphraseCredentialTypeSSHPrivateKey::PROVIDES_TYPE) {
- throw new Exception('Only private key credentials are supported.');
+ throw new Exception(pht('Only private key credentials are supported.'));
}
$this->passphraseSSHKey = PassphraseSSHKey::loadFromPHID(
diff --git a/src/applications/drydock/management/DrydockManagementCloseWorkflow.php b/src/applications/drydock/management/DrydockManagementCloseWorkflow.php
index 550b441e85..f20b0e692b 100644
--- a/src/applications/drydock/management/DrydockManagementCloseWorkflow.php
+++ b/src/applications/drydock/management/DrydockManagementCloseWorkflow.php
@@ -6,7 +6,7 @@ final class DrydockManagementCloseWorkflow
protected function didConstruct() {
$this
->setName('close')
- ->setSynopsis('Close a resource.')
+ ->setSynopsis(pht('Close a resource.'))
->setArguments(
array(
array(
@@ -22,7 +22,7 @@ public function execute(PhutilArgumentParser $args) {
$ids = $args->getArg('ids');
if (!$ids) {
throw new PhutilArgumentUsageException(
- 'Specify one or more resource IDs to close.');
+ pht('Specify one or more resource IDs to close.'));
}
$viewer = $this->getViewer();
@@ -35,12 +35,12 @@ public function execute(PhutilArgumentParser $args) {
foreach ($ids as $id) {
$resource = idx($resources, $id);
if (!$resource) {
- $console->writeErr("Resource %d does not exist!\n", $id);
+ $console->writeErr("%s\n", pht('Resource %d does not exist!', $id));
} else if ($resource->getStatus() != DrydockResourceStatus::STATUS_OPEN) {
- $console->writeErr("Resource %d is not 'open'!\n", $id);
+ $console->writeErr("%s\n", pht("Resource %d is not 'open'!", $id));
} else {
$resource->closeResource();
- $console->writeErr("Closed resource %d.\n", $id);
+ $console->writeErr("%s\n", pht('Closed resource %d.', $id));
}
}
diff --git a/src/applications/drydock/management/DrydockManagementCreateResourceWorkflow.php b/src/applications/drydock/management/DrydockManagementCreateResourceWorkflow.php
index 937a714ea0..8c67aaa908 100644
--- a/src/applications/drydock/management/DrydockManagementCreateResourceWorkflow.php
+++ b/src/applications/drydock/management/DrydockManagementCreateResourceWorkflow.php
@@ -6,23 +6,23 @@ final class DrydockManagementCreateResourceWorkflow
protected function didConstruct() {
$this
->setName('create-resource')
- ->setSynopsis('Create a resource manually.')
+ ->setSynopsis(pht('Create a resource manually.'))
->setArguments(
array(
array(
'name' => 'name',
'param' => 'resource_name',
- 'help' => 'Resource name.',
+ 'help' => pht('Resource name.'),
),
array(
'name' => 'blueprint',
'param' => 'blueprint_id',
- 'help' => 'Blueprint ID.',
+ 'help' => pht('Blueprint ID.'),
),
array(
'name' => 'attributes',
'param' => 'name=value,...',
- 'help' => 'Resource attributes.',
+ 'help' => pht('Resource attributes.'),
),
));
}
@@ -33,13 +33,17 @@ public function execute(PhutilArgumentParser $args) {
$resource_name = $args->getArg('name');
if (!$resource_name) {
throw new PhutilArgumentUsageException(
- 'Specify a resource name with `--name`.');
+ pht(
+ 'Specify a resource name with `%s`.',
+ '--name'));
}
$blueprint_id = $args->getArg('blueprint');
if (!$blueprint_id) {
throw new PhutilArgumentUsageException(
- 'Specify a blueprint ID with `--blueprint`.');
+ pht(
+ 'Specify a blueprint ID with `%s`.',
+ '--blueprint'));
}
$attributes = $args->getArg('attributes');
@@ -57,7 +61,7 @@ public function execute(PhutilArgumentParser $args) {
->executeOne();
if (!$blueprint) {
throw new PhutilArgumentUsageException(
- 'Specified blueprint does not exist.');
+ pht('Specified blueprint does not exist.'));
}
$resource = id(new DrydockResource())
@@ -70,7 +74,7 @@ public function execute(PhutilArgumentParser $args) {
}
$resource->save();
- $console->writeOut("Created Resource %s\n", $resource->getID());
+ $console->writeOut("%s\n", pht('Created Resource %s', $resource->getID()));
return 0;
}
diff --git a/src/applications/drydock/management/DrydockManagementLeaseWorkflow.php b/src/applications/drydock/management/DrydockManagementLeaseWorkflow.php
index 529376fe00..238177ae62 100644
--- a/src/applications/drydock/management/DrydockManagementLeaseWorkflow.php
+++ b/src/applications/drydock/management/DrydockManagementLeaseWorkflow.php
@@ -6,18 +6,18 @@ final class DrydockManagementLeaseWorkflow
protected function didConstruct() {
$this
->setName('lease')
- ->setSynopsis('Lease a resource.')
+ ->setSynopsis(pht('Lease a resource.'))
->setArguments(
array(
array(
'name' => 'type',
'param' => 'resource_type',
- 'help' => 'Resource type.',
+ 'help' => pht('Resource type.'),
),
array(
'name' => 'attributes',
'param' => 'name=value,...',
- 'help' => 'Resource specficiation.',
+ 'help' => pht('Resource specficiation.'),
),
));
}
@@ -28,7 +28,9 @@ public function execute(PhutilArgumentParser $args) {
$resource_type = $args->getArg('type');
if (!$resource_type) {
throw new PhutilArgumentUsageException(
- 'Specify a resource type with `--type`.');
+ pht(
+ 'Specify a resource type with `%s`.',
+ '--type'));
}
$attributes = $args->getArg('attributes');
@@ -49,7 +51,7 @@ public function execute(PhutilArgumentParser $args) {
->queueForActivation()
->waitUntilActive();
- $console->writeOut("Acquired Lease %s\n", $lease->getID());
+ $console->writeOut("%s\n", pht('Acquired Lease %s', $lease->getID()));
return 0;
}
diff --git a/src/applications/drydock/management/DrydockManagementReleaseWorkflow.php b/src/applications/drydock/management/DrydockManagementReleaseWorkflow.php
index b59204695c..616a5deb7b 100644
--- a/src/applications/drydock/management/DrydockManagementReleaseWorkflow.php
+++ b/src/applications/drydock/management/DrydockManagementReleaseWorkflow.php
@@ -6,7 +6,7 @@ final class DrydockManagementReleaseWorkflow
protected function didConstruct() {
$this
->setName('release')
- ->setSynopsis('Release a lease.')
+ ->setSynopsis(pht('Release a lease.'))
->setArguments(
array(
array(
@@ -22,7 +22,7 @@ public function execute(PhutilArgumentParser $args) {
$ids = $args->getArg('ids');
if (!$ids) {
throw new PhutilArgumentUsageException(
- 'Specify one or more lease IDs to release.');
+ pht('Specify one or more lease IDs to release.'));
}
$viewer = $this->getViewer();
@@ -35,15 +35,15 @@ public function execute(PhutilArgumentParser $args) {
foreach ($ids as $id) {
$lease = idx($leases, $id);
if (!$lease) {
- $console->writeErr("Lease %d does not exist!\n", $id);
+ $console->writeErr("%s\n", pht('Lease %d does not exist!', $id));
} else if ($lease->getStatus() != DrydockLeaseStatus::STATUS_ACTIVE) {
- $console->writeErr("Lease %d is not 'active'!\n", $id);
+ $console->writeErr("%s\n", pht("Lease %d is not 'active'!", $id));
} else {
$resource = $lease->getResource();
$blueprint = $resource->getBlueprint();
$blueprint->releaseLease($resource, $lease);
- $console->writeErr("Released lease %d.\n", $id);
+ $console->writeErr("%s\n", pht('Released lease %d.', $id));
}
}
diff --git a/src/applications/drydock/storage/DrydockBlueprint.php b/src/applications/drydock/storage/DrydockBlueprint.php
index af258e0b1f..bad3f9a2dc 100644
--- a/src/applications/drydock/storage/DrydockBlueprint.php
+++ b/src/applications/drydock/storage/DrydockBlueprint.php
@@ -56,7 +56,9 @@ public function getImplementation() {
DrydockBlueprintImplementation::getAllBlueprintImplementations();
if (!isset($implementations[$class])) {
throw new Exception(
- "Invalid class name for blueprint (got '".$class."')");
+ pht(
+ "Invalid class name for blueprint (got '%s')",
+ $class));
}
return id(new $class())->attachInstance($this);
}
@@ -148,5 +150,4 @@ public function attachCustomFields(PhabricatorCustomFieldAttachment $fields) {
}
-
}
diff --git a/src/applications/drydock/storage/DrydockLease.php b/src/applications/drydock/storage/DrydockLease.php
index 252c922065..39fa59330c 100644
--- a/src/applications/drydock/storage/DrydockLease.php
+++ b/src/applications/drydock/storage/DrydockLease.php
@@ -100,7 +100,7 @@ public function loadResource() {
public function queueForActivation() {
if ($this->getID()) {
throw new Exception(
- 'Only new leases may be queued for activation!');
+ pht('Only new leases may be queued for activation!'));
}
$this->setStatus(DrydockLeaseStatus::STATUS_PENDING);
@@ -143,8 +143,9 @@ public function isActive() {
private function assertActive() {
if (!$this->isActive()) {
throw new Exception(
- 'Lease is not active! You can not interact with resources through '.
- 'an inactive lease.');
+ pht(
+ 'Lease is not active! You can not interact with resources through '.
+ 'an inactive lease.'));
}
}
@@ -164,16 +165,16 @@ public static function waitForLeases(array $leases) {
unset($unresolved[$key]);
break;
case DrydockLeaseStatus::STATUS_RELEASED:
- throw new Exception('Lease has already been released!');
+ throw new Exception(pht('Lease has already been released!'));
case DrydockLeaseStatus::STATUS_EXPIRED:
- throw new Exception('Lease has already expired!');
+ throw new Exception(pht('Lease has already expired!'));
case DrydockLeaseStatus::STATUS_BROKEN:
- throw new Exception('Lease has been broken!');
+ throw new Exception(pht('Lease has been broken!'));
case DrydockLeaseStatus::STATUS_PENDING:
case DrydockLeaseStatus::STATUS_ACQUIRING:
break;
default:
- throw new Exception('Unknown status??');
+ throw new Exception(pht('Unknown status??'));
}
}
diff --git a/src/applications/drydock/worker/DrydockAllocatorWorker.php b/src/applications/drydock/worker/DrydockAllocatorWorker.php
index 6d8e740e18..f9a647a3a8 100644
--- a/src/applications/drydock/worker/DrydockAllocatorWorker.php
+++ b/src/applications/drydock/worker/DrydockAllocatorWorker.php
@@ -39,7 +39,7 @@ private function logToDrydock($message) {
protected function doWork() {
$lease = $this->loadLease();
- $this->logToDrydock('Allocating Lease');
+ $this->logToDrydock(pht('Allocating Lease'));
try {
$this->allocateLease($lease);
@@ -147,8 +147,10 @@ private function allocateLease(DrydockLease $lease) {
$lease->save();
$this->logToDrydock(
- "There are no resources of type '{$type}' available, and no ".
- "blueprints which can allocate new ones.");
+ pht(
+ "There are no resources of type '%s' available, and no ".
+ "blueprints which can allocate new ones.",
+ $type));
return;
}
@@ -174,7 +176,7 @@ private function allocateLease(DrydockLease $lease) {
// and then switch them to "OPEN" only after the allocating lease gets
// its grubby mitts on the resource. This might make more sense but
// is a bit messy.
- throw new Exception('Lost an allocation race?');
+ throw new Exception(pht('Lost an allocation race?'));
}
}
diff --git a/src/applications/fact/controller/PhabricatorFactChartController.php b/src/applications/fact/controller/PhabricatorFactChartController.php
index 9b6a46b327..92718f47f8 100644
--- a/src/applications/fact/controller/PhabricatorFactChartController.php
+++ b/src/applications/fact/controller/PhabricatorFactChartController.php
@@ -32,7 +32,7 @@ public function processRequest() {
if (!$points) {
// NOTE: Raphael crashes Safari if you hand it series with no points.
- throw new Exception('No data to show!');
+ throw new Exception(pht('No data to show!'));
}
// Limit amount of data passed to browser.
diff --git a/src/applications/fact/daemon/PhabricatorFactDaemon.php b/src/applications/fact/daemon/PhabricatorFactDaemon.php
index 130bdcde17..d60a77de6a 100644
--- a/src/applications/fact/daemon/PhabricatorFactDaemon.php
+++ b/src/applications/fact/daemon/PhabricatorFactDaemon.php
@@ -15,7 +15,7 @@ protected function run() {
}
$this->processAggregates();
- $this->log('Zzz...');
+ $this->log(pht('Zzz...'));
$this->sleep(60 * 5);
}
}
@@ -35,7 +35,7 @@ public static function getAllApplicationIterators() {
}
public function processIteratorWithCursor($iterator_name, $iterator) {
- $this->log("Processing cursor '{$iterator_name}'.");
+ $this->log(pht("Processing cursor '%s'.", $iterator_name));
$cursor = id(new PhabricatorFactCursor())->loadOneWhere(
'name = %s',
@@ -73,7 +73,7 @@ public function processIterator($iterator) {
$raw_facts = array();
foreach ($iterator as $key => $object) {
$phid = $object->getPHID();
- $this->log("Processing {$phid}...");
+ $this->log(pht('Processing %s...', $phid));
$raw_facts[$phid] = $this->computeRawFacts($object);
if (count($raw_facts) > self::RAW_FACT_BUFFER_LIMIT) {
$this->updateRawFacts($raw_facts);
@@ -91,7 +91,7 @@ public function processIterator($iterator) {
}
public function processAggregates() {
- $this->log('Processing aggregates.');
+ $this->log(pht('Processing aggregates.'));
$facts = $this->computeAggregateFacts();
$this->updateAggregateFacts($facts);
diff --git a/src/applications/fact/engine/PhabricatorFactCountEngine.php b/src/applications/fact/engine/PhabricatorFactCountEngine.php
index 133e499267..f24068646d 100644
--- a/src/applications/fact/engine/PhabricatorFactCountEngine.php
+++ b/src/applications/fact/engine/PhabricatorFactCountEngine.php
@@ -10,9 +10,9 @@ public function getFactSpecs(array $fact_types) {
foreach ($fact_types as $type) {
if (!strncmp($type, '+N:', 3)) {
if ($type == '+N:*') {
- $name = 'Total Objects';
+ $name = pht('Total Objects');
} else {
- $name = 'Total Objects of type '.substr($type, 3);
+ $name = pht('Total Objects of type %s', substr($type, 3));
}
$results[] = id(new PhabricatorFactSimpleSpec($type))
@@ -22,9 +22,9 @@ public function getFactSpecs(array $fact_types) {
if (!strncmp($type, 'N:', 2)) {
if ($type == 'N:*') {
- $name = 'Objects';
+ $name = pht('Objects');
} else {
- $name = 'Objects of type '.substr($type, 2);
+ $name = pht('Objects of type %s', substr($type, 2));
}
$results[] = id(new PhabricatorFactSimpleSpec($type))
->setName($name)
diff --git a/src/applications/fact/engine/PhabricatorFactLastUpdatedEngine.php b/src/applications/fact/engine/PhabricatorFactLastUpdatedEngine.php
index 39e8781d51..5ea99e6232 100644
--- a/src/applications/fact/engine/PhabricatorFactLastUpdatedEngine.php
+++ b/src/applications/fact/engine/PhabricatorFactLastUpdatedEngine.php
@@ -10,7 +10,7 @@ public function getFactSpecs(array $fact_types) {
foreach ($fact_types as $type) {
if ($type == 'updated') {
$results[] = id(new PhabricatorFactSimpleSpec($type))
- ->setName('Facts Last Updated')
+ ->setName(pht('Facts Last Updated'))
->setUnit(PhabricatorFactSimpleSpec::UNIT_EPOCH);
}
}
diff --git a/src/applications/fact/extract/PhabricatorFactUpdateIterator.php b/src/applications/fact/extract/PhabricatorFactUpdateIterator.php
index 302026098a..df77f4dd33 100644
--- a/src/applications/fact/extract/PhabricatorFactUpdateIterator.php
+++ b/src/applications/fact/extract/PhabricatorFactUpdateIterator.php
@@ -2,7 +2,7 @@
/**
* Iterate over objects by update time in a stable way. This iterator only works
- * for "normal" Lisk objects: objects with an autoincrement ID and a
+ * for "normal" Lisk objects: objects with an auto-increment ID and a
* dateModified column.
*/
final class PhabricatorFactUpdateIterator extends PhutilBufferedIterator {
diff --git a/src/applications/fact/management/PhabricatorFactManagementAnalyzeWorkflow.php b/src/applications/fact/management/PhabricatorFactManagementAnalyzeWorkflow.php
index 461f87379f..6b316f8c75 100644
--- a/src/applications/fact/management/PhabricatorFactManagementAnalyzeWorkflow.php
+++ b/src/applications/fact/management/PhabricatorFactManagementAnalyzeWorkflow.php
@@ -13,15 +13,15 @@ protected function didConstruct() {
'name' => 'iterator',
'param' => 'name',
'repeat' => true,
- 'help' => 'Process only iterator __name__.',
+ 'help' => pht('Process only iterator __name__.'),
),
array(
'name' => 'all',
- 'help' => 'Analyze from the beginning, ignoring cursors.',
+ 'help' => pht('Analyze from the beginning, ignoring cursors.'),
),
array(
'name' => 'skip-aggregates',
- 'help' => 'Skip analysis of aggreate facts.',
+ 'help' => pht('Skip analysis of aggregate facts.'),
),
));
}
diff --git a/src/applications/fact/management/PhabricatorFactManagementCursorsWorkflow.php b/src/applications/fact/management/PhabricatorFactManagementCursorsWorkflow.php
index 590967bd32..74f35e3ccc 100644
--- a/src/applications/fact/management/PhabricatorFactManagementCursorsWorkflow.php
+++ b/src/applications/fact/management/PhabricatorFactManagementCursorsWorkflow.php
@@ -16,7 +16,7 @@ protected function didConstruct() {
'name' => 'reset',
'param' => 'cursor',
'repeat' => true,
- 'help' => 'Reset cursor __cursor__.',
+ 'help' => pht('Reset cursor __cursor__.'),
),
));
}
diff --git a/src/applications/fact/spec/PhabricatorFactSpec.php b/src/applications/fact/spec/PhabricatorFactSpec.php
index a0af2420cb..a9646b246a 100644
--- a/src/applications/fact/spec/PhabricatorFactSpec.php
+++ b/src/applications/fact/spec/PhabricatorFactSpec.php
@@ -33,8 +33,9 @@ public function getUnit() {
}
public function getName() {
- $type = $this->getType();
- return "Fact ({$type})";
+ return pht(
+ 'Fact (%s)',
+ $this->getType());
}
public function formatValueForDisplay(PhabricatorUser $user, $value) {
diff --git a/src/applications/feed/PhabricatorFeedStoryPublisher.php b/src/applications/feed/PhabricatorFeedStoryPublisher.php
index 79b3b6cd55..4e91be8521 100644
--- a/src/applications/feed/PhabricatorFeedStoryPublisher.php
+++ b/src/applications/feed/PhabricatorFeedStoryPublisher.php
@@ -74,21 +74,29 @@ public function setMailRecipientPHIDs(array $phids) {
public function publish() {
$class = $this->storyType;
if (!$class) {
- throw new Exception('Call setStoryType() before publishing!');
+ throw new Exception(
+ pht(
+ 'Call %s before publishing!',
+ 'setStoryType()'));
}
if (!class_exists($class)) {
throw new Exception(
- "Story type must be a valid class name and must subclass ".
- "PhabricatorFeedStory. ".
- "'{$class}' is not a loadable class.");
+ pht(
+ "Story type must be a valid class name and must subclass %s. ".
+ "'%s' is not a loadable class.",
+ 'PhabricatorFeedStory',
+ $class));
}
if (!is_subclass_of($class, 'PhabricatorFeedStory')) {
throw new Exception(
- "Story type must be a valid class name and must subclass ".
- "PhabricatorFeedStory. ".
- "'{$class}' is not a subclass of PhabricatorFeedStory.");
+ pht(
+ "Story type must be a valid class name and must subclass %s. ".
+ "'%s' is not a subclass of %s.",
+ 'PhabricatorFeedStory',
+ $class,
+ 'PhabricatorFeedStory'));
}
$chrono_key = $this->generateChronologicalKey();
@@ -139,7 +147,10 @@ public function publish() {
private function insertNotifications($chrono_key, array $subscribed_phids) {
if (!$this->primaryObjectPHID) {
throw new Exception(
- 'You must call setPrimaryObjectPHID() if you setSubscribedPHIDs()!');
+ pht(
+ 'You must call %s if you %s!',
+ 'setPrimaryObjectPHID()',
+ 'setSubscribedPHIDs()'));
}
$notif = new PhabricatorFeedStoryNotification();
diff --git a/src/applications/feed/builder/PhabricatorFeedBuilder.php b/src/applications/feed/builder/PhabricatorFeedBuilder.php
index 6f78b0dcfa..63ec420771 100644
--- a/src/applications/feed/builder/PhabricatorFeedBuilder.php
+++ b/src/applications/feed/builder/PhabricatorFeedBuilder.php
@@ -34,7 +34,7 @@ public function setNoDataString($string) {
public function buildView() {
if (!$this->user) {
- throw new Exception('Call setUser() before buildView()!');
+ throw new PhutilInvalidStateException('setUser');
}
$user = $this->user;
diff --git a/src/applications/feed/conduit/FeedPublishConduitAPIMethod.php b/src/applications/feed/conduit/FeedPublishConduitAPIMethod.php
index a082e36fea..5f83e73b3d 100644
--- a/src/applications/feed/conduit/FeedPublishConduitAPIMethod.php
+++ b/src/applications/feed/conduit/FeedPublishConduitAPIMethod.php
@@ -11,7 +11,7 @@ public function getMethodStatus() {
}
public function getMethodDescription() {
- return 'Publish a story to the feed.';
+ return pht('Publish a story to the feed.');
}
protected function defineParamTypes() {
diff --git a/src/applications/feed/conduit/FeedQueryConduitAPIMethod.php b/src/applications/feed/conduit/FeedQueryConduitAPIMethod.php
index 02efb83f73..661b70a7ab 100644
--- a/src/applications/feed/conduit/FeedQueryConduitAPIMethod.php
+++ b/src/applications/feed/conduit/FeedQueryConduitAPIMethod.php
@@ -11,7 +11,7 @@ public function getMethodStatus() {
}
public function getMethodDescription() {
- return 'Query the feed for stories';
+ return pht('Query the feed for stories');
}
private function getDefaultLimit() {
@@ -30,10 +30,10 @@ protected function defineParamTypes() {
private function getSupportedViewTypes() {
return array(
- 'html' => 'Full HTML presentation of story',
- 'data' => 'Dictionary with various data of the story',
- 'html-summary' => 'Story contains only the title of the story',
- 'text' => 'Simple one-line plain text representation of story',
+ 'html' => pht('Full HTML presentation of story'),
+ 'data' => pht('Dictionary with various data of the story'),
+ 'html-summary' => pht('Story contains only the title of the story'),
+ 'text' => pht('Simple one-line plain text representation of story'),
);
}
@@ -44,7 +44,9 @@ protected function defineErrorTypes() {
return array(
'ERR-UNKNOWN-TYPE' =>
- 'Unsupported view type, possibles are: '.$view_types,
+ pht(
+ 'Unsupported view type, possibles are: %s',
+ $view_types),
);
}
diff --git a/src/applications/feed/query/PhabricatorFeedQuery.php b/src/applications/feed/query/PhabricatorFeedQuery.php
index 4ee91859c0..b9c7d099aa 100644
--- a/src/applications/feed/query/PhabricatorFeedQuery.php
+++ b/src/applications/feed/query/PhabricatorFeedQuery.php
@@ -67,7 +67,8 @@ protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
$keys = $this->chronologicalKeys;
foreach ($keys as $key) {
if (!ctype_digit($key)) {
- throw new Exception("Key '{$key}' is not a valid chronological key!");
+ throw new Exception(
+ pht("Key '%s' is not a valid chronological key!", $key));
}
}
diff --git a/src/applications/feed/story/PhabricatorFeedStory.php b/src/applications/feed/story/PhabricatorFeedStory.php
index f94c2601e8..253757b8de 100644
--- a/src/applications/feed/story/PhabricatorFeedStory.php
+++ b/src/applications/feed/story/PhabricatorFeedStory.php
@@ -215,7 +215,7 @@ private function validateRenderingTarget($target) {
case PhabricatorApplicationTransaction::TARGET_TEXT:
break;
default:
- throw new Exception('Unknown rendering target: '.$target);
+ throw new Exception(pht('Unknown rendering target: %s', $target));
break;
}
}
@@ -229,7 +229,9 @@ public function getObject($phid) {
$object = idx($this->objects, $phid);
if (!$object) {
throw new Exception(
- "Story is asking for an object it did not request ('{$phid}')!");
+ pht(
+ "Story is asking for an object it did not request ('%s')!",
+ $phid));
}
return $object;
}
@@ -237,7 +239,7 @@ public function getObject($phid) {
public function getPrimaryObject() {
$phid = $this->getPrimaryObjectPHID();
if (!$phid) {
- throw new Exception('Story has no primary object!');
+ throw new Exception(pht('Story has no primary object!'));
}
return $this->getObject($phid);
}
@@ -308,7 +310,7 @@ final protected function getHandle($phid) {
$handle = new PhabricatorObjectHandle();
$handle->setPHID($phid);
- $handle->setName("Unloaded Object '{$phid}'");
+ $handle->setName(pht("Unloaded Object '%s'", $phid));
return $handle;
}
diff --git a/src/applications/feed/worker/FeedPushWorker.php b/src/applications/feed/worker/FeedPushWorker.php
index b406b76ee0..90407f6a75 100644
--- a/src/applications/feed/worker/FeedPushWorker.php
+++ b/src/applications/feed/worker/FeedPushWorker.php
@@ -13,7 +13,7 @@ protected function loadFeedStory() {
if (!$story) {
throw new PhabricatorWorkerPermanentFailureException(
- 'Feed story does not exist.');
+ pht('Feed story does not exist.'));
}
return $story;
diff --git a/src/applications/files/application/PhabricatorFilesApplication.php b/src/applications/files/application/PhabricatorFilesApplication.php
index ed4801ace6..b80a8e1ae4 100644
--- a/src/applications/files/application/PhabricatorFilesApplication.php
+++ b/src/applications/files/application/PhabricatorFilesApplication.php
@@ -59,8 +59,7 @@ public function getAppEmailBlurb() {
protected function getCustomCapabilities() {
return array(
FilesDefaultViewCapability::CAPABILITY => array(
- 'caption' => pht(
- 'Default view policy for newly created files.'),
+ 'caption' => pht('Default view policy for newly created files.'),
),
);
}
diff --git a/src/applications/files/conduit/FileConduitAPIMethod.php b/src/applications/files/conduit/FileConduitAPIMethod.php
index 2419303218..420ed65bfb 100644
--- a/src/applications/files/conduit/FileConduitAPIMethod.php
+++ b/src/applications/files/conduit/FileConduitAPIMethod.php
@@ -74,8 +74,7 @@ protected function loadFileChunkForUpload(
if ($chunk->getDataFilePHID()) {
throw new Exception(
- pht(
- 'Chunk has already been uploaded.'));
+ pht('Chunk has already been uploaded.'));
}
return $chunk;
diff --git a/src/applications/files/conduit/FileDownloadConduitAPIMethod.php b/src/applications/files/conduit/FileDownloadConduitAPIMethod.php
index 67e9d1f25c..3a3867ac9e 100644
--- a/src/applications/files/conduit/FileDownloadConduitAPIMethod.php
+++ b/src/applications/files/conduit/FileDownloadConduitAPIMethod.php
@@ -7,7 +7,7 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return 'Download a file from the server.';
+ return pht('Download a file from the server.');
}
protected function defineParamTypes() {
@@ -22,7 +22,7 @@ protected function defineReturnType() {
protected function defineErrorTypes() {
return array(
- 'ERR-BAD-PHID' => 'No such file exists.',
+ 'ERR-BAD-PHID' => pht('No such file exists.'),
);
}
diff --git a/src/applications/files/conduit/FileInfoConduitAPIMethod.php b/src/applications/files/conduit/FileInfoConduitAPIMethod.php
index 7b8cecbdf1..5f1bb6e936 100644
--- a/src/applications/files/conduit/FileInfoConduitAPIMethod.php
+++ b/src/applications/files/conduit/FileInfoConduitAPIMethod.php
@@ -7,7 +7,7 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return 'Get information about a file.';
+ return pht('Get information about a file.');
}
protected function defineParamTypes() {
@@ -23,7 +23,7 @@ protected function defineReturnType() {
protected function defineErrorTypes() {
return array(
- 'ERR-NOT-FOUND' => 'No such file exists.',
+ 'ERR-NOT-FOUND' => pht('No such file exists.'),
);
}
diff --git a/src/applications/files/conduit/FileUploadConduitAPIMethod.php b/src/applications/files/conduit/FileUploadConduitAPIMethod.php
index 594b53bcce..ac93b7d39a 100644
--- a/src/applications/files/conduit/FileUploadConduitAPIMethod.php
+++ b/src/applications/files/conduit/FileUploadConduitAPIMethod.php
@@ -7,7 +7,7 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return 'Upload a file to the server.';
+ return pht('Upload a file to the server.');
}
protected function defineParamTypes() {
diff --git a/src/applications/files/conduit/FileUploadHashConduitAPIMethod.php b/src/applications/files/conduit/FileUploadHashConduitAPIMethod.php
index 2ab13dc350..135e018a2f 100644
--- a/src/applications/files/conduit/FileUploadHashConduitAPIMethod.php
+++ b/src/applications/files/conduit/FileUploadHashConduitAPIMethod.php
@@ -8,7 +8,7 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return 'Upload a file to the server using content hash.';
+ return pht('Upload a file to the server using content hash.');
}
protected function defineParamTypes() {
diff --git a/src/applications/files/config/PhabricatorFilesConfigOptions.php b/src/applications/files/config/PhabricatorFilesConfigOptions.php
index 7f18da3e99..e9d899f658 100644
--- a/src/applications/files/config/PhabricatorFilesConfigOptions.php
+++ b/src/applications/files/config/PhabricatorFilesConfigOptions.php
@@ -101,35 +101,37 @@ public function getOptions() {
pht('Configure which MIME types are viewable in the browser.'))
->setDescription(
pht(
- 'Configure which uploaded file types may be viewed directly '.
- 'in the browser. Other file types will be downloaded instead '.
- 'of displayed. This is mainly a usability consideration, since '.
- 'browsers tend to freak out when viewing enormous binary files.'.
+ "Configure which uploaded file types may be viewed directly ".
+ "in the browser. Other file types will be downloaded instead ".
+ "of displayed. This is mainly a usability consideration, since ".
+ "browsers tend to freak out when viewing enormous binary files.".
"\n\n".
- 'The keys in this map are vieweable MIME types; the values are '.
- 'the MIME types they are delivered as when they are viewed in '.
- 'the browser.')),
+ "The keys in this map are viewable MIME types; the values are ".
+ "the MIME types they are delivered as when they are viewed in ".
+ "the browser.")),
$this->newOption('files.image-mime-types', 'set', $image_default)
->setLocked(true)
->setSummary(pht('Configure which MIME types are images.'))
->setDescription(
pht(
- 'List of MIME types which can be used as the `src` for an '.
- '`` tag.')),
+ 'List of MIME types which can be used as the `%s` for an `%s` tag.',
+ 'src',
+ '')),
$this->newOption('files.audio-mime-types', 'set', $audio_default)
->setLocked(true)
->setSummary(pht('Configure which MIME types are audio.'))
->setDescription(
pht(
- 'List of MIME types which can be used to render an '.
- '`` tag.')),
+ 'List of MIME types which can be used to render an `%s` tag.',
+ '')),
$this->newOption('files.icon-mime-types', 'wild', $icon_default)
->setLocked(true)
->setSummary(pht('Configure which MIME types map to which icons.'))
->setDescription(
pht(
'Map of MIME type to icon name. MIME types which can not be '.
- 'found default to icon `doc_files`.')),
+ 'found default to icon `%s`.',
+ 'doc_files')),
$this->newOption('storage.mysql-engine.max-size', 'int', 1000000)
->setSummary(
pht(
@@ -156,20 +158,6 @@ public function getOptions() {
"Set this to a valid Amazon S3 bucket to store files there. You ".
"must also configure S3 access keys in the 'Amazon Web Services' ".
"group.")),
- $this->newOption(
- 'metamta.files.public-create-email',
- 'string',
- null)
- ->setLocked(true)
- ->setLockedMessage(pht(
- 'This configuration is deprecated. See description for details.'))
- ->setSummary(pht('DEPRECATED - Allow uploaded files via email.'))
- ->setDescription(
- pht(
- 'This config has been deprecated in favor of [[ '.
- '/applications/view/PhabricatorFilesApplication/ | '.
- 'application settings ]], which allow for multiple email '.
- 'addresses and other functionality.')),
$this->newOption(
'metamta.files.subject-prefix',
'string',
@@ -185,8 +173,9 @@ public function getOptions() {
pht(
'This option will use Imagemagick to rescale images, so animated '.
'GIFs can be thumbnailed and set as profile pictures. Imagemagick '.
- 'must be installed and the "convert" binary must be available to '.
- 'the webserver for this to work.')),
+ 'must be installed and the "%s" binary must be available to '.
+ 'the webserver for this to work.',
+ 'convert')),
);
}
diff --git a/src/applications/files/controller/PhabricatorFileDeleteController.php b/src/applications/files/controller/PhabricatorFileDeleteController.php
index 17be9f2ff2..ed245c5cba 100644
--- a/src/applications/files/controller/PhabricatorFileDeleteController.php
+++ b/src/applications/files/controller/PhabricatorFileDeleteController.php
@@ -37,11 +37,13 @@ public function processRequest() {
$dialog = new AphrontDialogView();
$dialog->setUser($user);
- $dialog->setTitle('Really delete file?');
+ $dialog->setTitle(pht('Really delete file?'));
$dialog->appendChild(hsprintf(
- "
Permanently delete '%s'? This action can not be undone.
',
+ pht(
+ "Permanently delete '%s'? This action can not be undone.",
+ $file->getName())));
+ $dialog->addSubmitButton(pht('Delete'));
$dialog->addCancelButton($file->getInfoURI());
return id(new AphrontDialogResponse())->setDialog($dialog);
diff --git a/src/applications/files/controller/PhabricatorFileTransformController.php b/src/applications/files/controller/PhabricatorFileTransformController.php
index 0e7e2b73d7..77676c1b55 100644
--- a/src/applications/files/controller/PhabricatorFileTransformController.php
+++ b/src/applications/files/controller/PhabricatorFileTransformController.php
@@ -30,11 +30,7 @@ public function handleRequest(AphrontRequest $request) {
}
$transform = $request->getURIData('transform');
- $xform = id(new PhabricatorTransformedFile())
- ->loadOneWhere(
- 'originalPHID = %s AND transform = %s',
- $source_phid,
- $transform);
+ $xform = $this->loadTransform($source_phid, $transform);
if ($xform) {
if ($is_regenerate) {
@@ -80,8 +76,20 @@ public function handleRequest(AphrontRequest $request) {
$xform = id(new PhabricatorTransformedFile())
->setOriginalPHID($source_phid)
->setTransform($transform)
- ->setTransformedPHID($xformed_file->getPHID())
- ->save();
+ ->setTransformedPHID($xformed_file->getPHID());
+
+ try {
+ $xform->save();
+ } catch (AphrontDuplicateKeyQueryException $ex) {
+ // If we collide when saving, we've raced another endpoint which was
+ // transforming the same file. Just throw our work away and use that
+ // transform instead.
+ $this->destroyTransform($xform);
+ $xform = $this->loadTransform($source_phid, $transform);
+ if (!$xform) {
+ return new Aphront404Response();
+ }
+ }
return $this->buildTransformedFileResponse($xform);
}
@@ -113,7 +121,9 @@ private function destroyTransform(PhabricatorTransformedFile $xform) {
$unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
if (!$file) {
- $xform->delete();
+ if ($xform->getID()) {
+ $xform->delete();
+ }
} else {
$engine->destroyObject($file);
}
@@ -121,4 +131,11 @@ private function destroyTransform(PhabricatorTransformedFile $xform) {
unset($unguarded);
}
+ private function loadTransform($source_phid, $transform) {
+ return id(new PhabricatorTransformedFile())->loadOneWhere(
+ 'originalPHID = %s AND transform = %s',
+ $source_phid,
+ $transform);
+ }
+
}
diff --git a/src/applications/files/engine/PhabricatorLocalDiskFileStorageEngine.php b/src/applications/files/engine/PhabricatorLocalDiskFileStorageEngine.php
index 617247bdac..d9f7caf123 100644
--- a/src/applications/files/engine/PhabricatorLocalDiskFileStorageEngine.php
+++ b/src/applications/files/engine/PhabricatorLocalDiskFileStorageEngine.php
@@ -102,8 +102,10 @@ private function getLocalDiskFileStorageRoot() {
if (!$root || $root == '/' || $root[0] != '/') {
throw new PhabricatorFileStorageConfigurationException(
- "Malformed local disk storage root. You must provide an absolute ".
- "path, and can not use '/' as the root.");
+ pht(
+ "Malformed local disk storage root. You must provide an absolute ".
+ "path, and can not use '%s' as the root.",
+ '/'));
}
return rtrim($root, '/');
@@ -123,7 +125,9 @@ private function getLocalDiskFileStorageFullPath($handle) {
// we're only accessing local storage just in case.
if (!preg_match('@^[a-f0-9]{2}/[a-f0-9]{2}/[a-f0-9]{28}\z@', $handle)) {
throw new Exception(
- "Local disk filesystem handle '{$handle}' is malformed!");
+ pht(
+ "Local disk filesystem handle '%s' is malformed!",
+ $handle));
}
$root = $this->getLocalDiskFileStorageRoot();
return $root.'/'.$handle;
diff --git a/src/applications/files/engine/PhabricatorMySQLFileStorageEngine.php b/src/applications/files/engine/PhabricatorMySQLFileStorageEngine.php
index b4c46702eb..eb49ef78c3 100644
--- a/src/applications/files/engine/PhabricatorMySQLFileStorageEngine.php
+++ b/src/applications/files/engine/PhabricatorMySQLFileStorageEngine.php
@@ -87,7 +87,7 @@ public function deleteFile($handle) {
private function loadFromMySQLFileStorage($handle) {
$blob = id(new PhabricatorFileStorageBlob())->load($handle);
if (!$blob) {
- throw new Exception("Unable to load MySQL blob file '{$handle}'!");
+ throw new Exception(pht("Unable to load MySQL blob file '%s'!", $handle));
}
return $blob;
}
diff --git a/src/applications/files/engine/PhabricatorS3FileStorageEngine.php b/src/applications/files/engine/PhabricatorS3FileStorageEngine.php
index 93ca00c138..59446c2c13 100644
--- a/src/applications/files/engine/PhabricatorS3FileStorageEngine.php
+++ b/src/applications/files/engine/PhabricatorS3FileStorageEngine.php
@@ -136,7 +136,9 @@ private function getBucketName() {
$bucket = PhabricatorEnv::getEnvConfig('storage.s3.bucket');
if (!$bucket) {
throw new PhabricatorFileStorageConfigurationException(
- "No 'storage.s3.bucket' specified!");
+ pht(
+ "No '%s' specified!",
+ 'storage.s3.bucket'));
}
return $bucket;
}
@@ -157,7 +159,10 @@ private function newS3API() {
if (!$access_key || !$secret_key) {
throw new PhabricatorFileStorageConfigurationException(
- "Specify 'amazon-s3.access-key' and 'amazon-s3.secret-key'!");
+ pht(
+ "Specify '%s' and '%s'!",
+ 'amazon-s3.access-key',
+ 'amazon-s3.secret-key'));
}
if ($endpoint !== null) {
diff --git a/src/applications/files/engine/PhabricatorTestStorageEngine.php b/src/applications/files/engine/PhabricatorTestStorageEngine.php
index 243d179045..72e68dc7c7 100644
--- a/src/applications/files/engine/PhabricatorTestStorageEngine.php
+++ b/src/applications/files/engine/PhabricatorTestStorageEngine.php
@@ -39,7 +39,7 @@ public function readFile($handle) {
if (isset(self::$storage[$handle])) {
return self::$storage[$handle];
}
- throw new Exception("No such file with handle '{$handle}'!");
+ throw new Exception(pht("No such file with handle '%s'!", $handle));
}
public function deleteFile($handle) {
diff --git a/src/applications/files/exception/PhabricatorFileUploadException.php b/src/applications/files/exception/PhabricatorFileUploadException.php
index 59d24ed29c..095565793f 100644
--- a/src/applications/files/exception/PhabricatorFileUploadException.php
+++ b/src/applications/files/exception/PhabricatorFileUploadException.php
@@ -4,25 +4,26 @@ final class PhabricatorFileUploadException extends Exception {
public function __construct($code) {
$map = array(
- UPLOAD_ERR_INI_SIZE =>
- pht("Uploaded file is too large: current limit is %s. To adjust ".
- "this limit change 'upload_max_filesize' in php.ini.",
- ini_get('upload_max_filesize')),
- UPLOAD_ERR_FORM_SIZE =>
- 'File is too large.',
- UPLOAD_ERR_PARTIAL =>
- 'File was only partially transferred, upload did not complete.',
- UPLOAD_ERR_NO_FILE =>
- 'No file was uploaded.',
- UPLOAD_ERR_NO_TMP_DIR =>
- 'Unable to write file: temporary directory does not exist.',
- UPLOAD_ERR_CANT_WRITE =>
- 'Unable to write file: failed to write to temporary directory.',
- UPLOAD_ERR_EXTENSION =>
- 'Unable to upload: a PHP extension stopped the upload.',
+ 'UPLOAD_ERR_INI_SIZE' => pht(
+ "Uploaded file is too large: current limit is %s. To adjust ".
+ "this limit change '%s' in php.ini.",
+ ini_get('upload_max_filesize'),
+ 'upload_max_filesize'),
+ 'UPLOAD_ERR_FORM_SIZE' => pht(
+ 'File is too large.'),
+ 'UPLOAD_ERR_PARTIAL' => pht(
+ 'File was only partially transferred, upload did not complete.'),
+ 'UPLOAD_ERR_NO_FILE' => pht(
+ 'No file was uploaded.'),
+ 'UPLOAD_ERR_NO_TMP_DIR' => pht(
+ 'Unable to write file: temporary directory does not exist.'),
+ 'UPLOAD_ERR_CANT_WRITE' => pht(
+ 'Unable to write file: failed to write to temporary directory.'),
+ 'UPLOAD_ERR_EXTENSION' => pht(
+ 'Unable to upload: a PHP extension stopped the upload.'),
);
- $message = idx($map, $code, 'Upload failed: unknown error.');
+ $message = idx($map, $code, pht('Upload failed: unknown error.'));
parent::__construct($message, $code);
}
}
diff --git a/src/applications/files/mail/FileCreateMailReceiver.php b/src/applications/files/mail/FileCreateMailReceiver.php
index 9f0fcc157c..fa9c6691e7 100644
--- a/src/applications/files/mail/FileCreateMailReceiver.php
+++ b/src/applications/files/mail/FileCreateMailReceiver.php
@@ -20,7 +20,8 @@ protected function processReceivedMail(
if (empty($attachment_phids)) {
throw new PhabricatorMetaMTAReceivedMailProcessingException(
MetaMTAReceivedMailStatus::STATUS_UNHANDLED_EXCEPTION,
- 'Ignoring email to create files that did not include attachments.');
+ pht(
+ 'Ignoring email to create files that did not include attachments.'));
}
$first_phid = head($attachment_phids);
$mail->setRelatedPHID($first_phid);
diff --git a/src/applications/files/mail/FileMailReceiver.php b/src/applications/files/mail/FileMailReceiver.php
index 05cb788ef5..cdad22c5ce 100644
--- a/src/applications/files/mail/FileMailReceiver.php
+++ b/src/applications/files/mail/FileMailReceiver.php
@@ -3,8 +3,8 @@
final class FileMailReceiver extends PhabricatorObjectMailReceiver {
public function isEnabled() {
- $app_class = 'PhabricatorFilesApplication';
- return PhabricatorApplication::isClassInstalled($app_class);
+ return PhabricatorApplication::isClassInstalled(
+ 'PhabricatorFilesApplication');
}
protected function getObjectPattern() {
diff --git a/src/applications/files/mail/FileReplyHandler.php b/src/applications/files/mail/FileReplyHandler.php
index b21c487e14..7cdfb886c5 100644
--- a/src/applications/files/mail/FileReplyHandler.php
+++ b/src/applications/files/mail/FileReplyHandler.php
@@ -5,7 +5,7 @@ final class FileReplyHandler
public function validateMailReceiver($mail_receiver) {
if (!($mail_receiver instanceof PhabricatorFile)) {
- throw new Exception('Mail receiver is not a PhabricatorFile.');
+ throw new Exception(pht('Mail receiver is not a %s.', 'PhabricatorFile'));
}
}
diff --git a/src/applications/files/management/PhabricatorFilesManagementCatWorkflow.php b/src/applications/files/management/PhabricatorFilesManagementCatWorkflow.php
index 896165f585..98efd2dee9 100644
--- a/src/applications/files/management/PhabricatorFilesManagementCatWorkflow.php
+++ b/src/applications/files/management/PhabricatorFilesManagementCatWorkflow.php
@@ -6,8 +6,7 @@ final class PhabricatorFilesManagementCatWorkflow
protected function didConstruct() {
$this
->setName('cat')
- ->setSynopsis(
- pht('Print the contents of a file.'))
+ ->setSynopsis(pht('Print the contents of a file.'))
->setArguments(
array(
array(
@@ -33,10 +32,10 @@ public function execute(PhutilArgumentParser $args) {
$names = $args->getArg('names');
if (count($names) > 1) {
throw new PhutilArgumentUsageException(
- pht('Specify exactly one file to print, like "F123".'));
+ pht('Specify exactly one file to print, like "%s".', 'F123'));
} else if (!$names) {
throw new PhutilArgumentUsageException(
- pht('Specify a file to print, like "F123".'));
+ pht('Specify a file to print, like "%s".', 'F123'));
}
$file = head($this->loadFilesWithNames($names));
diff --git a/src/applications/files/management/PhabricatorFilesManagementCompactWorkflow.php b/src/applications/files/management/PhabricatorFilesManagementCompactWorkflow.php
index b885f2613b..0c8e7153e5 100644
--- a/src/applications/files/management/PhabricatorFilesManagementCompactWorkflow.php
+++ b/src/applications/files/management/PhabricatorFilesManagementCompactWorkflow.php
@@ -34,8 +34,9 @@ public function execute(PhutilArgumentParser $args) {
if (!$iterator) {
throw new PhutilArgumentUsageException(
pht(
- 'Either specify a list of files to compact, or use `--all` '.
- 'to compact all files.'));
+ 'Either specify a list of files to compact, or use `%s` '.
+ 'to compact all files.',
+ '--all'));
}
$is_dry_run = $args->getArg('dry-run');
diff --git a/src/applications/files/management/PhabricatorFilesManagementEnginesWorkflow.php b/src/applications/files/management/PhabricatorFilesManagementEnginesWorkflow.php
index 579fd7e3ba..ede95a1f28 100644
--- a/src/applications/files/management/PhabricatorFilesManagementEnginesWorkflow.php
+++ b/src/applications/files/management/PhabricatorFilesManagementEnginesWorkflow.php
@@ -6,7 +6,7 @@ final class PhabricatorFilesManagementEnginesWorkflow
protected function didConstruct() {
$this
->setName('engines')
- ->setSynopsis('List available storage engines.')
+ ->setSynopsis(pht('List available storage engines.'))
->setArguments(array());
}
@@ -15,7 +15,7 @@ public function execute(PhutilArgumentParser $args) {
$engines = PhabricatorFile::buildAllEngines();
if (!$engines) {
- throw new Exception('No storage engines are available.');
+ throw new Exception(pht('No storage engines are available.'));
}
foreach ($engines as $engine) {
diff --git a/src/applications/files/management/PhabricatorFilesManagementMigrateWorkflow.php b/src/applications/files/management/PhabricatorFilesManagementMigrateWorkflow.php
index 5201465be4..ce48d29bb0 100644
--- a/src/applications/files/management/PhabricatorFilesManagementMigrateWorkflow.php
+++ b/src/applications/files/management/PhabricatorFilesManagementMigrateWorkflow.php
@@ -6,21 +6,21 @@ final class PhabricatorFilesManagementMigrateWorkflow
protected function didConstruct() {
$this
->setName('migrate')
- ->setSynopsis('Migrate files between storage engines.')
+ ->setSynopsis(pht('Migrate files between storage engines.'))
->setArguments(
array(
array(
'name' => 'engine',
'param' => 'storage_engine',
- 'help' => 'Migrate to the named storage engine.',
+ 'help' => pht('Migrate to the named storage engine.'),
),
array(
'name' => 'dry-run',
- 'help' => 'Show what would be migrated.',
+ 'help' => pht('Show what would be migrated.'),
),
array(
'name' => 'all',
- 'help' => 'Migrate all files.',
+ 'help' => pht('Migrate all files.'),
),
array(
'name' => 'names',
@@ -35,8 +35,11 @@ public function execute(PhutilArgumentParser $args) {
$engine_id = $args->getArg('engine');
if (!$engine_id) {
throw new PhutilArgumentUsageException(
- 'Specify an engine to migrate to with `--engine`. '.
- 'Use `files engines` to get a list of engines.');
+ pht(
+ 'Specify an engine to migrate to with `%s`. '.
+ 'Use `%s` to get a list of engines.',
+ '--engine',
+ 'files engines'));
}
$engine = PhabricatorFile::buildEngine($engine_id);
@@ -44,8 +47,10 @@ public function execute(PhutilArgumentParser $args) {
$iterator = $this->buildIterator($args);
if (!$iterator) {
throw new PhutilArgumentUsageException(
- 'Either specify a list of files to migrate, or use `--all` '.
- 'to migrate all files.');
+ pht(
+ 'Either specify a list of files to migrate, or use `%s` '.
+ 'to migrate all files.',
+ '--all'));
}
$is_dry_run = $args->getArg('dry-run');
@@ -57,39 +62,45 @@ public function execute(PhutilArgumentParser $args) {
if ($file->getStorageEngine() == $engine_id) {
$console->writeOut(
- "%s: Already stored on '%s'\n",
- $fid,
- $engine_id);
+ "%s\n",
+ pht(
+ "%s: Already stored on '%s'",
+ $fid,
+ $engine_id));
continue;
}
if ($is_dry_run) {
$console->writeOut(
- "%s: Would migrate from '%s' to '%s' (dry run)\n",
- $fid,
- $file->getStorageEngine(),
- $engine_id);
+ "%s\n",
+ pht(
+ "%s: Would migrate from '%s' to '%s' (dry run)",
+ $fid,
+ $file->getStorageEngine(),
+ $engine_id));
continue;
}
$console->writeOut(
- "%s: Migrating from '%s' to '%s'...",
- $fid,
- $file->getStorageEngine(),
- $engine_id);
+ "%s\n",
+ pht(
+ "%s: Migrating from '%s' to '%s'...",
+ $fid,
+ $file->getStorageEngine(),
+ $engine_id));
try {
$file->migrateToEngine($engine);
- $console->writeOut("done.\n");
+ $console->writeOut("%s\n", pht('Done.'));
} catch (Exception $ex) {
- $console->writeOut("failed!\n");
+ $console->writeOut("%s\n", pht('Failed!'));
$console->writeErr("%s\n", (string)$ex);
$failed[] = $file;
}
}
if ($failed) {
- $console->writeOut("**Failures!**\n");
+ $console->writeOut("**%s**\n", pht('Failures!'));
$ids = array();
foreach ($failed as $file) {
$ids[] = 'F'.$file->getID();
@@ -98,7 +109,7 @@ public function execute(PhutilArgumentParser $args) {
return 1;
} else {
- $console->writeOut("**Success!**\n");
+ $console->writeOut("**%s**\n", pht('Success!'));
return 0;
}
}
diff --git a/src/applications/files/management/PhabricatorFilesManagementPurgeWorkflow.php b/src/applications/files/management/PhabricatorFilesManagementPurgeWorkflow.php
index 3f08c76623..bf2c04a584 100644
--- a/src/applications/files/management/PhabricatorFilesManagementPurgeWorkflow.php
+++ b/src/applications/files/management/PhabricatorFilesManagementPurgeWorkflow.php
@@ -6,16 +6,16 @@ final class PhabricatorFilesManagementPurgeWorkflow
protected function didConstruct() {
$this
->setName('purge')
- ->setSynopsis('Delete files with missing data.')
+ ->setSynopsis(pht('Delete files with missing data.'))
->setArguments(
array(
array(
'name' => 'all',
- 'help' => 'Update all files.',
+ 'help' => pht('Update all files.'),
),
array(
'name' => 'dry-run',
- 'help' => 'Show what would be updated.',
+ 'help' => pht('Show what would be updated.'),
),
array(
'name' => 'names',
@@ -30,8 +30,10 @@ public function execute(PhutilArgumentParser $args) {
$iterator = $this->buildIterator($args);
if (!$iterator) {
throw new PhutilArgumentUsageException(
- 'Either specify a list of files to purge, or use `--all` '.
- 'to purge all files.');
+ pht(
+ 'Either specify a list of files to purge, or use `%s` '.
+ 'to purge all files.',
+ '--all'));
}
$is_dry_run = $args->getArg('dry-run');
@@ -48,17 +50,17 @@ public function execute(PhutilArgumentParser $args) {
if ($okay) {
$console->writeOut(
- "%s: File data is OK, not purging.\n",
- $fid);
+ "%s\n",
+ pht('%s: File data is OK, not purging.', $fid));
} else {
if ($is_dry_run) {
$console->writeOut(
- "%s: Would purge (dry run).\n",
- $fid);
+ "%s\n",
+ pht('%s: Would purge (dry run).', $fid));
} else {
$console->writeOut(
- "%s: Purging.\n",
- $fid);
+ "%s\n",
+ pht('%s: Purging.', $fid));
$file->delete();
}
}
diff --git a/src/applications/files/management/PhabricatorFilesManagementRebuildWorkflow.php b/src/applications/files/management/PhabricatorFilesManagementRebuildWorkflow.php
index 95a3ea0567..f7fc890ae4 100644
--- a/src/applications/files/management/PhabricatorFilesManagementRebuildWorkflow.php
+++ b/src/applications/files/management/PhabricatorFilesManagementRebuildWorkflow.php
@@ -6,24 +6,24 @@ final class PhabricatorFilesManagementRebuildWorkflow
protected function didConstruct() {
$this
->setName('rebuild')
- ->setSynopsis('Rebuild metadata of old files.')
+ ->setSynopsis(pht('Rebuild metadata of old files.'))
->setArguments(
array(
array(
'name' => 'all',
- 'help' => 'Update all files.',
+ 'help' => pht('Update all files.'),
),
array(
'name' => 'dry-run',
- 'help' => 'Show what would be updated.',
+ 'help' => pht('Show what would be updated.'),
),
array(
'name' => 'rebuild-mime',
- 'help' => 'Rebuild MIME information.',
+ 'help' => pht('Rebuild MIME information.'),
),
array(
'name' => 'rebuild-dimensions',
- 'help' => 'Rebuild image dimension information.',
+ 'help' => pht('Rebuild image dimension information.'),
),
array(
'name' => 'names',
@@ -38,8 +38,10 @@ public function execute(PhutilArgumentParser $args) {
$iterator = $this->buildIterator($args);
if (!$iterator) {
throw new PhutilArgumentUsageException(
- 'Either specify a list of files to update, or use `--all` '.
- 'to update all files.');
+ pht(
+ 'Either specify a list of files to update, or use `%s` '.
+ 'to update all files.',
+ '--all'));
}
$update = array(
@@ -68,22 +70,28 @@ public function execute(PhutilArgumentParser $args) {
if ($new_type == $file->getMimeType()) {
$console->writeOut(
- "%s: Mime type not changed (%s).\n",
- $fid,
- $new_type);
+ "%s\n",
+ pht(
+ '%s: Mime type not changed (%s).',
+ $fid,
+ $new_type));
} else {
if ($is_dry_run) {
$console->writeOut(
- "%s: Would update Mime type: '%s' -> '%s'.\n",
- $fid,
- $file->getMimeType(),
- $new_type);
+ "%s\n",
+ pht(
+ "%s: Would update Mime type: '%s' -> '%s'.",
+ $fid,
+ $file->getMimeType(),
+ $new_type));
} else {
$console->writeOut(
- "%s: Updating Mime type: '%s' -> '%s'.\n",
- $fid,
- $file->getMimeType(),
- $new_type);
+ "%s\n",
+ pht(
+ "%s: Updating Mime type: '%s' -> '%s'.",
+ $fid,
+ $file->getMimeType(),
+ $new_type));
$file->setMimeType($new_type);
$file->save();
}
@@ -93,8 +101,8 @@ public function execute(PhutilArgumentParser $args) {
if ($update['dimensions']) {
if (!$file->isViewableImage()) {
$console->writeOut(
- "%s: Not an image file.\n",
- $fid);
+ "%s\n",
+ pht('%s: Not an image file.', $fid));
continue;
}
@@ -103,27 +111,26 @@ public function execute(PhutilArgumentParser $args) {
$image_height = idx($metadata, PhabricatorFile::METADATA_IMAGE_HEIGHT);
if ($image_width && $image_height) {
$console->writeOut(
- "%s: Image dimensions already exist.\n",
- $fid);
+ "%s\n",
+ pht('%s: Image dimensions already exist.', $fid));
continue;
}
if ($is_dry_run) {
$console->writeOut(
- "%s: Would update file dimensions (dry run)\n",
- $fid);
+ "%s\n",
+ pht('%s: Would update file dimensions (dry run)', $fid));
continue;
}
$console->writeOut(
- '%s: Updating metadata... ',
- $fid);
+ pht('%s: Updating metadata... ', $fid));
try {
$file->updateDimensions();
- $console->writeOut("done.\n");
+ $console->writeOut("%s\n", pht('Done.'));
} catch (Exception $ex) {
- $console->writeOut("failed!\n");
+ $console->writeOut("%s\n", pht('Failed!'));
$console->writeErr("%s\n", (string)$ex);
$failed[] = $file;
}
@@ -131,7 +138,7 @@ public function execute(PhutilArgumentParser $args) {
}
if ($failed) {
- $console->writeOut("**Failures!**\n");
+ $console->writeOut("**%s**\n", pht('Failures!'));
$ids = array();
foreach ($failed as $file) {
$ids[] = 'F'.$file->getID();
@@ -140,7 +147,7 @@ public function execute(PhutilArgumentParser $args) {
return 1;
} else {
- $console->writeOut("**Success!**\n");
+ $console->writeOut("**%s**\n", pht('Success!'));
return 0;
}
diff --git a/src/applications/files/management/PhabricatorFilesManagementWorkflow.php b/src/applications/files/management/PhabricatorFilesManagementWorkflow.php
index d0bff01c7c..e94fa1d96a 100644
--- a/src/applications/files/management/PhabricatorFilesManagementWorkflow.php
+++ b/src/applications/files/management/PhabricatorFilesManagementWorkflow.php
@@ -9,7 +9,9 @@ protected function buildIterator(PhutilArgumentParser $args) {
if ($args->getArg('all')) {
if ($names) {
throw new PhutilArgumentUsageException(
- 'Specify either a list of files or `--all`, but not both.');
+ pht(
+ 'Specify either a list of files or `%s`, but not both.',
+ '--all'));
}
return new LiskMigrationIterator(new PhabricatorFile());
}
@@ -33,7 +35,9 @@ protected function loadFilesWithNames(array $names) {
foreach ($names as $name) {
if (empty($files[$name])) {
throw new PhutilArgumentUsageException(
- "No file '{$name}' exists!");
+ pht(
+ "No file '%s' exists!",
+ $name));
}
}
diff --git a/src/applications/files/markup/PhabricatorEmbedFileRemarkupRule.php b/src/applications/files/markup/PhabricatorEmbedFileRemarkupRule.php
index 5ffb70be7f..138465a633 100644
--- a/src/applications/files/markup/PhabricatorEmbedFileRemarkupRule.php
+++ b/src/applications/files/markup/PhabricatorEmbedFileRemarkupRule.php
@@ -136,9 +136,9 @@ private function renderImageFile(
'class' => $image_class,
'sigil' => 'lightboxable',
'meta' => array(
- 'phid' => $file->getPHID(),
- 'uri' => $file->getBestURI(),
- 'dUri' => $file->getDownloadURI(),
+ 'phid' => $file->getPHID(),
+ 'uri' => $file->getBestURI(),
+ 'dUri' => $file->getDownloadURI(),
'viewable' => true,
),
),
diff --git a/src/applications/files/query/PhabricatorFileQuery.php b/src/applications/files/query/PhabricatorFileQuery.php
index aa4e0be16c..594dd60983 100644
--- a/src/applications/files/query/PhabricatorFileQuery.php
+++ b/src/applications/files/query/PhabricatorFileQuery.php
@@ -84,8 +84,11 @@ public function withTransforms(array $specs) {
empty($spec['originalPHID']) ||
empty($spec['transform'])) {
throw new Exception(
- "Transform specification must be a dictionary with keys ".
- "'originalPHID' and 'transform'!");
+ pht(
+ "Transform specification must be a dictionary with keys ".
+ "'%s' and '%s'!",
+ 'originalPHID',
+ 'transform'));
}
}
diff --git a/src/applications/files/storage/PhabricatorFile.php b/src/applications/files/storage/PhabricatorFile.php
index c236a2368e..d60107ee6d 100644
--- a/src/applications/files/storage/PhabricatorFile.php
+++ b/src/applications/files/storage/PhabricatorFile.php
@@ -142,7 +142,7 @@ public function getMonogram() {
public static function readUploadedFileData($spec) {
if (!$spec) {
- throw new Exception('No file was uploaded!');
+ throw new Exception(pht('No file was uploaded!'));
}
$err = idx($spec, 'error');
@@ -153,14 +153,14 @@ public static function readUploadedFileData($spec) {
$tmp_name = idx($spec, 'tmp_name');
$is_valid = @is_uploaded_file($tmp_name);
if (!$is_valid) {
- throw new Exception('File is not an uploaded file.');
+ throw new Exception(pht('File is not an uploaded file.'));
}
$file_data = Filesystem::readFile($tmp_name);
$file_size = idx($spec, 'size');
if (strlen($file_data) != $file_size) {
- throw new Exception('File size disagrees with uploaded size.');
+ throw new Exception(pht('File size disagrees with uploaded size.'));
}
return $file_data;
@@ -347,7 +347,7 @@ private static function buildFromFileData($data, array $params = array()) {
if (!$data_handle) {
throw new PhutilAggregateException(
- 'All storage engines failed to write file:',
+ pht('All storage engines failed to write file:'),
$exceptions);
}
@@ -394,7 +394,7 @@ public static function newFromFileData($data, array $params = array()) {
public function migrateToEngine(PhabricatorFileStorageEngine $engine) {
if (!$this->getID() || !$this->getStorageHandle()) {
throw new Exception(
- "You can not migrate a file which hasn't yet been saved.");
+ pht("You can not migrate a file which hasn't yet been saved."));
}
$data = $this->loadFileData();
@@ -435,17 +435,23 @@ private function writeToEngine(
if (!$data_handle || strlen($data_handle) > 255) {
// This indicates an improperly implemented storage engine.
throw new PhabricatorFileStorageConfigurationException(
- "Storage engine '{$engine_class}' executed writeFile() but did ".
- "not return a valid handle ('{$data_handle}') to the data: it ".
- "must be nonempty and no longer than 255 characters.");
+ pht(
+ "Storage engine '%s' executed %s but did not return a valid ".
+ "handle ('%s') to the data: it must be nonempty and no longer ".
+ "than 255 characters.",
+ $engine_class,
+ 'writeFile()',
+ $data_handle));
}
$engine_identifier = $engine->getEngineIdentifier();
if (!$engine_identifier || strlen($engine_identifier) > 32) {
throw new PhabricatorFileStorageConfigurationException(
- "Storage engine '{$engine_class}' returned an improper engine ".
- "identifier '{$engine_identifier}': it must be nonempty ".
- "and no longer than 32 characters.");
+ pht(
+ "Storage engine '%s' returned an improper engine identifier '{%s}': ".
+ "it must be nonempty and no longer than 32 characters.",
+ $engine_class,
+ $engine_identifier));
}
return array($engine_identifier, $data_handle);
@@ -525,8 +531,7 @@ public static function newFromFileDownload($uri, array $params = array()) {
if (isset($redirects[$location])) {
throw new Exception(
- pht(
- 'Encountered loop while following redirects.'));
+ pht('Encountered loop while following redirects.'));
}
$redirects[$location] = $location;
@@ -663,7 +668,7 @@ public function loadFileData() {
$data = $data;
break;
default:
- throw new Exception('Unknown storage format.');
+ throw new Exception(pht('Unknown storage format.'));
}
return $data;
@@ -686,7 +691,7 @@ public function getFileDataIterator($begin = null, $end = null) {
public function getViewURI() {
if (!$this->getPHID()) {
throw new Exception(
- 'You must save a file before you can generate a view URI.');
+ pht('You must save a file before you can generate a view URI.'));
}
return $this->getCDNURI(null);
@@ -736,7 +741,7 @@ private function getCDNURI($token) {
public function getCDNURIWithToken() {
if (!$this->getPHID()) {
throw new Exception(
- 'You must save a file before you can generate a CDN URI.');
+ pht('You must save a file before you can generate a CDN URI.'));
}
return $this->getCDNURI($this->generateOneTimeToken());
@@ -836,7 +841,7 @@ public function isTransformableImage() {
return function_exists('imagegif');
break;
default:
- throw new Exception('Unknown type matched as image MIME type.');
+ throw new Exception(pht('Unknown type matched as image MIME type.'));
}
}
@@ -871,7 +876,9 @@ public static function buildEngine($engine_identifier) {
}
throw new Exception(
- "Storage engine '{$engine_identifier}' could not be located!");
+ pht(
+ "Storage engine '%s' could not be located!",
+ $engine_identifier));
}
public static function buildAllEngines() {
@@ -915,21 +922,18 @@ public function generateSecretKey() {
public function updateDimensions($save = true) {
if (!$this->isViewableImage()) {
- throw new Exception(
- 'This file is not a viewable image.');
+ throw new Exception(pht('This file is not a viewable image.'));
}
if (!function_exists('imagecreatefromstring')) {
- throw new Exception(
- 'Cannot retrieve image information.');
+ throw new Exception(pht('Cannot retrieve image information.'));
}
$data = $this->loadFileData();
$img = imagecreatefromstring($data);
if ($img === false) {
- throw new Exception(
- 'Error when decoding image.');
+ throw new Exception(pht('Error when decoding image.'));
}
$this->metadata[self::METADATA_IMAGE_WIDTH] = imagesx($img);
@@ -999,13 +1003,13 @@ public static function loadBuiltins(PhabricatorUser $user, array $names) {
// This is just a sanity check to prevent loading arbitrary files.
if (basename($name) != $name) {
- throw new Exception("Invalid builtin name '{$name}'!");
+ throw new Exception(pht("Invalid builtin name '%s'!", $name));
}
$path = $root.$name;
if (!Filesystem::pathExists($path)) {
- throw new Exception("Builtin '{$path}' does not exist!");
+ throw new Exception(pht("Builtin '%s' does not exist!", $path));
}
$data = Filesystem::readFile($path);
diff --git a/src/applications/files/view/PhabricatorGlobalUploadTargetView.php b/src/applications/files/view/PhabricatorGlobalUploadTargetView.php
index 3624f2a73f..3e0690815c 100644
--- a/src/applications/files/view/PhabricatorGlobalUploadTargetView.php
+++ b/src/applications/files/view/PhabricatorGlobalUploadTargetView.php
@@ -57,6 +57,6 @@ public function render() {
'class' => 'phabricator-global-upload-instructions',
'style' => 'display: none;',
),
- pht("\xE2\x87\xAA Drop Files to Upload"));
+ "\xE2\x87\xAA ".pht('Drop Files to Upload'));
}
}
diff --git a/src/applications/flag/conduit/FlagDeleteConduitAPIMethod.php b/src/applications/flag/conduit/FlagDeleteConduitAPIMethod.php
index 6634fa7769..de6d98d7f0 100644
--- a/src/applications/flag/conduit/FlagDeleteConduitAPIMethod.php
+++ b/src/applications/flag/conduit/FlagDeleteConduitAPIMethod.php
@@ -7,7 +7,7 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return 'Clear a flag.';
+ return pht('Clear a flag.');
}
protected function defineParamTypes() {
@@ -23,9 +23,9 @@ protected function defineReturnType() {
protected function defineErrorTypes() {
return array(
- 'ERR_NOT_FOUND' => 'Bad flag ID.',
- 'ERR_WRONG_USER' => 'You are not the creator of this flag.',
- 'ERR_NEED_PARAM' => 'Must pass an id or an objectPHID.',
+ 'ERR_NOT_FOUND' => pht('Bad flag ID.'),
+ 'ERR_WRONG_USER' => pht('You are not the creator of this flag.'),
+ 'ERR_NEED_PARAM' => pht('Must pass an id or an objectPHID.'),
);
}
diff --git a/src/applications/flag/conduit/FlagEditConduitAPIMethod.php b/src/applications/flag/conduit/FlagEditConduitAPIMethod.php
index 5a07cdeb9d..3bc0d7e29e 100644
--- a/src/applications/flag/conduit/FlagEditConduitAPIMethod.php
+++ b/src/applications/flag/conduit/FlagEditConduitAPIMethod.php
@@ -7,7 +7,7 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return 'Create or modify a flag.';
+ return pht('Create or modify a flag.');
}
protected function defineParamTypes() {
diff --git a/src/applications/flag/conduit/FlagQueryConduitAPIMethod.php b/src/applications/flag/conduit/FlagQueryConduitAPIMethod.php
index 486a5afa9c..0658093e43 100644
--- a/src/applications/flag/conduit/FlagQueryConduitAPIMethod.php
+++ b/src/applications/flag/conduit/FlagQueryConduitAPIMethod.php
@@ -7,7 +7,7 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return 'Query flag markers.';
+ return pht('Query flag markers.');
}
protected function defineParamTypes() {
diff --git a/src/applications/flag/query/PhabricatorFlagQuery.php b/src/applications/flag/query/PhabricatorFlagQuery.php
index 0b1902f6f1..ff154a512b 100644
--- a/src/applications/flag/query/PhabricatorFlagQuery.php
+++ b/src/applications/flag/query/PhabricatorFlagQuery.php
@@ -115,7 +115,8 @@ protected function willFilterPage(array $flags) {
case self::GROUP_NONE:
break;
default:
- throw new Exception("Unknown groupBy parameter: $this->groupBy");
+ throw new Exception(
+ pht('Unknown groupBy parameter: %s', $this->groupBy));
break;
}
diff --git a/src/applications/fund/editor/FundInitiativeEditor.php b/src/applications/fund/editor/FundInitiativeEditor.php
index 679e1b5771..fc07c472ba 100644
--- a/src/applications/fund/editor/FundInitiativeEditor.php
+++ b/src/applications/fund/editor/FundInitiativeEditor.php
@@ -126,7 +126,7 @@ protected function applyCustomExternalTransaction(
->withPHIDs(array($xaction->getNewValue()))
->executeOne();
if (!$backer) {
- throw new Exception(pht('Unable to load FundBacker!'));
+ throw new Exception(pht('Unable to load %s!', 'FundBacker'));
}
$subx = array();
diff --git a/src/applications/fund/mail/FundInitiativeReplyHandler.php b/src/applications/fund/mail/FundInitiativeReplyHandler.php
index 4ff1816bbd..0c236c239b 100644
--- a/src/applications/fund/mail/FundInitiativeReplyHandler.php
+++ b/src/applications/fund/mail/FundInitiativeReplyHandler.php
@@ -5,7 +5,7 @@ final class FundInitiativeReplyHandler
public function validateMailReceiver($mail_receiver) {
if (!($mail_receiver instanceof FundInitiative)) {
- throw new Exception('Mail receiver is not a FundInitiative!');
+ throw new Exception(pht('Mail receiver is not a %s!', 'FundInitiative'));
}
}
diff --git a/src/applications/fund/phortune/FundBackerProduct.php b/src/applications/fund/phortune/FundBackerProduct.php
index cc13200639..79ffc559bb 100644
--- a/src/applications/fund/phortune/FundBackerProduct.php
+++ b/src/applications/fund/phortune/FundBackerProduct.php
@@ -86,7 +86,7 @@ public function didPurchaseProduct(
->withPHIDs(array($purchase->getMetadataValue('backerPHID')))
->executeOne();
if (!$backer) {
- throw new Exception(pht('Unable to load FundBacker!'));
+ throw new Exception(pht('Unable to load %s!', 'FundBacker'));
}
// Load the actual backing user -- they may not be the curent viewer if this
@@ -124,7 +124,7 @@ public function didRefundProduct(
->withPHIDs(array($purchase->getMetadataValue('backerPHID')))
->executeOne();
if (!$backer) {
- throw new Exception(pht('Unable to load FundBacker!'));
+ throw new Exception(pht('Unable to load %s!', 'FundBacker'));
}
$xactions = array();
diff --git a/src/applications/fund/search/FundInitiativeIndexer.php b/src/applications/fund/search/FundInitiativeIndexer.php
index a5be183980..7816af04bd 100644
--- a/src/applications/fund/search/FundInitiativeIndexer.php
+++ b/src/applications/fund/search/FundInitiativeIndexer.php
@@ -13,7 +13,10 @@ protected function loadDocumentByPHID($phid) {
->withPHIDs(array($phid))
->executeOne();
if (!$object) {
- throw new Exception("Unable to load object by phid '{$phid}'!");
+ throw new Exception(
+ pht(
+ "Unable to load object by PHID '%s'!",
+ $phid));
}
return $object;
}
diff --git a/src/applications/fund/storage/FundInitiative.php b/src/applications/fund/storage/FundInitiative.php
index ac73401cff..6acc19f5fc 100644
--- a/src/applications/fund/storage/FundInitiative.php
+++ b/src/applications/fund/storage/FundInitiative.php
@@ -143,8 +143,7 @@ public function hasAutomaticCapability($capability, PhabricatorUser $viewer) {
}
public function describeAutomaticCapability($capability) {
- return pht(
- 'The owner of an initiative can always view and edit it.');
+ return pht('The owner of an initiative can always view and edit it.');
}
diff --git a/src/applications/harbormaster/controller/HarbormasterBuildActionController.php b/src/applications/harbormaster/controller/HarbormasterBuildActionController.php
index 5b0c84e105..133ba27fa8 100644
--- a/src/applications/harbormaster/controller/HarbormasterBuildActionController.php
+++ b/src/applications/harbormaster/controller/HarbormasterBuildActionController.php
@@ -86,8 +86,7 @@ public function processRequest() {
'This build is already restarting. You can not reissue a '.
'restart command to a restarting build.');
} else {
- $body = pht(
- 'You can not restart this build.');
+ $body = pht('You can not restart this build.');
}
}
break;
diff --git a/src/applications/harbormaster/controller/HarbormasterBuildViewController.php b/src/applications/harbormaster/controller/HarbormasterBuildViewController.php
index 9fd6b0d2ef..4af1f34276 100644
--- a/src/applications/harbormaster/controller/HarbormasterBuildViewController.php
+++ b/src/applications/harbormaster/controller/HarbormasterBuildViewController.php
@@ -183,7 +183,7 @@ public function processRequest() {
}
$properties = new PHUIPropertyListView();
- $properties->addProperty('Build Target ID', $build_target->getID());
+ $properties->addProperty(pht('Build Target ID'), $build_target->getID());
$target_box->addPropertyList($properties, pht('Metadata'));
$targets[] = $target_box;
@@ -528,6 +528,4 @@ private function buildMessages(array $messages) {
return $table;
}
-
-
}
diff --git a/src/applications/harbormaster/controller/HarbormasterPlanEditController.php b/src/applications/harbormaster/controller/HarbormasterPlanEditController.php
index c291f4e678..8679d9ce4c 100644
--- a/src/applications/harbormaster/controller/HarbormasterPlanEditController.php
+++ b/src/applications/harbormaster/controller/HarbormasterPlanEditController.php
@@ -75,7 +75,7 @@ public function processRequest() {
->setUser($viewer)
->appendChild(
id(new AphrontFormTextControl())
- ->setLabel('Plan Name')
+ ->setLabel(pht('Plan Name'))
->setName('name')
->setError($e_name)
->setValue($v_name));
diff --git a/src/applications/harbormaster/controller/HarbormasterPlanViewController.php b/src/applications/harbormaster/controller/HarbormasterPlanViewController.php
index c6fd4a1155..7447f2ed7b 100644
--- a/src/applications/harbormaster/controller/HarbormasterPlanViewController.php
+++ b/src/applications/harbormaster/controller/HarbormasterPlanViewController.php
@@ -437,7 +437,7 @@ private function buildDependsOnList(
$icon_label = pht('Missing Dependency');
$has_conflicts = true;
$error = pht(
- 'This dependency specifies a build step which doesn\'t exist.');
+ "This dependency specifies a build step which doesn't exist.");
} else {
$bound = phutil_tag(
'strong',
diff --git a/src/applications/harbormaster/controller/HarbormasterStepDeleteController.php b/src/applications/harbormaster/controller/HarbormasterStepDeleteController.php
index 228304e738..c0df595fad 100644
--- a/src/applications/harbormaster/controller/HarbormasterStepDeleteController.php
+++ b/src/applications/harbormaster/controller/HarbormasterStepDeleteController.php
@@ -22,7 +22,7 @@ public function processRequest() {
->withIDs(array($id))
->executeOne();
if ($step === null) {
- throw new Exception('Build step not found!');
+ throw new Exception(pht('Build step not found!'));
}
$plan_id = $step->getBuildPlan()->getID();
@@ -43,8 +43,8 @@ public function processRequest() {
'p',
array(),
pht(
- 'Are you sure you want to delete this '.
- 'step? This can\'t be undone!')));
+ "Are you sure you want to delete this step? ".
+ "This can't be undone!")));
return id(new AphrontDialogResponse())->setDialog($dialog);
}
diff --git a/src/applications/harbormaster/controller/HarbormasterStepEditController.php b/src/applications/harbormaster/controller/HarbormasterStepEditController.php
index ef9289a7c8..c753bd2181 100644
--- a/src/applications/harbormaster/controller/HarbormasterStepEditController.php
+++ b/src/applications/harbormaster/controller/HarbormasterStepEditController.php
@@ -213,8 +213,9 @@ private function renderBuildVariablesTable() {
$rows = array();
$rows[] = pht(
- 'The following variables can be used in most fields. To reference '.
- 'a variable, use `${name}` in a field.');
+ 'The following variables can be used in most fields. '.
+ 'To reference a variable, use `%s` in a field.',
+ '${name}');
$rows[] = pht('| Variable | Description |');
$rows[] = '|---|---|';
foreach ($variables as $name => $description) {
diff --git a/src/applications/harbormaster/editor/HarbormasterBuildTransactionEditor.php b/src/applications/harbormaster/editor/HarbormasterBuildTransactionEditor.php
index 0d9d26c6aa..6c59622f90 100644
--- a/src/applications/harbormaster/editor/HarbormasterBuildTransactionEditor.php
+++ b/src/applications/harbormaster/editor/HarbormasterBuildTransactionEditor.php
@@ -78,7 +78,7 @@ private function executeBuildCommand(
$issuable = $build->canResumeBuild();
break;
default:
- throw new Exception("Unknown command $command");
+ throw new Exception(pht('Unknown command %s', $command));
}
if (!$issuable) {
diff --git a/src/applications/harbormaster/management/HarbormasterManagementBuildWorkflow.php b/src/applications/harbormaster/management/HarbormasterManagementBuildWorkflow.php
index e7d6adb54f..86b8596fe3 100644
--- a/src/applications/harbormaster/management/HarbormasterManagementBuildWorkflow.php
+++ b/src/applications/harbormaster/management/HarbormasterManagementBuildWorkflow.php
@@ -11,9 +11,9 @@ protected function didConstruct() {
->setArguments(
array(
array(
- 'name' => 'plan',
- 'param' => 'id',
- 'help' => pht('ID of build plan to run.'),
+ 'name' => 'plan',
+ 'param' => 'id',
+ 'help' => pht('ID of build plan to run.'),
),
array(
'name' => 'buildable',
@@ -50,7 +50,9 @@ public function execute(PhutilArgumentParser $args) {
$plan_id = $args->getArg('plan');
if (!$plan_id) {
throw new PhutilArgumentUsageException(
- pht('Use --plan to specify a build plan to run.'));
+ pht(
+ 'Use %s to specify a build plan to run.',
+ '--plan'));
}
$plan = id(new HarbormasterBuildPlanQuery())
diff --git a/src/applications/harbormaster/step/HarbormasterCommandBuildStepImplementation.php b/src/applications/harbormaster/step/HarbormasterCommandBuildStepImplementation.php
index 14fc65a76c..5dbfd80262 100644
--- a/src/applications/harbormaster/step/HarbormasterCommandBuildStepImplementation.php
+++ b/src/applications/harbormaster/step/HarbormasterCommandBuildStepImplementation.php
@@ -130,8 +130,8 @@ public function getFieldSpecifications() {
'type' => 'text',
'required' => true,
'caption' => pht(
- 'Under Windows, this is executed under PowerShell.'.
- 'Under UNIX, this is executed using the user\'s shell.'),
+ "Under Windows, this is executed under PowerShell. ".
+ "Under UNIX, this is executed using the user's shell."),
),
'hostartifact' => array(
'name' => pht('Host'),
diff --git a/src/applications/harbormaster/step/HarbormasterWaitForPreviousBuildStepImplementation.php b/src/applications/harbormaster/step/HarbormasterWaitForPreviousBuildStepImplementation.php
index d3e4e92525..288cb1b1fa 100644
--- a/src/applications/harbormaster/step/HarbormasterWaitForPreviousBuildStepImplementation.php
+++ b/src/applications/harbormaster/step/HarbormasterWaitForPreviousBuildStepImplementation.php
@@ -42,7 +42,7 @@ public function execute(
$blockers = $this->getBlockers($object, $plan, $build);
if ($blockers) {
$log->start();
- $log->append("Blocked by: ".implode(',', $blockers)."\n");
+ $log->append(pht("Blocked by: %s\n", implode(',', $blockers)));
$log->finalize();
}
diff --git a/src/applications/harbormaster/storage/build/HarbormasterBuild.php b/src/applications/harbormaster/storage/build/HarbormasterBuild.php
index 38216c5b9b..5ca60bb323 100644
--- a/src/applications/harbormaster/storage/build/HarbormasterBuild.php
+++ b/src/applications/harbormaster/storage/build/HarbormasterBuild.php
@@ -250,7 +250,7 @@ public function loadArtifact($name) {
array($name))
->executeOne();
if ($artifact === null) {
- throw new Exception('Artifact not found!');
+ throw new Exception(pht('Artifact not found!'));
}
return $artifact;
}
diff --git a/src/applications/harbormaster/storage/build/HarbormasterBuildArtifact.php b/src/applications/harbormaster/storage/build/HarbormasterBuildArtifact.php
index e5bcb7c9ba..47df26131c 100644
--- a/src/applications/harbormaster/storage/build/HarbormasterBuildArtifact.php
+++ b/src/applications/harbormaster/storage/build/HarbormasterBuildArtifact.php
@@ -96,7 +96,9 @@ public function getObjectItemView(PhabricatorUser $viewer) {
public function loadDrydockLease() {
if ($this->getArtifactType() !== self::TYPE_HOST) {
throw new Exception(
- '`loadDrydockLease` may only be called on host artifacts.');
+ pht(
+ '`%s` may only be called on host artifacts.',
+ __FUNCTION__));
}
$data = $this->getArtifactData();
@@ -106,12 +108,12 @@ public function loadDrydockLease() {
$lease = id(new DrydockLease())->load(
$data['drydock-lease']);
if ($lease === null) {
- throw new Exception('Associated Drydock lease not found!');
+ throw new Exception(pht('Associated Drydock lease not found!'));
}
$resource = id(new DrydockResource())->load(
$lease->getResourceID());
if ($resource === null) {
- throw new Exception('Associated Drydock resource not found!');
+ throw new Exception(pht('Associated Drydock resource not found!'));
}
$lease->attachResource($resource);
@@ -121,7 +123,9 @@ public function loadDrydockLease() {
public function loadPhabricatorFile() {
if ($this->getArtifactType() !== self::TYPE_FILE) {
throw new Exception(
- '`loadPhabricatorFile` may only be called on file artifacts.');
+ pht(
+ '`%s` may only be called on file artifacts.',
+ __FUNCTION__));
}
$data = $this->getArtifactData();
@@ -134,7 +138,7 @@ public function loadPhabricatorFile() {
->withPHIDs(array($phid))
->executeOne();
if ($file === null) {
- throw new Exception('Associated file not found!');
+ throw new Exception(pht('Associated file not found!'));
}
return $file;
}
@@ -178,8 +182,7 @@ public function hasAutomaticCapability($capability, PhabricatorUser $viewer) {
}
public function describeAutomaticCapability($capability) {
- return pht(
- 'Users must be able to see a buildable to see its artifacts.');
+ return pht('Users must be able to see a buildable to see its artifacts.');
}
}
diff --git a/src/applications/harbormaster/storage/build/HarbormasterBuildLog.php b/src/applications/harbormaster/storage/build/HarbormasterBuildLog.php
index a40554cbea..d03f588719 100644
--- a/src/applications/harbormaster/storage/build/HarbormasterBuildLog.php
+++ b/src/applications/harbormaster/storage/build/HarbormasterBuildLog.php
@@ -68,7 +68,8 @@ public function getName() {
public function start() {
if ($this->getLive()) {
- throw new Exception('Live logging has already started for this log.');
+ throw new Exception(
+ pht('Live logging has already started for this log.'));
}
$this->setLive(1);
@@ -79,7 +80,8 @@ public function start() {
public function append($content) {
if (!$this->getLive()) {
- throw new Exception('Start logging before appending data to the log.');
+ throw new Exception(
+ pht('Start logging before appending data to the log.'));
}
if (strlen($content) === 0) {
return;
@@ -143,7 +145,7 @@ public function append($content) {
public function finalize($start = 0) {
if (!$this->getLive()) {
- throw new Exception('Start logging before finalizing it.');
+ throw new Exception(pht('Start logging before finalizing it.'));
}
// TODO: Encode the log contents in a gzipped format.
@@ -201,7 +203,7 @@ public function hasAutomaticCapability($capability, PhabricatorUser $viewer) {
public function describeAutomaticCapability($capability) {
return pht(
- 'Users must be able to see a build target to view it\'s build log.');
+ "Users must be able to see a build target to view it's build log.");
}
diff --git a/src/applications/herald/adapter/HeraldAdapter.php b/src/applications/herald/adapter/HeraldAdapter.php
index ca52b8da15..f494ad95fc 100644
--- a/src/applications/herald/adapter/HeraldAdapter.php
+++ b/src/applications/herald/adapter/HeraldAdapter.php
@@ -42,7 +42,6 @@ abstract class HeraldAdapter {
const FIELD_APPLICATION_EMAIL = 'applicaton-email';
const FIELD_TASK_PRIORITY = 'taskpriority';
const FIELD_TASK_STATUS = 'taskstatus';
- const FIELD_ARCANIST_PROJECT = 'arcanist-project';
const FIELD_PUSHER_IS_COMMITTER = 'pusher-is-committer';
const FIELD_PATH = 'path';
@@ -100,7 +99,6 @@ abstract class HeraldAdapter {
const VALUE_BUILD_PLAN = 'buildplan';
const VALUE_TASK_PRIORITY = 'taskpriority';
const VALUE_TASK_STATUS = 'taskstatus';
- const VALUE_ARCANIST_PROJECT = 'arcanistprojects';
const VALUE_LEGAL_DOCUMENTS = 'legaldocuments';
const VALUE_APPLICATION_EMAIL = 'applicationemail';
@@ -139,8 +137,10 @@ public function getCustomActions() {
if (array_key_exists($key, $this->customActions)) {
throw new Exception(
- 'More than one Herald custom action implementation '.
- 'handles the action key: \''.$key.'\'.');
+ pht(
+ "More than one Herald custom action implementation ".
+ "handles the action key: '%s'.",
+ $key));
}
$this->customActions[$key] = $action;
@@ -163,7 +163,10 @@ public function getIsNewObject() {
return $this->isNewObject;
}
- throw new Exception(pht('You must setIsNewObject to a boolean first!'));
+ throw new Exception(
+ pht(
+ 'You must %s to a boolean first!',
+ 'setIsNewObject()'));
}
public function setIsNewObject($new) {
$this->isNewObject = (bool)$new;
@@ -206,8 +209,7 @@ public function getHeraldField($field_name) {
return $this->getCustomFieldValue($field_name);
}
- throw new Exception(
- "Unknown field '{$field_name}'!");
+ throw new Exception(pht("Unknown field '%s'!", $field_name));
}
}
@@ -381,7 +383,6 @@ public function getFieldNameMap() {
self::FIELD_APPLICATION_EMAIL => pht('Receiving email address'),
self::FIELD_TASK_PRIORITY => pht('Task priority'),
self::FIELD_TASK_STATUS => pht('Task status'),
- self::FIELD_ARCANIST_PROJECT => pht('Arcanist Project'),
self::FIELD_PUSHER_IS_COMMITTER => pht('Pusher same as committer'),
self::FIELD_PATH => pht('Path'),
) + $this->getCustomFieldNameMap();
@@ -437,7 +438,6 @@ public function getConditionsForField($field) {
case self::FIELD_PUSHER:
case self::FIELD_TASK_PRIORITY:
case self::FIELD_TASK_STATUS:
- case self::FIELD_ARCANIST_PROJECT:
return array(
self::CONDITION_IS_ANY,
self::CONDITION_IS_NOT_ANY,
@@ -536,7 +536,9 @@ public function getConditionsForField($field) {
return $this->getCustomFieldConditions($field);
}
throw new Exception(
- "This adapter does not define conditions for field '{$field}'!");
+ pht(
+ "This adapter does not define conditions for field '%s'!",
+ $field));
}
}
@@ -572,25 +574,25 @@ public function doesConditionMatch(
case self::CONDITION_IS_ANY:
if (!is_array($condition_value)) {
throw new HeraldInvalidConditionException(
- 'Expected condition value to be an array.');
+ pht('Expected condition value to be an array.'));
}
$condition_value = array_fuse($condition_value);
return isset($condition_value[$field_value]);
case self::CONDITION_IS_NOT_ANY:
if (!is_array($condition_value)) {
throw new HeraldInvalidConditionException(
- 'Expected condition value to be an array.');
+ pht('Expected condition value to be an array.'));
}
$condition_value = array_fuse($condition_value);
return !isset($condition_value[$field_value]);
case self::CONDITION_INCLUDE_ALL:
if (!is_array($field_value)) {
throw new HeraldInvalidConditionException(
- 'Object produced non-array value!');
+ pht('Object produced non-array value!'));
}
if (!is_array($condition_value)) {
throw new HeraldInvalidConditionException(
- 'Expected condition value to be an array.');
+ pht('Expected condition value to be an array.'));
}
$have = array_select_keys(array_fuse($field_value), $condition_value);
@@ -621,7 +623,7 @@ public function doesConditionMatch(
$result = @preg_match($condition_value.'S', $value);
if ($result === false) {
throw new HeraldInvalidConditionException(
- 'Regular expression is not valid!');
+ pht('Regular expression is not valid!'));
}
if ($result) {
return true;
@@ -652,13 +654,13 @@ public function doesConditionMatch(
$key_matches = @preg_match($key_regexp, $key);
if ($key_matches === false) {
throw new HeraldInvalidConditionException(
- 'First regular expression is invalid!');
+ pht('First regular expression is invalid!'));
}
if ($key_matches) {
$value_matches = @preg_match($value_regexp, $value);
if ($value_matches === false) {
throw new HeraldInvalidConditionException(
- 'Second regular expression is invalid!');
+ pht('Second regular expression is invalid!'));
}
if ($value_matches) {
return true;
@@ -671,7 +673,7 @@ public function doesConditionMatch(
$rule = $engine->getRule($condition_value);
if (!$rule) {
throw new HeraldInvalidConditionException(
- 'Condition references a rule which does not exist!');
+ pht('Condition references a rule which does not exist!'));
}
$is_not = ($condition_type == self::CONDITION_NOT_RULE);
@@ -686,7 +688,7 @@ public function doesConditionMatch(
return (($condition_value & $field_value) !== (int)$condition_value);
default:
throw new HeraldInvalidConditionException(
- "Unknown condition '{$condition_type}'.");
+ pht("Unknown condition '%s'.", $condition_type));
}
}
@@ -846,7 +848,7 @@ public function getActionNameMap($rule_type) {
);
break;
default:
- throw new Exception("Unknown rule type '{$rule_type}'!");
+ throw new Exception(pht("Unknown rule type '%s'!", $rule_type));
}
$custom_actions = $this->getCustomActionsForRuleType($rule_type);
@@ -940,8 +942,6 @@ public function getValueTypeForFieldAndCondition($field, $condition) {
return self::VALUE_TASK_PRIORITY;
case self::FIELD_TASK_STATUS:
return self::VALUE_TASK_STATUS;
- case self::FIELD_ARCANIST_PROJECT:
- return self::VALUE_ARCANIST_PROJECT;
default:
return self::VALUE_USER;
}
@@ -984,7 +984,7 @@ public function getValueTypeForFieldAndCondition($field, $condition) {
case self::CONDITION_NOT_RULE:
return self::VALUE_RULE;
default:
- throw new Exception("Unknown condition '{$condition}'.");
+ throw new Exception(pht("Unknown condition '%s'.", $condition));
}
}
@@ -1041,7 +1041,7 @@ public function getValueTypeForAction($action, $rule_type) {
return $custom_action->getActionType();
}
- throw new Exception("Unknown or invalid action '".$action."'.");
+ throw new Exception(pht("Unknown or invalid action '%s'.", $action));
}
@@ -1197,7 +1197,15 @@ private function renderActionAsText(
$rule_global = HeraldRuleTypeConfig::RULE_TYPE_GLOBAL;
$action_type = $action->getAction();
- $action_name = idx($this->getActionNameMap($rule_global), $action_type);
+
+ $default = $this->isHeraldCustomKey($action_type)
+ ? pht('(Unknown Custom Action "%s") equals', $action_type)
+ : pht('(Unknown Action "%s") equals', $action_type);
+
+ $action_name = idx(
+ $this->getActionNameMap($rule_global),
+ $action_type,
+ $default);
$target = $this->renderActionTargetAsText($action, $handles);
@@ -1519,7 +1527,9 @@ protected function applyStandardEffect(HeraldEffect $effect) {
$supported = $this->getActions($rule_type);
$supported = array_fuse($supported);
if (empty($supported[$action])) {
- throw new Exception(
+ return new HeraldApplyTranscript(
+ $effect,
+ false,
pht(
'Adapter "%s" does not support action "%s" for rule type "%s".',
get_class($this),
@@ -1542,7 +1552,9 @@ protected function applyStandardEffect(HeraldEffect $effect) {
$result = $this->handleCustomHeraldEffect($effect);
if (!$result) {
- throw new Exception(
+ return new HeraldApplyTranscript(
+ $effect,
+ false,
pht(
'No custom action exists to handle rule action "%s".',
$action));
diff --git a/src/applications/herald/adapter/HeraldCommitAdapter.php b/src/applications/herald/adapter/HeraldCommitAdapter.php
index eeb43c7a95..e26da09ab4 100644
--- a/src/applications/herald/adapter/HeraldCommitAdapter.php
+++ b/src/applications/herald/adapter/HeraldCommitAdapter.php
@@ -387,7 +387,7 @@ private function getDiffContent($type) {
$lines[] = $hunk->makeChanges();
break;
default:
- throw new Exception("Unknown content selection '{$type}'!");
+ throw new Exception(pht("Unknown content selection '%s'!", $type));
}
}
$result[$change->getFilename()] = implode("\n", $lines);
diff --git a/src/applications/herald/adapter/HeraldDifferentialDiffAdapter.php b/src/applications/herald/adapter/HeraldDifferentialDiffAdapter.php
index 766be528f5..2a7a576e3e 100644
--- a/src/applications/herald/adapter/HeraldDifferentialDiffAdapter.php
+++ b/src/applications/herald/adapter/HeraldDifferentialDiffAdapter.php
@@ -154,7 +154,10 @@ public function applyHeraldEffects(array $effects) {
pht('Blocked diff.'));
break;
default:
- throw new Exception(pht('No rules to handle action "%s"!', $action));
+ $result[] = new HeraldApplyTranscript(
+ $effect,
+ false,
+ pht('No rules to handle action "%s"!', $action));
}
}
diff --git a/src/applications/herald/adapter/HeraldDifferentialRevisionAdapter.php b/src/applications/herald/adapter/HeraldDifferentialRevisionAdapter.php
index 3168b29f66..e7ba56cf06 100644
--- a/src/applications/herald/adapter/HeraldDifferentialRevisionAdapter.php
+++ b/src/applications/herald/adapter/HeraldDifferentialRevisionAdapter.php
@@ -80,7 +80,6 @@ public function getFields() {
self::FIELD_AFFECTED_PACKAGE,
self::FIELD_AFFECTED_PACKAGE_OWNER,
self::FIELD_IS_NEW_OBJECT,
- self::FIELD_ARCANIST_PROJECT,
),
parent::getFields());
}
@@ -259,8 +258,6 @@ public function getHeraldField($field) {
$packages = $this->loadAffectedPackages();
return PhabricatorOwnersOwner::loadAffiliatedUserPHIDs(
mpull($packages, 'getID'));
- case self::FIELD_ARCANIST_PROJECT:
- return $this->revision->getArcanistProjectPHID();
}
return parent::getHeraldField($field);
@@ -305,7 +302,8 @@ public function applyHeraldEffects(array $effects) {
$effect->setAction(self::ACTION_ADD_CC);
$effect->setTarget(array_keys($this->explicitCCs));
$effect->setReason(
- pht('CCs provided explicitly by revision author or carried over '.
+ pht(
+ 'CCs provided explicitly by revision author or carried over '.
'from a previous version of the revision.'));
$result[] = new HeraldApplyTranscript(
$effect,
@@ -346,8 +344,9 @@ public function applyHeraldEffects(array $effects) {
$result[] = new HeraldApplyTranscript(
$effect,
true,
- pht('Added these addresses to CC list. '.
- 'Others could not be added.'));
+ pht(
+ 'Added these addresses to CC list. '.
+ 'Others could not be added.'));
}
$result[] = new HeraldApplyTranscript(
$failed,
diff --git a/src/applications/herald/controller/HeraldRuleController.php b/src/applications/herald/controller/HeraldRuleController.php
index c290407097..a2fbe7a108 100644
--- a/src/applications/herald/controller/HeraldRuleController.php
+++ b/src/applications/herald/controller/HeraldRuleController.php
@@ -270,7 +270,7 @@ private function saveRule(HeraldAdapter $adapter, $rule, $request) {
if (!is_array($data) ||
!$data['conditions'] ||
!$data['actions']) {
- throw new Exception('Failed to decode rule data.');
+ throw new Exception(pht('Failed to decode rule data.'));
}
$conditions = array();
@@ -320,7 +320,7 @@ private function saveRule(HeraldAdapter $adapter, $rule, $request) {
try {
$adapter->willSaveAction($rule, $obj);
} catch (HeraldInvalidActionException $ex) {
- $errors[] = $ex;
+ $errors[] = $ex->getMessage();
}
$actions[] = $obj;
@@ -354,7 +354,6 @@ private function setupEditorBehavior(
if ($rule->getConditions()) {
$serial_conditions = array();
foreach ($rule->getConditions() as $condition) {
-
$value = $condition->getValue();
switch ($condition->getFieldName()) {
case HeraldAdapter::FIELD_TASK_PRIORITY:
@@ -394,10 +393,10 @@ private function setupEditorBehavior(
$serial_actions = array(
array('default', ''),
);
+
if ($rule->getActions()) {
$serial_actions = array();
foreach ($rule->getActions() as $action) {
-
switch ($action->getAction()) {
case HeraldAdapter::ACTION_FLAG:
case HeraldAdapter::ACTION_BLOCK:
@@ -438,21 +437,39 @@ private function setupEditorBehavior(
// names of, so that saving a rule without touching anything doesn't change
// it.
foreach ($rule->getConditions() as $condition) {
- if (empty($field_map[$condition->getFieldName()])) {
- $field_map[$condition->getFieldName()] = pht('');
+ $field_name = $condition->getFieldName();
+
+ if (empty($field_map[$field_name])) {
+ $field_map[$field_name] = pht('', $field_name);
}
}
$actions = $adapter->getActions($rule->getRuleType());
$action_map = array_select_keys($all_actions, $actions);
+ // Populate any actions which exist in the rule but which we don't know the
+ // names of, so that saving a rule without touching anything doesn't change
+ // it.
+ foreach ($rule->getActions() as $action) {
+ $action_name = $action->getAction();
+
+ if (empty($action_map[$action_name])) {
+ $action_map[$action_name] = pht('', $action_name);
+ }
+ }
+
+
$config_info = array();
$config_info['fields'] = $field_map;
$config_info['conditions'] = $all_conditions;
$config_info['actions'] = $action_map;
foreach ($config_info['fields'] as $field => $name) {
- $field_conditions = $adapter->getConditionsForField($field);
+ try {
+ $field_conditions = $adapter->getConditionsForField($field);
+ } catch (Exception $ex) {
+ $field_conditions = array(HeraldAdapter::CONDITION_UNCONDITIONALLY);
+ }
$config_info['conditionMap'][$field] = $field_conditions;
}
@@ -468,9 +485,15 @@ private function setupEditorBehavior(
$config_info['rule_type'] = $rule->getRuleType();
foreach ($config_info['actions'] as $action => $name) {
- $config_info['targets'][$action] = $adapter->getValueTypeForAction(
- $action,
- $rule->getRuleType());
+ try {
+ $action_value = $adapter->getValueTypeForAction(
+ $action,
+ $rule->getRuleType());
+ } catch (Exception $ex) {
+ $action_value = array(HeraldAdapter::VALUE_NONE);
+ }
+
+ $config_info['targets'][$action] = $action_value;
}
$changeflag_options =
@@ -603,7 +626,6 @@ protected function buildTokenizerTemplates(array $handles) {
'taskpriority' => new ManiphestTaskPriorityDatasource(),
'taskstatus' => new ManiphestTaskStatusDatasource(),
'buildplan' => new HarbormasterBuildPlanDatasource(),
- 'arcanistprojects' => new DiffusionArcanistProjectDatasource(),
'package' => new PhabricatorOwnersPackageDatasource(),
'project' => new PhabricatorProjectDatasource(),
'user' => new PhabricatorPeopleDatasource(),
diff --git a/src/applications/herald/controller/HeraldTestConsoleController.php b/src/applications/herald/controller/HeraldTestConsoleController.php
index 0af51cf672..7cd610f35a 100644
--- a/src/applications/herald/controller/HeraldTestConsoleController.php
+++ b/src/applications/herald/controller/HeraldTestConsoleController.php
@@ -51,7 +51,7 @@ public function processRequest() {
$adapter = id(new PhrictionDocumentHeraldAdapter())
->setDocument($object);
} else {
- throw new Exception('Can not build adapter for object!');
+ throw new Exception(pht('Can not build adapter for object!'));
}
$adapter->setIsNewObject(false);
diff --git a/src/applications/herald/controller/HeraldTranscriptController.php b/src/applications/herald/controller/HeraldTranscriptController.php
index d1094437dd..a915e55b3d 100644
--- a/src/applications/herald/controller/HeraldTranscriptController.php
+++ b/src/applications/herald/controller/HeraldTranscriptController.php
@@ -78,8 +78,10 @@ public function processRequest() {
$notice = new PHUIInfoView();
$notice->setSeverity(PHUIInfoView::SEVERITY_NOTICE);
$notice->setTitle(pht('Dry Run'));
- $notice->appendChild(pht('This was a dry run to test Herald '.
- 'rules, no actions were executed.'));
+ $notice->appendChild(
+ pht(
+ 'This was a dry run to test Herald rules, '.
+ 'no actions were executed.'));
$nav->appendChild($notice);
}
@@ -133,7 +135,7 @@ protected function renderConditionTestValue($condition, $handles) {
// grabbed handles for everything, but be super liberal in what
// we accept here since we expect all sorts of weird issues as we
// version the system.
- $value[$key] = 'Unknown Object #'.$phid;
+ $value[$key] = pht('Unknown Object #%s', $phid);
}
}
sort($value);
@@ -210,7 +212,8 @@ protected function getTranscriptPHIDs($xscript) {
// TODO: Also total hacks.
if (is_array($value)) {
foreach ($value as $phid) {
- if ($phid) { // TODO: Probably need to make sure this
+ if ($phid) {
+ // TODO: Probably need to make sure this
// "looks like" a PHID or decrease the level of hacks here;
// this used to be an is_numeric() check in Facebook land.
$phids[] = $phid;
@@ -377,7 +380,10 @@ private function buildApplyTranscriptPanel(HeraldTranscript $xscript) {
$item->setState(PHUIObjectItemView::STATE_FAIL);
}
- $rule = idx($action_names, $apply_xscript->getAction(), pht('Unknown'));
+ $rule = idx(
+ $action_names,
+ $apply_xscript->getAction(),
+ pht('Unknown Action "%s"', $apply_xscript->getAction()));
$item->setHeader(pht('%s: %s', $rule, $target));
$item->addAttribute($apply_xscript->getReason());
diff --git a/src/applications/herald/engine/HeraldEngine.php b/src/applications/herald/engine/HeraldEngine.php
index 9774cb866a..4e986987d5 100644
--- a/src/applications/herald/engine/HeraldEngine.php
+++ b/src/applications/herald/engine/HeraldEngine.php
@@ -81,8 +81,9 @@ public function applyRules(array $rules, HeraldAdapter $object) {
->setRuleName($rule->getName())
->setRuleOwner($rule->getAuthorPHID())
->setReason(
- 'This rule is only supposed to be repeated a single time, '.
- 'and it has already been applied.');
+ pht(
+ 'This rule is only supposed to be repeated a single time, '.
+ 'and it has already been applied.'));
$this->transcript->addRuleTranscript($xscript);
$rule_matches = false;
} else {
@@ -99,9 +100,11 @@ public function applyRules(array $rules, HeraldAdapter $object) {
$xscript->setRuleID($rule_id);
$xscript->setResult(false);
$xscript->setReason(
- "Rules {$names} are recursively dependent upon one another! ".
- "Don't do this! You have formed an unresolvable cycle in the ".
- "dependency graph!");
+ pht(
+ "Rules %s are recursively dependent upon one another! ".
+ "Don't do this! You have formed an unresolvable cycle in the ".
+ "dependency graph!",
+ $names));
$xscript->setRuleName($rules[$rule_id]->getName());
$xscript->setRuleOwner($rules[$rule_id]->getAuthorPHID());
$this->transcript->addRuleTranscript($xscript);
@@ -269,16 +272,26 @@ public function doesRuleMatch(
$result = false;
} else {
foreach ($conditions as $condition) {
+ try {
+ $object->getHeraldField($condition->getFieldName());
+ } catch (Exception $ex) {
+ $reason = pht(
+ 'Field "%s" does not exist!',
+ $condition->getFieldName());
+ $result = false;
+ break;
+ }
+
$match = $this->doesConditionMatch($rule, $condition, $object);
if (!$all && $match) {
- $reason = 'Any condition matched.';
+ $reason = pht('Any condition matched.');
$result = true;
break;
}
if ($all && !$match) {
- $reason = 'Not all conditions matched.';
+ $reason = pht('Not all conditions matched.');
$result = false;
break;
}
@@ -286,10 +299,10 @@ public function doesRuleMatch(
if ($result === null) {
if ($all) {
- $reason = 'All conditions matched.';
+ $reason = pht('All conditions matched.');
$result = true;
} else {
- $reason = 'No conditions matched.';
+ $reason = pht('No conditions matched.');
$result = false;
}
}
diff --git a/src/applications/herald/query/HeraldTranscriptSearchEngine.php b/src/applications/herald/query/HeraldTranscriptSearchEngine.php
index f6944e1215..f9433e0c02 100644
--- a/src/applications/herald/query/HeraldTranscriptSearchEngine.php
+++ b/src/applications/herald/query/HeraldTranscriptSearchEngine.php
@@ -125,7 +125,7 @@ protected function renderResultList(
}
$item->addAttribute($handles[$xscript->getObjectPHID()]->renderLink());
$item->addAttribute(
- number_format((int)(1000 * $xscript->getDuration())).' ms');
+ pht('%s ms', new PhutilNumber((int)(1000 * $xscript->getDuration()))));
$item->addIcon(
'none',
phabricator_datetime($xscript->getTime(), $viewer));
diff --git a/src/applications/herald/storage/HeraldRule.php b/src/applications/herald/storage/HeraldRule.php
index 2d19bc5356..0600d2570f 100644
--- a/src/applications/herald/storage/HeraldRule.php
+++ b/src/applications/herald/storage/HeraldRule.php
@@ -133,7 +133,7 @@ protected function saveChildren($table_name, array $children) {
assert_instances_of($children, 'HeraldDAO');
if (!$this->getID()) {
- throw new Exception('Save rule before saving children.');
+ throw new PhutilInvalidStateException('save');
}
foreach ($children as $child) {
diff --git a/src/applications/home/controller/PhabricatorHomeMainController.php b/src/applications/home/controller/PhabricatorHomeMainController.php
index 2b30770253..3069ccee7d 100644
--- a/src/applications/home/controller/PhabricatorHomeMainController.php
+++ b/src/applications/home/controller/PhabricatorHomeMainController.php
@@ -143,8 +143,8 @@ private function buildUnbreakNowPanel() {
if (!$tasks) {
return $this->renderMiniPanel(
- 'No "Unbreak Now!" Tasks',
- 'Nothing appears to be critically broken right now.');
+ pht('No "Unbreak Now!" Tasks'),
+ pht('Nothing appears to be critically broken right now.'));
}
$href = urisprintf(
@@ -190,10 +190,8 @@ private function buildNeedsTriagePanel(array $projects) {
if (!$tasks) {
return $this->renderMiniPanel(
- 'No "Needs Triage" Tasks',
- hsprintf(
- 'No tasks in projects you are a member of '.
- 'need triage.'));
+ pht('No "Needs Triage" Tasks'),
+ pht('No tasks in projects you are a member of need triage.'));
}
$title = pht('Needs Triage');
@@ -228,8 +226,8 @@ private function buildRevisionPanel() {
if (!$blocking && !$active) {
return $this->renderMiniPanel(
- 'No Waiting Revisions',
- 'No revisions are waiting on you.');
+ pht('No Waiting Revisions'),
+ pht('No revisions are waiting on you.'));
}
$title = pht('Revisions Waiting on You');
@@ -283,8 +281,8 @@ private function buildTasksPanel() {
if (!$tasks) {
return $this->renderMiniPanel(
- 'No Assigned Tasks',
- 'You have no assigned tasks.');
+ pht('No Assigned Tasks'),
+ pht('You have no assigned tasks.'));
}
$title = pht('Assigned Tasks');
@@ -360,8 +358,8 @@ public function buildAuditPanel() {
if (!$commits) {
return $this->renderMinipanel(
- 'No Audits',
- 'No commits are waiting for you to audit them.');
+ pht('No Audits'),
+ pht('No commits are waiting for you to audit them.'));
}
$view = id(new PhabricatorAuditListView())
@@ -399,8 +397,8 @@ public function buildCommitPanel() {
if (!$commits) {
return $this->renderMinipanel(
- 'No Problem Commits',
- 'No one has raised concerns with your commits.');
+ pht('No Problem Commits'),
+ pht('No one has raised concerns with your commits.'));
}
$view = id(new PhabricatorAuditListView())
diff --git a/src/applications/legalpad/controller/LegalpadDocumentEditController.php b/src/applications/legalpad/controller/LegalpadDocumentEditController.php
index c4bff97f6f..908bf8dd51 100644
--- a/src/applications/legalpad/controller/LegalpadDocumentEditController.php
+++ b/src/applications/legalpad/controller/LegalpadDocumentEditController.php
@@ -167,8 +167,7 @@ public function handleRequest(AphrontRequest $request) {
->addCheckbox(
'requireSignature',
'requireSignature',
- pht(
- 'Should signing this document be required to use Phabricator?'),
+ pht('Should signing this document be required to use Phabricator?'),
$v_require_signature)
->setCaption($caption));
}
diff --git a/src/applications/legalpad/controller/LegalpadDocumentSignController.php b/src/applications/legalpad/controller/LegalpadDocumentSignController.php
index 4cd2f59b4c..3e65d1de1b 100644
--- a/src/applications/legalpad/controller/LegalpadDocumentSignController.php
+++ b/src/applications/legalpad/controller/LegalpadDocumentSignController.php
@@ -653,25 +653,21 @@ private function sendVerifySignatureEmail(
$name = idx($signature_data, 'name');
- $body = <<addRawTos(array($email->getAddress()))
@@ -684,9 +680,10 @@ private function sendVerifySignatureEmail(
private function signInResponse() {
return id(new Aphront403Response())
- ->setForbiddenText(pht(
- 'The email address specified is associated with an account. '.
- 'Please login to that account and sign this document again.'));
+ ->setForbiddenText(
+ pht(
+ 'The email address specified is associated with an account. '.
+ 'Please login to that account and sign this document again.'));
}
}
diff --git a/src/applications/legalpad/controller/LegalpadDocumentSignatureVerificationController.php b/src/applications/legalpad/controller/LegalpadDocumentSignatureVerificationController.php
index 7ad5d13946..a940eb646f 100644
--- a/src/applications/legalpad/controller/LegalpadDocumentSignatureVerificationController.php
+++ b/src/applications/legalpad/controller/LegalpadDocumentSignatureVerificationController.php
@@ -38,9 +38,7 @@ public function processRequest() {
if ($signature->isVerified()) {
return $this->newDialog()
->setTitle(pht('Signature Already Verified'))
- ->appendParagraph(
- pht(
- 'This signature has already been verified.'))
+ ->appendParagraph(pht('This signature has already been verified.'))
->addCancelButton('/', pht('Okay'));
}
diff --git a/src/applications/legalpad/mail/LegalpadMailReceiver.php b/src/applications/legalpad/mail/LegalpadMailReceiver.php
index 20296372ed..5fe0dfd4e8 100644
--- a/src/applications/legalpad/mail/LegalpadMailReceiver.php
+++ b/src/applications/legalpad/mail/LegalpadMailReceiver.php
@@ -3,8 +3,8 @@
final class LegalpadMailReceiver extends PhabricatorObjectMailReceiver {
public function isEnabled() {
- $app_class = 'PhabricatorLegalpadApplication';
- return PhabricatorApplication::isClassInstalled($app_class);
+ return PhabricatorApplication::isClassInstalled(
+ 'PhabricatorLegalpadApplication');
}
protected function getObjectPattern() {
diff --git a/src/applications/legalpad/mail/LegalpadReplyHandler.php b/src/applications/legalpad/mail/LegalpadReplyHandler.php
index 8063d4ec2e..103f5a6cbb 100644
--- a/src/applications/legalpad/mail/LegalpadReplyHandler.php
+++ b/src/applications/legalpad/mail/LegalpadReplyHandler.php
@@ -5,7 +5,7 @@ final class LegalpadReplyHandler
public function validateMailReceiver($mail_receiver) {
if (!($mail_receiver instanceof LegalpadDocument)) {
- throw new Exception('Mail receiver is not a LegalpadDocument!');
+ throw new Exception(pht('Mail receiver is not a LegalpadDocument!'));
}
}
diff --git a/src/applications/legalpad/query/LegalpadDocumentSearchEngine.php b/src/applications/legalpad/query/LegalpadDocumentSearchEngine.php
index 84abe3fdd1..9f404515be 100644
--- a/src/applications/legalpad/query/LegalpadDocumentSearchEngine.php
+++ b/src/applications/legalpad/query/LegalpadDocumentSearchEngine.php
@@ -108,7 +108,6 @@ public function buildSearchForm(
pht('Created After'),
'createdEnd',
pht('Created Before'));
-
}
protected function getURI($path) {
diff --git a/src/applications/legalpad/storage/LegalpadDocument.php b/src/applications/legalpad/storage/LegalpadDocument.php
index d750c3689b..4c6e04a26a 100644
--- a/src/applications/legalpad/storage/LegalpadDocument.php
+++ b/src/applications/legalpad/storage/LegalpadDocument.php
@@ -202,8 +202,7 @@ public function hasAutomaticCapability($capability, PhabricatorUser $user) {
}
public function describeAutomaticCapability($capability) {
- return pht(
- 'The author of a document can always view and edit it.');
+ return pht('The author of a document can always view and edit it.');
}
diff --git a/src/applications/legalpad/storage/LegalpadDocumentBody.php b/src/applications/legalpad/storage/LegalpadDocumentBody.php
index 1533f4165f..a55583428c 100644
--- a/src/applications/legalpad/storage/LegalpadDocumentBody.php
+++ b/src/applications/legalpad/storage/LegalpadDocumentBody.php
@@ -56,7 +56,7 @@ public function getMarkupText($field) {
$text = $this->getTitle();
break;
default:
- throw new Exception('Unknown field: '.$field);
+ throw new Exception(pht('Unknown field: %s', $field));
break;
}
diff --git a/src/applications/lipsum/generator/PhabricatorTestDataGenerator.php b/src/applications/lipsum/generator/PhabricatorTestDataGenerator.php
index 45eca56c7c..9adf6fca70 100644
--- a/src/applications/lipsum/generator/PhabricatorTestDataGenerator.php
+++ b/src/applications/lipsum/generator/PhabricatorTestDataGenerator.php
@@ -12,7 +12,9 @@ public function loadOneRandom($classname) {
->loadOneWhere('1 = 1 ORDER BY RAND() LIMIT 1');
} catch (PhutilMissingSymbolException $ex) {
throw new PhutilMissingSymbolException(
- 'Unable to load symbol '.$classname.': this class does not exit.');
+ pht(
+ 'Unable to load symbol %s: this class does not exit.',
+ $classname));
}
}
diff --git a/src/applications/macro/conduit/MacroCreateMemeConduitAPIMethod.php b/src/applications/macro/conduit/MacroCreateMemeConduitAPIMethod.php
index 308f1c3b3a..e63d831a70 100644
--- a/src/applications/macro/conduit/MacroCreateMemeConduitAPIMethod.php
+++ b/src/applications/macro/conduit/MacroCreateMemeConduitAPIMethod.php
@@ -28,7 +28,7 @@ protected function defineReturnType() {
protected function defineErrorTypes() {
return array(
- 'ERR-NOT-FOUND' => 'Macro was not found.',
+ 'ERR-NOT-FOUND' => pht('Macro was not found.'),
);
}
diff --git a/src/applications/macro/conduit/MacroQueryConduitAPIMethod.php b/src/applications/macro/conduit/MacroQueryConduitAPIMethod.php
index 66cdedeebc..44f54a3c8f 100644
--- a/src/applications/macro/conduit/MacroQueryConduitAPIMethod.php
+++ b/src/applications/macro/conduit/MacroQueryConduitAPIMethod.php
@@ -7,7 +7,7 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return 'Retrieve image macro information.';
+ return pht('Retrieve image macro information.');
}
protected function defineParamTypes() {
diff --git a/src/applications/macro/controller/PhabricatorMacroDisableController.php b/src/applications/macro/controller/PhabricatorMacroDisableController.php
index 8afc89df9b..b75e67e1f8 100644
--- a/src/applications/macro/controller/PhabricatorMacroDisableController.php
+++ b/src/applications/macro/controller/PhabricatorMacroDisableController.php
@@ -44,10 +44,14 @@ public function processRequest() {
$dialog
->setUser($request->getUser())
->setTitle(pht('Really disable macro?'))
- ->appendChild(phutil_tag('p', array(), pht(
- 'Really disable the much-beloved image macro %s? '.
- 'It will be sorely missed.',
- $macro->getName())))
+ ->appendChild(
+ phutil_tag(
+ 'p',
+ array(),
+ pht(
+ 'Really disable the much-beloved image macro %s? '.
+ 'It will be sorely missed.',
+ $macro->getName())))
->setSubmitURI($this->getApplicationURI('/disable/'.$this->id.'/'))
->addSubmitButton(pht('Disable'))
->addCancelButton($view_uri);
diff --git a/src/applications/macro/mail/PhabricatorMacroMailReceiver.php b/src/applications/macro/mail/PhabricatorMacroMailReceiver.php
index 30f562e4b2..222524a377 100644
--- a/src/applications/macro/mail/PhabricatorMacroMailReceiver.php
+++ b/src/applications/macro/mail/PhabricatorMacroMailReceiver.php
@@ -3,8 +3,8 @@
final class PhabricatorMacroMailReceiver extends PhabricatorObjectMailReceiver {
public function isEnabled() {
- $app_class = 'PhabricatorManiphestApplication';
- return PhabricatorApplication::isClassInstalled($app_class);
+ return PhabricatorApplication::isClassInstalled(
+ 'PhabricatorManiphestApplication');
}
protected function getObjectPattern() {
diff --git a/src/applications/macro/mail/PhabricatorMacroReplyHandler.php b/src/applications/macro/mail/PhabricatorMacroReplyHandler.php
index 5b0d9ce8a8..83b5d0a930 100644
--- a/src/applications/macro/mail/PhabricatorMacroReplyHandler.php
+++ b/src/applications/macro/mail/PhabricatorMacroReplyHandler.php
@@ -5,7 +5,8 @@ final class PhabricatorMacroReplyHandler
public function validateMailReceiver($mail_receiver) {
if (!($mail_receiver instanceof PhabricatorFileImageMacro)) {
- throw new Exception('Mail receiver is not a PhabricatorFileImageMacro!');
+ throw new Exception(
+ pht('Mail receiver is not a %s!', 'PhabricatorFileImageMacro'));
}
}
diff --git a/src/applications/macro/query/PhabricatorMacroQuery.php b/src/applications/macro/query/PhabricatorMacroQuery.php
index 7c70746644..d4ffe46107 100644
--- a/src/applications/macro/query/PhabricatorMacroQuery.php
+++ b/src/applications/macro/query/PhabricatorMacroQuery.php
@@ -170,7 +170,7 @@ protected function buildWhereClause(AphrontDatabaseConnection $conn) {
case self::STATUS_ANY:
break;
default:
- throw new Exception("Unknown status '{$this->status}'!");
+ throw new Exception(pht("Unknown status '%s'!", $this->status));
}
if ($this->dateCreatedAfter) {
@@ -201,7 +201,7 @@ protected function buildWhereClause(AphrontDatabaseConnection $conn) {
->execute();
if (empty($flags)) {
- throw new PhabricatorEmptyQueryException('No matching flags.');
+ throw new PhabricatorEmptyQueryException(pht('No matching flags.'));
} else {
$where[] = qsprintf(
$conn,
diff --git a/src/applications/mailinglists/application/PhabricatorMailingListsApplication.php b/src/applications/mailinglists/application/PhabricatorMailingListsApplication.php
index bd134933b2..cf62321996 100644
--- a/src/applications/mailinglists/application/PhabricatorMailingListsApplication.php
+++ b/src/applications/mailinglists/application/PhabricatorMailingListsApplication.php
@@ -3,7 +3,7 @@
final class PhabricatorMailingListsApplication extends PhabricatorApplication {
public function getName() {
- return 'Mailing Lists';
+ return pht('Mailing Lists');
}
public function getBaseURI() {
@@ -11,7 +11,7 @@ public function getBaseURI() {
}
public function getShortDescription() {
- return 'Manage External Lists';
+ return pht('Manage External Lists');
}
public function getFontIcon() {
diff --git a/src/applications/maniphest/__tests__/ManiphestTaskTestCase.php b/src/applications/maniphest/__tests__/ManiphestTaskTestCase.php
index fc9aa17381..b7fafa83ff 100644
--- a/src/applications/maniphest/__tests__/ManiphestTaskTestCase.php
+++ b/src/applications/maniphest/__tests__/ManiphestTaskTestCase.php
@@ -11,9 +11,9 @@ protected function getPhabricatorTestCaseConfiguration() {
public function testTaskReordering() {
$viewer = $this->generateNewTestUser();
- $t1 = $this->newTask($viewer, 'Task 1');
- $t2 = $this->newTask($viewer, 'Task 2');
- $t3 = $this->newTask($viewer, 'Task 3');
+ $t1 = $this->newTask($viewer, pht('Task 1'));
+ $t2 = $this->newTask($viewer, pht('Task 2'));
+ $t3 = $this->newTask($viewer, pht('Task 3'));
$auto_base = min(mpull(array($t1, $t2, $t3), 'getID'));
@@ -95,7 +95,7 @@ public function testTaskAdjacentBlocks() {
$t = array();
for ($ii = 1; $ii < 10; $ii++) {
- $t[$ii] = $this->newTask($viewer, "Task Block {$ii}");
+ $t[$ii] = $this->newTask($viewer, pht('Task Block %d', $ii));
// This makes sure this test remains meaningful if we begin assigning
// subpriorities when tasks are created.
@@ -124,7 +124,7 @@ public function testTaskAdjacentBlocks() {
$this->assertEqual(
9,
count($subpri),
- 'Expected subpriorities to be distributed.');
+ pht('Expected subpriorities to be distributed.'));
}
private function newTask(PhabricatorUser $viewer, $title) {
diff --git a/src/applications/maniphest/command/ManiphestAssignEmailCommand.php b/src/applications/maniphest/command/ManiphestAssignEmailCommand.php
index 7d98bb003f..9d2a51b107 100644
--- a/src/applications/maniphest/command/ManiphestAssignEmailCommand.php
+++ b/src/applications/maniphest/command/ManiphestAssignEmailCommand.php
@@ -17,11 +17,13 @@ public function getCommandSummary() {
public function getCommandDescription() {
return pht(
- 'To assign a task to another user, provide their username. For example, '.
- 'to assign a task to `alincoln`, write `!assign alincoln`.'.
- "\n\n".
- 'If you omit the username or the username is not valid, this behaves '.
- 'like `!claim` and assigns the task to you instead.');
+ "To assign a task to another user, provide their username. For example, ".
+ "to assign a task to `%s`, write `%s`.\n\n".
+ "If you omit the username or the username is not valid, this behaves ".
+ "like `%s` and assigns the task to you instead.",
+ 'alincoln',
+ '!assign alincoln',
+ '!claim');
}
public function buildTransactions(
diff --git a/src/applications/maniphest/command/ManiphestPriorityEmailCommand.php b/src/applications/maniphest/command/ManiphestPriorityEmailCommand.php
index 04fdc7399f..85ed148db7 100644
--- a/src/applications/maniphest/command/ManiphestPriorityEmailCommand.php
+++ b/src/applications/maniphest/command/ManiphestPriorityEmailCommand.php
@@ -29,12 +29,12 @@ public function getCommandDescription() {
$table = implode("\n", $table);
return pht(
- 'To change the priority of a task, specify the desired priority, like '.
- '`!priority high`. This table shows the configured names for priority '.
- 'levels.'.
+ "To change the priority of a task, specify the desired priority, like ".
+ "`%s`. This table shows the configured names for priority levels.".
"\n\n%s\n\n".
- 'If you specify an invalid priority, the command is ignored. This '.
- 'command has no effect if you do not specify a priority.',
+ "If you specify an invalid priority, the command is ignored. This ".
+ "command has no effect if you do not specify a priority.",
+ '!priority high',
$table);
}
diff --git a/src/applications/maniphest/command/ManiphestStatusEmailCommand.php b/src/applications/maniphest/command/ManiphestStatusEmailCommand.php
index 0e2ebbba76..c9fa07494f 100644
--- a/src/applications/maniphest/command/ManiphestStatusEmailCommand.php
+++ b/src/applications/maniphest/command/ManiphestStatusEmailCommand.php
@@ -29,11 +29,11 @@ public function getCommandDescription() {
$table = implode("\n", $table);
return pht(
- 'To change the status of a task, specify the desired status, like '.
- '`!status invalid`. This table shows the configured names for statuses.'.
- "\n\n%s\n\n".
- 'If you specify an invalid status, the command is ignored. This '.
- 'command has no effect if you do not specify a status.',
+ "To change the status of a task, specify the desired status, like ".
+ "`%s`. This table shows the configured names for statuses.\n\n%s\n\n".
+ "If you specify an invalid status, the command is ignored. This ".
+ "command has no effect if you do not specify a status.",
+ '!status invalid',
$table);
}
diff --git a/src/applications/maniphest/conduit/ManiphestConduitAPIMethod.php b/src/applications/maniphest/conduit/ManiphestConduitAPIMethod.php
index 39067f7cbd..52257b2cb4 100644
--- a/src/applications/maniphest/conduit/ManiphestConduitAPIMethod.php
+++ b/src/applications/maniphest/conduit/ManiphestConduitAPIMethod.php
@@ -9,7 +9,7 @@ final public function getApplication() {
protected function defineErrorTypes() {
return array(
- 'ERR-INVALID-PARAMETER' => 'Missing or malformed parameter.',
+ 'ERR-INVALID-PARAMETER' => pht('Missing or malformed parameter.'),
);
}
@@ -86,7 +86,7 @@ protected function applyRequest(
$valid_statuses = ManiphestTaskStatus::getTaskStatusMap();
if (!isset($valid_statuses[$status])) {
throw id(new ConduitException('ERR-INVALID-PARAMETER'))
- ->setErrorDescription('Status set to invalid value.');
+ ->setErrorDescription(pht('Status set to invalid value.'));
}
$changes[ManiphestTransaction::TYPE_STATUS] = $status;
}
@@ -97,7 +97,7 @@ protected function applyRequest(
$valid_priorities = ManiphestTaskPriority::getTaskPriorityMap();
if (!isset($valid_priorities[$priority])) {
throw id(new ConduitException('ERR-INVALID-PARAMETER'))
- ->setErrorDescription('Priority set to invalid value.');
+ ->setErrorDescription(pht('Priority set to invalid value.'));
}
$changes[ManiphestTransaction::TYPE_PRIORITY] = $priority;
}
@@ -313,7 +313,10 @@ private function validatePHIDList(array $phid_list, $phid_type, $field) {
unset($phid_groups[$phid_type]);
if (!empty($phid_groups)) {
throw id(new ConduitException('ERR-INVALID-PARAMETER'))
- ->setErrorDescription('One or more PHIDs were invalid for '.$field.'.');
+ ->setErrorDescription(
+ pht(
+ 'One or more PHIDs were invalid for %s.',
+ $field));
}
return true;
diff --git a/src/applications/maniphest/conduit/ManiphestCreateTaskConduitAPIMethod.php b/src/applications/maniphest/conduit/ManiphestCreateTaskConduitAPIMethod.php
index ed16f77495..3a404774cf 100644
--- a/src/applications/maniphest/conduit/ManiphestCreateTaskConduitAPIMethod.php
+++ b/src/applications/maniphest/conduit/ManiphestCreateTaskConduitAPIMethod.php
@@ -8,7 +8,7 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return 'Create a new Maniphest task.';
+ return pht('Create a new Maniphest task.');
}
protected function defineParamTypes() {
@@ -21,7 +21,7 @@ protected function defineReturnType() {
protected function defineErrorTypes() {
return array(
- 'ERR-INVALID-PARAMETER' => 'Missing or malformed parameter.',
+ 'ERR-INVALID-PARAMETER' => pht('Missing or malformed parameter.'),
);
}
diff --git a/src/applications/maniphest/conduit/ManiphestGetTaskTransactionsConduitAPIMethod.php b/src/applications/maniphest/conduit/ManiphestGetTaskTransactionsConduitAPIMethod.php
index ff51dafd7d..4c64a56b33 100644
--- a/src/applications/maniphest/conduit/ManiphestGetTaskTransactionsConduitAPIMethod.php
+++ b/src/applications/maniphest/conduit/ManiphestGetTaskTransactionsConduitAPIMethod.php
@@ -8,7 +8,7 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return 'Retrieve Maniphest Task Transactions.';
+ return pht('Retrieve Maniphest task transactions.');
}
protected function defineParamTypes() {
diff --git a/src/applications/maniphest/conduit/ManiphestInfoConduitAPIMethod.php b/src/applications/maniphest/conduit/ManiphestInfoConduitAPIMethod.php
index 5915e74fb5..367feff41a 100644
--- a/src/applications/maniphest/conduit/ManiphestInfoConduitAPIMethod.php
+++ b/src/applications/maniphest/conduit/ManiphestInfoConduitAPIMethod.php
@@ -7,7 +7,7 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return 'Retrieve information about a Maniphest task, given its id.';
+ return pht('Retrieve information about a Maniphest task, given its ID.');
}
protected function defineParamTypes() {
@@ -22,7 +22,7 @@ protected function defineReturnType() {
protected function defineErrorTypes() {
return array(
- 'ERR_BAD_TASK' => 'No such maniphest task exists',
+ 'ERR_BAD_TASK' => pht('No such Maniphest task exists.'),
);
}
diff --git a/src/applications/maniphest/conduit/ManiphestQueryConduitAPIMethod.php b/src/applications/maniphest/conduit/ManiphestQueryConduitAPIMethod.php
index 0dc26e58ab..8a2321b2d3 100644
--- a/src/applications/maniphest/conduit/ManiphestQueryConduitAPIMethod.php
+++ b/src/applications/maniphest/conduit/ManiphestQueryConduitAPIMethod.php
@@ -7,7 +7,7 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return 'Execute complex searches for Maniphest tasks.';
+ return pht('Execute complex searches for Maniphest tasks.');
}
protected function defineParamTypes() {
diff --git a/src/applications/maniphest/conduit/ManiphestQueryStatusesConduitAPIMethod.php b/src/applications/maniphest/conduit/ManiphestQueryStatusesConduitAPIMethod.php
index 8255b3474c..971be8820b 100644
--- a/src/applications/maniphest/conduit/ManiphestQueryStatusesConduitAPIMethod.php
+++ b/src/applications/maniphest/conduit/ManiphestQueryStatusesConduitAPIMethod.php
@@ -8,7 +8,8 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return 'Retrieve information about possible Maniphest Task status values.';
+ return pht(
+ 'Retrieve information about possible Maniphest task status values.');
}
protected function defineParamTypes() {
diff --git a/src/applications/maniphest/conduit/ManiphestUpdateConduitAPIMethod.php b/src/applications/maniphest/conduit/ManiphestUpdateConduitAPIMethod.php
index a4a6232679..ad659af259 100644
--- a/src/applications/maniphest/conduit/ManiphestUpdateConduitAPIMethod.php
+++ b/src/applications/maniphest/conduit/ManiphestUpdateConduitAPIMethod.php
@@ -7,14 +7,14 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return 'Update an existing Maniphest task.';
+ return pht('Update an existing Maniphest task.');
}
protected function defineErrorTypes() {
return array(
- 'ERR-BAD-TASK' => 'No such maniphest task exists.',
- 'ERR-INVALID-PARAMETER' => 'Missing or malformed parameter.',
- 'ERR-NO-EFFECT' => 'Update has no effect.',
+ 'ERR-BAD-TASK' => pht('No such Maniphest task exists.'),
+ 'ERR-INVALID-PARAMETER' => pht('Missing or malformed parameter.'),
+ 'ERR-NO-EFFECT' => pht('Update has no effect.'),
);
}
@@ -31,7 +31,11 @@ protected function execute(ConduitAPIRequest $request) {
$phid = $request->getValue('phid');
if (($id && $phid) || (!$id && !$phid)) {
- throw new Exception("Specify exactly one of 'id' and 'phid'.");
+ throw new Exception(
+ pht(
+ "Specify exactly one of '%s' and '%s'.",
+ 'id',
+ 'phid'));
}
$query = id (new ManiphestTaskQuery())
diff --git a/src/applications/maniphest/config/PhabricatorManiphestConfigOptions.php b/src/applications/maniphest/config/PhabricatorManiphestConfigOptions.php
index c2b87629f0..a52b84dcbb 100644
--- a/src/applications/maniphest/config/PhabricatorManiphestConfigOptions.php
+++ b/src/applications/maniphest/config/PhabricatorManiphestConfigOptions.php
@@ -278,7 +278,8 @@ public function getOptions() {
' commands in email.'.
"\n\n".
'You can choose which priority is the default for newly created '.
- 'tasks with `maniphest.default-priority`.')),
+ 'tasks with `%s`.',
+ 'maniphest.default-priority')),
$this->newOption('maniphest.statuses', $status_type, $status_defaults)
->setSummary(pht('Configure Maniphest task statuses.'))
->setDescription($status_description)
@@ -289,64 +290,14 @@ public function getOptions() {
pht(
'Choose a default priority for newly created tasks. You can '.
'review and adjust available priorities by using the '.
- '{{maniphest.priorities}} configuration option. The default value '.
- '(`90`) corresponds to the default "Needs Triage" priority.')),
+ '%s configuration option. The default value (`90`) '.
+ 'corresponds to the default "Needs Triage" priority.',
+ 'maniphest.priorities')),
$this->newOption(
'metamta.maniphest.subject-prefix',
'string',
'[Maniphest]')
->setDescription(pht('Subject prefix for Maniphest mail.')),
- $this->newOption(
- 'metamta.maniphest.public-create-email',
- 'string',
- null)
- ->setLocked(true)
- ->setLockedMessage(pht(
- 'This configuration is deprecated. See description for details.'))
- ->setSummary(pht('DEPRECATED - Allow filing bugs via email.'))
- ->setDescription(
- pht(
- 'This config has been deprecated in favor of [[ '.
- '/applications/view/PhabricatorManiphestApplication/ | '.
- 'application settings ]], which allow for multiple email '.
- 'addresses and other functionality.'."\n\n".
- 'You can configure an email address like '.
- '"bugs@phabricator.example.com" which will automatically create '.
- 'Maniphest tasks when users send email to it. This relies on the '.
- '"From" address to authenticate users, so it is is not completely '.
- 'secure. To set this up, enter a complete email address like '.
- '"bugs@phabricator.example.com" and then configure mail to that '.
- 'address so it routed to Phabricator (if you\'ve already '.
- 'configured reply handlers, you\'re probably already done). See '.
- '"Configuring Inbound Email" in the documentation for more '.
- 'information.')),
- $this->newOption(
- 'metamta.maniphest.default-public-author',
- 'string',
- null)
- ->setLocked(true)
- ->setLockedMessage(pht(
- 'This configuration is deprecated. See description for details.'))
- ->setSummary(pht(
- 'DEPRECATED - Username anonymous bugs are filed under.'))
- ->setDescription(
- pht(
- 'This config has been deprecated in favor of [[ '.
- '/applications/view/PhabricatorManiphestApplication/ | '.
- 'application settings ]], which allow for multiple email '.
- 'addresses each with its own default author, and other '.
- 'functionality.'."\n\n".
- 'If you enable `metamta.maniphest.public-create-email` and create '.
- 'an email address like "bugs@phabricator.example.com", it will '.
- 'default to rejecting mail which doesn\'t come from a known user. '.
- 'However, you might want to let anyone send email to this '.
- 'address; to do so, set a default author here (a Phabricator '.
- 'username). A typical use of this might be to create a "System '.
- 'Agent" user called "bugs" and use that name here. If you specify '.
- 'a valid username, mail will always be accepted and used to '.
- 'create a task, even if the sender is not a system user. The '.
- 'original email address will be stored in an `From Email` field '.
- 'on the task.')),
$this->newOption(
'maniphest.priorities.unbreak-now',
'int',
@@ -356,7 +307,8 @@ public function getOptions() {
pht(
'Temporary setting. If set, this priority is used to populate the '.
'"Unbreak Now" panel on the home page. You should adjust this if '.
- 'you adjust priorities using `maniphest.priorities`.')),
+ 'you adjust priorities using `%s`.',
+ 'maniphest.priorities')),
$this->newOption(
'maniphest.priorities.needs-triage',
'int',
@@ -366,7 +318,8 @@ public function getOptions() {
pht(
'Temporary setting. If set, this priority is used to populate the '.
'"Needs Triage" panel on the home page. You should adjust this if '.
- 'you adjust priorities using `maniphest.priorities`.')),
+ 'you adjust priorities using `%s`.',
+ 'maniphest.priorities')),
);
}
diff --git a/src/applications/maniphest/controller/ManiphestBatchEditController.php b/src/applications/maniphest/controller/ManiphestBatchEditController.php
index 58c8ffce1c..a4bf77ef14 100644
--- a/src/applications/maniphest/controller/ManiphestBatchEditController.php
+++ b/src/applications/maniphest/controller/ManiphestBatchEditController.php
@@ -213,7 +213,7 @@ private function buildTransactions($actions, ManiphestTask $task) {
$xactions = array();
foreach ($actions as $action) {
if (empty($type_map[$action['action']])) {
- throw new Exception("Unknown batch edit action '{$action}'!");
+ throw new Exception(pht("Unknown batch edit action '%s'!", $action));
}
$type = $type_map[$action['action']];
diff --git a/src/applications/maniphest/controller/ManiphestExportController.php b/src/applications/maniphest/controller/ManiphestExportController.php
index 9c84c39491..6db04a6e32 100644
--- a/src/applications/maniphest/controller/ManiphestExportController.php
+++ b/src/applications/maniphest/controller/ManiphestExportController.php
@@ -30,8 +30,9 @@ public function processRequest() {
'administrator install it from:');
$inst2 = pht(
- 'Your PHP "include_path" needs to be updated to include the '.
- 'PHPExcel Classes directory.');
+ 'Your PHP "%s" needs to be updated to include the '.
+ 'PHPExcel Classes directory.',
+ 'include_path');
$dialog->setTitle(pht('Excel Export Not Configured'));
$dialog->appendChild(hsprintf(
@@ -78,8 +79,11 @@ public function processRequest() {
$dialog->setUser($user);
$dialog->setTitle(pht('Export Tasks to Excel'));
- $dialog->appendChild(phutil_tag('p', array(), pht(
- 'Do you want to export the query results to Excel?')));
+ $dialog->appendChild(
+ phutil_tag(
+ 'p',
+ array(),
+ pht('Do you want to export the query results to Excel?')));
$form = id(new PHUIFormLayoutView())
->appendChild(
@@ -97,7 +101,7 @@ public function processRequest() {
$format = idx($formats, $request->getStr('excel-format'));
if ($format === null) {
- throw new Exception('Excel format object not found.');
+ throw new Exception(pht('Excel format object not found.'));
}
$saved->makeEphemeral();
diff --git a/src/applications/maniphest/controller/ManiphestReportController.php b/src/applications/maniphest/controller/ManiphestReportController.php
index 3c6eca0542..b03caed542 100644
--- a/src/applications/maniphest/controller/ManiphestReportController.php
+++ b/src/applications/maniphest/controller/ManiphestReportController.php
@@ -172,7 +172,7 @@ public function renderBurn() {
if ($week_bucket != $last_week) {
if ($week) {
$rows[] = $this->formatBurnRow(
- 'Week of '.phabricator_date($last_week_epoch, $user),
+ pht('Week of %s', phabricator_date($last_week_epoch, $user)),
$week);
$rowc[] = 'week';
}
@@ -607,8 +607,8 @@ public function renderOpenTasks() {
array(
'sigil' => 'has-tooltip',
'meta' => array(
- 'tip' => pht('Oldest open task, excluding those with Low or '.
- 'Wishlist priority.'),
+ 'tip' => pht(
+ 'Oldest open task, excluding those with Low or Wishlist priority.'),
'size' => 200,
),
),
diff --git a/src/applications/maniphest/controller/ManiphestTaskEditController.php b/src/applications/maniphest/controller/ManiphestTaskEditController.php
index 915ea6c33a..d9a4e44381 100644
--- a/src/applications/maniphest/controller/ManiphestTaskEditController.php
+++ b/src/applications/maniphest/controller/ManiphestTaskEditController.php
@@ -684,19 +684,7 @@ public function processRequest() {
'tokenizerID' => $project_tokenizer_id,
));
- $description_control = new PhabricatorRemarkupControl();
- // "Upsell" creating tasks via email in create flows if the instance is
- // configured for this awesomeness.
- $email_create = PhabricatorEnv::getEnvConfig(
- 'metamta.maniphest.public-create-email');
- if (!$task->getID() && $email_create) {
- $email_hint = pht(
- 'You can also create tasks by sending an email to: %s',
- phutil_tag('tt', array(), $email_create));
- $description_control->setCaption($email_hint);
- }
-
- $description_control
+ $description_control = id(new PhabricatorRemarkupControl())
->setLabel(pht('Description'))
->setName('description')
->setID('description-textarea')
@@ -706,7 +694,6 @@ public function processRequest() {
$form
->appendChild($description_control);
-
if ($request->isAjax()) {
$dialog = id(new AphrontDialogView())
->setUser($user)
diff --git a/src/applications/maniphest/controller/ManiphestTransactionSaveController.php b/src/applications/maniphest/controller/ManiphestTransactionSaveController.php
index f12171a474..f7693d9416 100644
--- a/src/applications/maniphest/controller/ManiphestTransactionSaveController.php
+++ b/src/applications/maniphest/controller/ManiphestTransactionSaveController.php
@@ -68,7 +68,7 @@ public function processRequest() {
$transaction = null;
break;
default:
- throw new Exception('unknown action');
+ throw new Exception(pht("Unknown action '%s'!", $action));
}
if ($transaction) {
diff --git a/src/applications/maniphest/editor/ManiphestTransactionEditor.php b/src/applications/maniphest/editor/ManiphestTransactionEditor.php
index abc83369bf..3609145c78 100644
--- a/src/applications/maniphest/editor/ManiphestTransactionEditor.php
+++ b/src/applications/maniphest/editor/ManiphestTransactionEditor.php
@@ -167,14 +167,18 @@ protected function applyCustomExternalTransaction(
$board_phid = idx($xaction->getNewValue(), 'projectPHID');
if (!$board_phid) {
throw new Exception(
- pht("Expected 'projectPHID' in column transaction."));
+ pht(
+ "Expected '%s' in column transaction.",
+ 'projectPHID'));
}
$old_phids = idx($xaction->getOldValue(), 'columnPHIDs', array());
$new_phids = idx($xaction->getNewValue(), 'columnPHIDs', array());
if (count($new_phids) !== 1) {
throw new Exception(
- pht("Expected exactly one 'columnPHIDs' in column transaction."));
+ pht(
+ "Expected exactly one '%s' in column transaction.",
+ 'columnPHIDs'));
}
$columns = id(new PhabricatorProjectColumnQuery())
diff --git a/src/applications/maniphest/mail/ManiphestCreateMailReceiver.php b/src/applications/maniphest/mail/ManiphestCreateMailReceiver.php
index 2df618c879..0102b1bd7b 100644
--- a/src/applications/maniphest/mail/ManiphestCreateMailReceiver.php
+++ b/src/applications/maniphest/mail/ManiphestCreateMailReceiver.php
@@ -3,8 +3,8 @@
final class ManiphestCreateMailReceiver extends PhabricatorMailReceiver {
public function isEnabled() {
- $app_class = 'PhabricatorManiphestApplication';
- return PhabricatorApplication::isClassInstalled($app_class);
+ return PhabricatorApplication::isClassInstalled(
+ 'PhabricatorManiphestApplication');
}
public function canAcceptMail(PhabricatorMetaMTAReceivedMail $mail) {
diff --git a/src/applications/maniphest/mail/ManiphestReplyHandler.php b/src/applications/maniphest/mail/ManiphestReplyHandler.php
index f95f203112..af96de70da 100644
--- a/src/applications/maniphest/mail/ManiphestReplyHandler.php
+++ b/src/applications/maniphest/mail/ManiphestReplyHandler.php
@@ -5,7 +5,7 @@ final class ManiphestReplyHandler
public function validateMailReceiver($mail_receiver) {
if (!($mail_receiver instanceof ManiphestTask)) {
- throw new Exception('Mail receiver is not a ManiphestTask!');
+ throw new Exception(pht('Mail receiver is not a %s!', 'ManiphestTask'));
}
}
diff --git a/src/applications/maniphest/mail/ManiphestTaskMailReceiver.php b/src/applications/maniphest/mail/ManiphestTaskMailReceiver.php
index 124b5d8dc6..e69ae82938 100644
--- a/src/applications/maniphest/mail/ManiphestTaskMailReceiver.php
+++ b/src/applications/maniphest/mail/ManiphestTaskMailReceiver.php
@@ -3,8 +3,8 @@
final class ManiphestTaskMailReceiver extends PhabricatorObjectMailReceiver {
public function isEnabled() {
- $app_class = 'PhabricatorManiphestApplication';
- return PhabricatorApplication::isClassInstalled($app_class);
+ return PhabricatorApplication::isClassInstalled(
+ 'PhabricatorManiphestApplication');
}
protected function getObjectPattern() {
diff --git a/src/applications/maniphest/query/ManiphestTaskQuery.php b/src/applications/maniphest/query/ManiphestTaskQuery.php
index 4da078c004..09472be2ab 100644
--- a/src/applications/maniphest/query/ManiphestTaskQuery.php
+++ b/src/applications/maniphest/query/ManiphestTaskQuery.php
@@ -487,7 +487,7 @@ private function buildStatusWhereClause(AphrontDatabaseConnection $conn) {
default:
$constant = idx($map, $this->status);
if (!$constant) {
- throw new Exception("Unknown status query '{$this->status}'!");
+ throw new Exception(pht("Unknown status query '%s'!", $this->status));
}
return qsprintf(
$conn,
diff --git a/src/applications/meta/controller/PhabricatorApplicationEmailCommandsController.php b/src/applications/meta/controller/PhabricatorApplicationEmailCommandsController.php
index c739c3969b..75dffdee31 100644
--- a/src/applications/meta/controller/PhabricatorApplicationEmailCommandsController.php
+++ b/src/applications/meta/controller/PhabricatorApplicationEmailCommandsController.php
@@ -42,36 +42,21 @@ public function handleRequest(AphrontRequest $request) {
"\n\n".
'In most cases, you can reply to email you receive from Phabricator '.
'to leave comments. You can also use **mail commands** to take a '.
- 'greater range of actions (like claming a task or requesting changes '.
+ 'greater range of actions (like claiming a task or requesting changes '.
'to a revision) without needing to log in to the web UI.'.
"\n\n".
'Mail commands are keywords which start with an exclamation point, '.
'like `!claim`. Some commands may take parameters, like '.
- '`!assign alincoln`.'.
- "\n\n".
+ "`!assign alincoln`.\n\n".
'To use mail commands, write one command per line at the beginning '.
'or end of your mail message. For example, you could write this in a '.
'reply to task email to claim the task:'.
- "\n\n".
-
- "```\n".
- "!claim\n".
- "\n".
- "I'll take care of this.\n".
- "```\n".
-
- "\n\n".
+ "\n\n```\n!claim\n\nI'll take care of this.\n```\n\n\n".
"When Phabricator receives your mail, it will process any commands ".
"first, then post the remaining message body as a comment. You can ".
"execute multiple commands at once:".
- "\n\n".
-
- "```\n".
- "!assign alincoln\n".
- "!close\n".
- "\n".
- "I just talked to @alincoln, and he showed me that he fixed this.\n".
- "```\n",
+ "\n\n```\n!assign alincoln\n!close\n\nI just talked to @alincoln, ".
+ "and he showed me that he fixed this.\n```\n",
PhabricatorEnv::getDoclink('Configuring Inbound Email'));
$content[] = '= '.$spec['header'];
diff --git a/src/applications/meta/controller/PhabricatorApplicationUninstallController.php b/src/applications/meta/controller/PhabricatorApplicationUninstallController.php
index 744e9598f8..eaedb3a069 100644
--- a/src/applications/meta/controller/PhabricatorApplicationUninstallController.php
+++ b/src/applications/meta/controller/PhabricatorApplicationUninstallController.php
@@ -31,8 +31,8 @@ public function processRequest() {
'phabricator.show-prototypes');
$dialog = id(new AphrontDialogView())
- ->setUser($user)
- ->addCancelButton($view_uri);
+ ->setUser($user)
+ ->addCancelButton($view_uri);
if ($selected->isPrototype() && !$prototypes_enabled) {
$dialog
@@ -52,14 +52,18 @@ public function processRequest() {
if ($this->action == 'install') {
if ($selected->canUninstall()) {
- $dialog->setTitle('Confirmation')
- ->appendChild(
- 'Install '.$selected->getName().' application?')
- ->addSubmitButton('Install');
+ $dialog
+ ->setTitle('Confirmation')
+ ->appendChild(
+ pht(
+ 'Install %s application?',
+ $selected->getName()))
+ ->addSubmitButton('Install');
} else {
- $dialog->setTitle('Information')
- ->appendChild('You cannot install an installed application.');
+ $dialog
+ ->setTitle('Information')
+ ->appendChild(pht('You cannot install an installed application.'));
}
} else {
if ($selected->canUninstall()) {
@@ -86,10 +90,12 @@ public function processRequest() {
->addSubmitButton(pht('Uninstall'));
}
} else {
- $dialog->setTitle('Information')
- ->appendChild(
- 'This application cannot be uninstalled,
- because it is required for Phabricator to work.');
+ $dialog
+ ->setTitle(pht('Information'))
+ ->appendChild(
+ pht(
+ 'This application cannot be uninstalled, '.
+ 'because it is required for Phabricator to work.'));
}
}
return id(new AphrontDialogResponse())->setDialog($dialog);
diff --git a/src/applications/metamta/adapter/PhabricatorMailImplementationMailgunAdapter.php b/src/applications/metamta/adapter/PhabricatorMailImplementationMailgunAdapter.php
index c812f1ed4a..0890ac3004 100644
--- a/src/applications/metamta/adapter/PhabricatorMailImplementationMailgunAdapter.php
+++ b/src/applications/metamta/adapter/PhabricatorMailImplementationMailgunAdapter.php
@@ -131,7 +131,10 @@ public function send() {
if (!idx($response, 'id')) {
$message = $response['message'];
- throw new Exception("Request failed with errors: {$message}.");
+ throw new Exception(
+ pht(
+ 'Request failed with errors: %s.',
+ $message));
}
return true;
diff --git a/src/applications/metamta/adapter/PhabricatorMailImplementationTestAdapter.php b/src/applications/metamta/adapter/PhabricatorMailImplementationTestAdapter.php
index 234438698b..0ea2af916f 100644
--- a/src/applications/metamta/adapter/PhabricatorMailImplementationTestAdapter.php
+++ b/src/applications/metamta/adapter/PhabricatorMailImplementationTestAdapter.php
@@ -81,12 +81,12 @@ public function supportsMessageIDHeader() {
public function send() {
if (!empty($this->guts['fail-permanently'])) {
throw new PhabricatorMetaMTAPermanentFailureException(
- 'Unit Test (Permanent)');
+ pht('Unit Test (Permanent)'));
}
if (!empty($this->guts['fail-temporarily'])) {
throw new Exception(
- 'Unit Test (Temporary)');
+ pht('Unit Test (Temporary)'));
}
$this->guts['did-send'] = true;
diff --git a/src/applications/metamta/contentsource/PhabricatorContentSourceView.php b/src/applications/metamta/contentsource/PhabricatorContentSourceView.php
index e1a7b8fdaf..f159b2059d 100644
--- a/src/applications/metamta/contentsource/PhabricatorContentSourceView.php
+++ b/src/applications/metamta/contentsource/PhabricatorContentSourceView.php
@@ -26,7 +26,7 @@ public function render() {
array(
'class' => 'phabricator-content-source-view',
),
- "Via {$type}");
+ pht('Via %s', $type));
}
}
diff --git a/src/applications/metamta/controller/PhabricatorMetaMTASendGridReceiveController.php b/src/applications/metamta/controller/PhabricatorMetaMTASendGridReceiveController.php
index 11a0184ffd..646d6ef2ae 100644
--- a/src/applications/metamta/controller/PhabricatorMetaMTASendGridReceiveController.php
+++ b/src/applications/metamta/controller/PhabricatorMetaMTASendGridReceiveController.php
@@ -55,7 +55,7 @@ public function processRequest() {
$received->processReceivedMail();
$response = new AphrontWebpageResponse();
- $response->setContent(pht("Got it! Thanks, SendGrid!\n"));
+ $response->setContent(pht('Got it! Thanks, SendGrid!')."\n");
return $response;
}
diff --git a/src/applications/metamta/management/PhabricatorMailManagementListInboundWorkflow.php b/src/applications/metamta/management/PhabricatorMailManagementListInboundWorkflow.php
index ed02b49681..02ed82a6b0 100644
--- a/src/applications/metamta/management/PhabricatorMailManagementListInboundWorkflow.php
+++ b/src/applications/metamta/management/PhabricatorMailManagementListInboundWorkflow.php
@@ -6,7 +6,7 @@ final class PhabricatorMailManagementListInboundWorkflow
protected function didConstruct() {
$this
->setName('list-inbound')
- ->setSynopsis('List inbound messages received by Phabricator.')
+ ->setSynopsis(pht('List inbound messages received by Phabricator.'))
->setExamples(
'**list-inbound**')
->setArguments(
@@ -15,7 +15,8 @@ protected function didConstruct() {
'name' => 'limit',
'param' => 'N',
'default' => 100,
- 'help' => 'Show a specific number of messages (default 100).',
+ 'help' => pht(
+ 'Show a specific number of messages (default 100).'),
),
));
}
@@ -43,10 +44,10 @@ public function execute(PhutilArgumentParser $args) {
$table = id(new PhutilConsoleTable())
->setShowHeader(false)
- ->addColumn('id', array('title' => 'ID'))
- ->addColumn('author', array('title' => 'Author'))
- ->addColumn('phid', array('title' => 'Related PHID'))
- ->addColumn('subject', array('title' => 'Subject'));
+ ->addColumn('id', array('title' => pht('ID')))
+ ->addColumn('author', array('title' => pht('Author')))
+ ->addColumn('phid', array('title' => pht('Related PHID')))
+ ->addColumn('subject', array('title' => pht('Subject')));
foreach (array_reverse($mails) as $mail) {
$table->addRow(array(
diff --git a/src/applications/metamta/management/PhabricatorMailManagementListOutboundWorkflow.php b/src/applications/metamta/management/PhabricatorMailManagementListOutboundWorkflow.php
index 7357993df7..366f5bdeca 100644
--- a/src/applications/metamta/management/PhabricatorMailManagementListOutboundWorkflow.php
+++ b/src/applications/metamta/management/PhabricatorMailManagementListOutboundWorkflow.php
@@ -6,7 +6,7 @@ final class PhabricatorMailManagementListOutboundWorkflow
protected function didConstruct() {
$this
->setName('list-outbound')
- ->setSynopsis('List outbound messages sent by Phabricator.')
+ ->setSynopsis(pht('List outbound messages sent by Phabricator.'))
->setExamples(
'**list-outbound**')
->setArguments(
@@ -15,7 +15,8 @@ protected function didConstruct() {
'name' => 'limit',
'param' => 'N',
'default' => 100,
- 'help' => 'Show a specific number of messages (default 100).',
+ 'help' => pht(
+ 'Show a specific number of messages (default 100).'),
),
));
}
@@ -35,9 +36,9 @@ public function execute(PhutilArgumentParser $args) {
$table = id(new PhutilConsoleTable())
->setShowHeader(false)
- ->addColumn('id', array('title' => 'ID'))
- ->addColumn('status', array('title' => 'Status'))
- ->addColumn('subject', array('title' => 'Subject'));
+ ->addColumn('id', array('title' => pht('ID')))
+ ->addColumn('status', array('title' => pht('Status')))
+ ->addColumn('subject', array('title' => pht('Subject')));
foreach (array_reverse($mails) as $mail) {
$status = $mail->getStatus();
diff --git a/src/applications/metamta/management/PhabricatorMailManagementReceiveTestWorkflow.php b/src/applications/metamta/management/PhabricatorMailManagementReceiveTestWorkflow.php
index 2ee5fdf886..eb4d05d274 100644
--- a/src/applications/metamta/management/PhabricatorMailManagementReceiveTestWorkflow.php
+++ b/src/applications/metamta/management/PhabricatorMailManagementReceiveTestWorkflow.php
@@ -17,17 +17,17 @@ protected function didConstruct() {
array(
'name' => 'as',
'param' => 'user',
- 'help' => 'Act as the specified user.',
+ 'help' => pht('Act as the specified user.'),
),
array(
'name' => 'from',
'param' => 'email',
- 'help' => 'Simulate mail delivery "From:" the given user.',
+ 'help' => pht('Simulate mail delivery "From:" the given user.'),
),
array(
'name' => 'to',
'param' => 'object',
- 'help' => 'Simulate mail delivery "To:" the given object.',
+ 'help' => pht('Simulate mail delivery "To:" the given object.'),
),
));
}
@@ -38,7 +38,9 @@ public function execute(PhutilArgumentParser $args) {
$to = $args->getArg('to');
if (!$to) {
throw new PhutilArgumentUsageException(
- "Use '--to' to specify the receiving object or email address.");
+ pht(
+ "Use '%s' to specify the receiving object or email address.",
+ '--to'));
}
$to_application_email = id(new PhabricatorMetaMTAApplicationEmailQuery())
@@ -127,10 +129,11 @@ public function execute(PhutilArgumentParser $args) {
if (!($receiver instanceof PhabricatorObjectMailReceiver)) {
$class = get_class($receiver);
throw new Exception(
- "Receiver '%s' accepts mail to '%s', but is not a ".
- "subclass of PhabricatorObjectMailReceiver.",
- $class,
- $to);
+ pht(
+ "Receiver '%s' accepts mail to '%s', but is not a ".
+ "subclass of PhabricatorObjectMailReceiver.",
+ $class,
+ $to));
}
$object = $receiver->loadMailReceiverObject($to, $user);
diff --git a/src/applications/metamta/management/PhabricatorMailManagementResendWorkflow.php b/src/applications/metamta/management/PhabricatorMailManagementResendWorkflow.php
index c08731efe9..7a09324179 100644
--- a/src/applications/metamta/management/PhabricatorMailManagementResendWorkflow.php
+++ b/src/applications/metamta/management/PhabricatorMailManagementResendWorkflow.php
@@ -6,7 +6,7 @@ final class PhabricatorMailManagementResendWorkflow
protected function didConstruct() {
$this
->setName('resend')
- ->setSynopsis('Send mail again.')
+ ->setSynopsis(pht('Send mail again.'))
->setExamples(
'**resend** --id 1 --id 2')
->setArguments(
@@ -14,7 +14,7 @@ protected function didConstruct() {
array(
'name' => 'id',
'param' => 'id',
- 'help' => 'Send mail with a given ID again.',
+ 'help' => pht('Send mail with a given ID again.'),
'repeat' => true,
),
));
@@ -26,7 +26,9 @@ public function execute(PhutilArgumentParser $args) {
$ids = $args->getArg('id');
if (!$ids) {
throw new PhutilArgumentUsageException(
- "Use the '--id' flag to specify one or more messages to resend.");
+ pht(
+ "Use the '%s' flag to specify one or more messages to resend.",
+ '--id'));
}
$messages = id(new PhabricatorMetaMTAMail())->loadAllWhere(
@@ -38,8 +40,9 @@ public function execute(PhutilArgumentParser $args) {
$missing = array_diff_key($ids, $messages);
if ($missing) {
throw new PhutilArgumentUsageException(
- 'Some specified messages do not exist: '.
- implode(', ', array_keys($missing)));
+ pht(
+ 'Some specified messages do not exist: %s',
+ implode(', ', array_keys($missing))));
}
}
@@ -55,8 +58,10 @@ public function execute(PhutilArgumentParser $args) {
));
$console->writeOut(
- "Queued message #%d for resend.\n",
- $message->getID());
+ "%s\n",
+ pht(
+ 'Queued message #%d for resend.',
+ $message->getID()));
}
}
diff --git a/src/applications/metamta/management/PhabricatorMailManagementSendTestWorkflow.php b/src/applications/metamta/management/PhabricatorMailManagementSendTestWorkflow.php
index d36682e9f8..ca1af3a18b 100644
--- a/src/applications/metamta/management/PhabricatorMailManagementSendTestWorkflow.php
+++ b/src/applications/metamta/management/PhabricatorMailManagementSendTestWorkflow.php
@@ -10,51 +10,50 @@ protected function didConstruct() {
pht(
'Simulate sending mail. This may be useful to test your mail '.
'configuration, or while developing new mail adapters.'))
- ->setExamples(
- '**send-test** --to alincoln --subject hi < body.txt')
+ ->setExamples('**send-test** --to alincoln --subject hi < body.txt')
->setArguments(
array(
array(
'name' => 'from',
'param' => 'user',
- 'help' => 'Send mail from the specified user.',
+ 'help' => pht('Send mail from the specified user.'),
),
array(
'name' => 'to',
'param' => 'user',
- 'help' => 'Send mail "To:" the specified users.',
+ 'help' => pht('Send mail "To:" the specified users.'),
'repeat' => true,
),
array(
'name' => 'cc',
'param' => 'user',
- 'help' => 'Send mail which "Cc:"s the specified users.',
+ 'help' => pht('Send mail which "Cc:"s the specified users.'),
'repeat' => true,
),
array(
'name' => 'subject',
'param' => 'text',
- 'help' => 'Use the provided subject.',
+ 'help' => pht('Use the provided subject.'),
),
array(
'name' => 'tag',
'param' => 'text',
- 'help' => 'Add the given mail tags.',
+ 'help' => pht('Add the given mail tags.'),
'repeat' => true,
),
array(
'name' => 'attach',
'param' => 'file',
- 'help' => 'Attach a file.',
+ 'help' => pht('Attach a file.'),
'repeat' => true,
),
array(
'name' => 'html',
- 'help' => 'Send as HTML mail.',
+ 'help' => pht('Send as HTML mail.'),
),
array(
'name' => 'bulk',
- 'help' => 'Send with bulk headers.',
+ 'help' => pht('Send with bulk headers.'),
),
));
}
@@ -82,8 +81,9 @@ public function execute(PhutilArgumentParser $args) {
if (!$tos && !$ccs) {
throw new PhutilArgumentUsageException(
pht(
- 'Specify one or more users to send mail to with `--to` and '.
- '`--cc`.'));
+ 'Specify one or more users to send mail to with `%s` and `%s`.',
+ '--to',
+ '--cc'));
}
$names = array_merge($tos, $ccs);
@@ -131,8 +131,10 @@ public function execute(PhutilArgumentParser $args) {
if ($args->getArg('html')) {
$mail->setBody(
- pht('(This is a placeholder plaintext email body for a test message '.
- 'sent with --html.)'));
+ pht(
+ '(This is a placeholder plaintext email body for a test message '.
+ 'sent with %s.)',
+ '--html'));
$mail->setHTMLBody($body);
} else {
diff --git a/src/applications/metamta/management/PhabricatorMailManagementShowInboundWorkflow.php b/src/applications/metamta/management/PhabricatorMailManagementShowInboundWorkflow.php
index 7131187fa7..b9c0cd7d64 100644
--- a/src/applications/metamta/management/PhabricatorMailManagementShowInboundWorkflow.php
+++ b/src/applications/metamta/management/PhabricatorMailManagementShowInboundWorkflow.php
@@ -6,7 +6,7 @@ final class PhabricatorMailManagementShowInboundWorkflow
protected function didConstruct() {
$this
->setName('show-inbound')
- ->setSynopsis('Show diagnostic details about inbound mail.')
+ ->setSynopsis(pht('Show diagnostic details about inbound mail.'))
->setExamples(
'**show-inbound** --id 1 --id 2')
->setArguments(
@@ -14,7 +14,7 @@ protected function didConstruct() {
array(
'name' => 'id',
'param' => 'id',
- 'help' => 'Show details about inbound mail with given ID.',
+ 'help' => pht('Show details about inbound mail with given ID.'),
'repeat' => true,
),
));
@@ -26,7 +26,9 @@ public function execute(PhutilArgumentParser $args) {
$ids = $args->getArg('id');
if (!$ids) {
throw new PhutilArgumentUsageException(
- "Use the '--id' flag to specify one or more messages to show.");
+ pht(
+ "Use the '%s' flag to specify one or more messages to show.",
+ '--id'));
}
$messages = id(new PhabricatorMetaMTAReceivedMail())->loadAllWhere(
@@ -38,8 +40,9 @@ public function execute(PhutilArgumentParser $args) {
$missing = array_diff_key($ids, $messages);
if ($missing) {
throw new PhutilArgumentUsageException(
- 'Some specified messages do not exist: '.
- implode(', ', array_keys($missing)));
+ pht(
+ 'Some specified messages do not exist: %s',
+ implode(', ', array_keys($missing))));
}
}
diff --git a/src/applications/metamta/management/PhabricatorMailManagementShowOutboundWorkflow.php b/src/applications/metamta/management/PhabricatorMailManagementShowOutboundWorkflow.php
index 3b798259b4..bc8f4ccbaf 100644
--- a/src/applications/metamta/management/PhabricatorMailManagementShowOutboundWorkflow.php
+++ b/src/applications/metamta/management/PhabricatorMailManagementShowOutboundWorkflow.php
@@ -6,7 +6,7 @@ final class PhabricatorMailManagementShowOutboundWorkflow
protected function didConstruct() {
$this
->setName('show-outbound')
- ->setSynopsis('Show diagnostic details about outbound mail.')
+ ->setSynopsis(pht('Show diagnostic details about outbound mail.'))
->setExamples(
'**show-outbound** --id 1 --id 2')
->setArguments(
@@ -14,7 +14,7 @@ protected function didConstruct() {
array(
'name' => 'id',
'param' => 'id',
- 'help' => 'Show details about outbound mail with given ID.',
+ 'help' => pht('Show details about outbound mail with given ID.'),
'repeat' => true,
),
array(
@@ -32,7 +32,9 @@ public function execute(PhutilArgumentParser $args) {
$ids = $args->getArg('id');
if (!$ids) {
throw new PhutilArgumentUsageException(
- "Use the '--id' flag to specify one or more messages to show.");
+ pht(
+ "Use the '%s' flag to specify one or more messages to show.",
+ '--id'));
}
$messages = id(new PhabricatorMetaMTAMail())->loadAllWhere(
@@ -44,8 +46,9 @@ public function execute(PhutilArgumentParser $args) {
$missing = array_diff_key($ids, $messages);
if ($missing) {
throw new PhutilArgumentUsageException(
- 'Some specified messages do not exist: '.
- implode(', ', array_keys($missing)));
+ pht(
+ 'Some specified messages do not exist: %s',
+ implode(', ', array_keys($missing))));
}
}
diff --git a/src/applications/metamta/receiver/__tests__/PhabricatorMailReceiverTestCase.php b/src/applications/metamta/receiver/__tests__/PhabricatorMailReceiverTestCase.php
index ff7647bc17..f5b6ab578a 100644
--- a/src/applications/metamta/receiver/__tests__/PhabricatorMailReceiverTestCase.php
+++ b/src/applications/metamta/receiver/__tests__/PhabricatorMailReceiverTestCase.php
@@ -33,7 +33,7 @@ public function testAddressSimilarity() {
foreach ($diff as $address) {
$this->assertFalse(
PhabricatorMailReceiver::matchAddresses($base, $address),
- "Address: {$address}");
+ pht('Address: %s', $address));
}
}
diff --git a/src/applications/metamta/storage/PhabricatorMetaMTAMail.php b/src/applications/metamta/storage/PhabricatorMetaMTAMail.php
index 05a3f6b56e..07129d9e06 100644
--- a/src/applications/metamta/storage/PhabricatorMetaMTAMail.php
+++ b/src/applications/metamta/storage/PhabricatorMetaMTAMail.php
@@ -390,7 +390,7 @@ public function sendNow(
if (!$force_send) {
if ($this->getStatus() != self::STATUS_QUEUE) {
- throw new Exception('Trying to send an already-sent mail!');
+ throw new Exception(pht('Trying to send an already-sent mail!'));
}
}
@@ -622,8 +622,9 @@ public function sendNow(
if (!$add_to && !$add_cc) {
$this->setStatus(self::STATUS_VOID);
$this->setMessage(
- 'Message has no valid recipients: all To/Cc are disabled, invalid, '.
- 'or configured not to receive this mail.');
+ pht(
+ 'Message has no valid recipients: all To/Cc are disabled, '.
+ 'invalid, or configured not to receive this mail.'));
return $this->save();
}
@@ -644,8 +645,9 @@ public function sendNow(
$this->setStatus(self::STATUS_VOID);
$this->setMessage(
pht(
- 'Phabricator is running in silent mode. See `phabricator.silent` '.
- 'in the configuration to change this setting.'));
+ 'Phabricator is running in silent mode. See `%s` '.
+ 'in the configuration to change this setting.',
+ 'phabricator.silent'));
return $this->save();
}
@@ -727,11 +729,11 @@ public function sendNow(
}
public static function getReadableStatus($status_code) {
- static $readable = array(
- self::STATUS_QUEUE => 'Queued for Delivery',
- self::STATUS_FAIL => 'Delivery Failed',
- self::STATUS_SENT => 'Sent',
- self::STATUS_VOID => 'Void',
+ $readable = array(
+ self::STATUS_QUEUE => pht('Queued for Delivery'),
+ self::STATUS_FAIL => pht('Delivery Failed'),
+ self::STATUS_SENT => pht('Sent'),
+ self::STATUS_VOID => pht('Void'),
);
$status_code = coalesce($status_code, '?');
return idx($readable, $status_code, $status_code);
diff --git a/src/applications/metamta/storage/PhabricatorMetaMTAReceivedMail.php b/src/applications/metamta/storage/PhabricatorMetaMTAReceivedMail.php
index 91634fe577..0f17f08d53 100644
--- a/src/applications/metamta/storage/PhabricatorMetaMTAReceivedMail.php
+++ b/src/applications/metamta/storage/PhabricatorMetaMTAReceivedMail.php
@@ -220,8 +220,8 @@ private function dropMailFromPhabricator() {
throw new PhabricatorMetaMTAReceivedMailProcessingException(
MetaMTAReceivedMailStatus::STATUS_FROM_PHABRICATOR,
pht(
- "Ignoring email with 'X-Phabricator-Sent-This-Message' header to ".
- "avoid loops."));
+ "Ignoring email with '%s' header to avoid loops.",
+ 'X-Phabricator-Sent-This-Message'));
}
/**
diff --git a/src/applications/metamta/storage/__tests__/PhabricatorMetaMTAMailTestCase.php b/src/applications/metamta/storage/__tests__/PhabricatorMetaMTAMailTestCase.php
index 5822b11a98..97369f054a 100644
--- a/src/applications/metamta/storage/__tests__/PhabricatorMetaMTAMailTestCase.php
+++ b/src/applications/metamta/storage/__tests__/PhabricatorMetaMTAMailTestCase.php
@@ -69,7 +69,7 @@ public function testRecipients() {
$this->assertTrue(
in_array($phid, $mail->buildRecipientList()),
- '"To" is a recipient.');
+ pht('"To" is a recipient.'));
// Test that the "No Self Mail" and "No Mail" preferences work correctly.
@@ -77,7 +77,7 @@ public function testRecipients() {
$this->assertTrue(
in_array($phid, $mail->buildRecipientList()),
- '"From" does not exclude recipients by default.');
+ pht('"From" does not exclude recipients by default.'));
$prefs->setPreference(
PhabricatorUserPreferences::PREFERENCE_NO_SELF_MAIL,
@@ -86,7 +86,7 @@ public function testRecipients() {
$this->assertFalse(
in_array($phid, $mail->buildRecipientList()),
- '"From" excludes recipients with no-self-mail set.');
+ pht('"From" excludes recipients with no-self-mail set.'));
$prefs->unsetPreference(
PhabricatorUserPreferences::PREFERENCE_NO_SELF_MAIL);
@@ -94,7 +94,7 @@ public function testRecipients() {
$this->assertTrue(
in_array($phid, $mail->buildRecipientList()),
- '"From" does not exclude recipients by default.');
+ pht('"From" does not exclude recipients by default.'));
$prefs->setPreference(
PhabricatorUserPreferences::PREFERENCE_NO_MAIL,
@@ -103,13 +103,13 @@ public function testRecipients() {
$this->assertFalse(
in_array($phid, $mail->buildRecipientList()),
- '"From" excludes recipients with no-mail set.');
+ pht('"From" excludes recipients with no-mail set.'));
$mail->setForceDelivery(true);
$this->assertTrue(
in_array($phid, $mail->buildRecipientList()),
- '"From" includes no-mail recipients when forced.');
+ pht('"From" includes no-mail recipients when forced.'));
$mail->setForceDelivery(false);
@@ -119,7 +119,7 @@ public function testRecipients() {
$this->assertTrue(
in_array($phid, $mail->buildRecipientList()),
- '"From" does not exclude recipients by default.');
+ pht('"From" does not exclude recipients by default.'));
// Test that explicit exclusion works correctly.
@@ -127,7 +127,7 @@ public function testRecipients() {
$this->assertFalse(
in_array($phid, $mail->buildRecipientList()),
- 'Explicit exclude excludes recipients.');
+ pht('Explicit exclude excludes recipients.'));
$mail->setExcludeMailRecipientPHIDs(array());
@@ -144,7 +144,7 @@ public function testRecipients() {
$this->assertFalse(
in_array($phid, $mail->buildRecipientList()),
- 'Tag preference excludes recipients.');
+ pht('Tag preference excludes recipients.'));
$prefs->unsetPreference(PhabricatorUserPreferences::PREFERENCE_MAILTAGS);
$prefs->save();
@@ -194,19 +194,25 @@ private function runThreadIDHeadersWithConfiguration(
$this->assertTrue(
isset($dict['Thread-Index']),
- "Expect Thread-Index header for case {$case}.");
+ pht('Expect Thread-Index header for case %s.', $case));
$this->assertEqual(
$expect_message_id,
isset($dict['Message-ID']),
- "Expectation about existence of Message-ID header for case {$case}.");
+ pht(
+ 'Expectation about existence of Message-ID header for case %s.',
+ $case));
$this->assertEqual(
$expect_in_reply_to,
isset($dict['In-Reply-To']),
- "Expectation about existence of In-Reply-To header for case {$case}.");
+ pht(
+ 'Expectation about existence of In-Reply-To header for case %s.',
+ $case));
$this->assertEqual(
$expect_references,
isset($dict['References']),
- "Expectation about existence of References header for case {$case}.");
+ pht(
+ 'Expectation about existence of References header for case %s.',
+ $case));
}
}
diff --git a/src/applications/notification/controller/PhabricatorNotificationClearController.php b/src/applications/notification/controller/PhabricatorNotificationClearController.php
index 94ee8aa0f3..ba781234e7 100644
--- a/src/applications/notification/controller/PhabricatorNotificationClearController.php
+++ b/src/applications/notification/controller/PhabricatorNotificationClearController.php
@@ -27,7 +27,7 @@ public function processRequest() {
$dialog->setUser($user);
$dialog->addCancelButton('/notification/');
if ($chrono_key) {
- $dialog->setTitle('Really mark all notifications as read?');
+ $dialog->setTitle(pht('Really mark all notifications as read?'));
$dialog->addHiddenInput('chronoKey', $chrono_key);
$is_serious =
@@ -45,9 +45,8 @@ public function processRequest() {
$dialog->addSubmitButton(pht('Mark All Read'));
} else {
- $dialog->setTitle('No notifications to mark as read.');
- $dialog->appendChild(pht(
- 'You have no unread notifications.'));
+ $dialog->setTitle(pht('No notifications to mark as read.'));
+ $dialog->appendChild(pht('You have no unread notifications.'));
}
return id(new AphrontDialogResponse())->setDialog($dialog);
diff --git a/src/applications/notification/controller/PhabricatorNotificationStatusController.php b/src/applications/notification/controller/PhabricatorNotificationStatusController.php
index 398586e59e..2c9e308985 100644
--- a/src/applications/notification/controller/PhabricatorNotificationStatusController.php
+++ b/src/applications/notification/controller/PhabricatorNotificationStatusController.php
@@ -9,13 +9,13 @@ public function processRequest() {
$status = $this->renderServerStatus($status);
} catch (Exception $ex) {
$status = new PHUIInfoView();
- $status->setTitle('Notification Server Issue');
+ $status->setTitle(pht('Notification Server Issue'));
$status->appendChild(hsprintf(
- 'Unable to determine server status. This probably means the server '.
- 'is not in great shape. The specific issue encountered was:'.
- ' '.
- ' '.
+ '%s
'.
'%s %s',
+ pht(
+ 'Unable to determine server status. This probably means the server '.
+ 'is not in great shape. The specific issue encountered was:'),
get_class($ex),
phutil_escape_html_newlines($ex->getMessage())));
}
diff --git a/src/applications/notification/setup/PhabricatorAphlictSetupCheck.php b/src/applications/notification/setup/PhabricatorAphlictSetupCheck.php
index 91096c8240..99dba45ec4 100644
--- a/src/applications/notification/setup/PhabricatorAphlictSetupCheck.php
+++ b/src/applications/notification/setup/PhabricatorAphlictSetupCheck.php
@@ -13,12 +13,10 @@ protected function executeChecks() {
$status = PhabricatorNotificationClient::getServerStatus();
} catch (Exception $ex) {
$message = pht(
- 'Phabricator is configured to use a notification server, but '.
- 'is unable to connect to it. You should resolve this issue or '.
- 'disable the notification server. It may be helpful to double check '.
- 'your configuration or restart the server using the command below.'.
- "\n\n".
- "%s",
+ "Phabricator is configured to use a notification server, but is ".
+ "unable to connect to it. You should resolve this issue or disable ".
+ "the notification server. It may be helpful to double check your ".
+ "configuration or restart the server using the command below.\n\n%s",
phutil_tag(
'pre',
array(),
diff --git a/src/applications/nuance/controller/NuanceQueueViewController.php b/src/applications/nuance/controller/NuanceQueueViewController.php
index d863cda0ed..261b528193 100644
--- a/src/applications/nuance/controller/NuanceQueueViewController.php
+++ b/src/applications/nuance/controller/NuanceQueueViewController.php
@@ -31,7 +31,7 @@ public function processRequest() {
}
$crumbs = $this->buildApplicationCrumbs();
- $title = 'TODO';
+ $title = pht('TODO');
return $this->buildApplicationPage(
$crumbs,
diff --git a/src/applications/nuance/controller/NuanceRequestorEditController.php b/src/applications/nuance/controller/NuanceRequestorEditController.php
index 1938655474..42405a227f 100644
--- a/src/applications/nuance/controller/NuanceRequestorEditController.php
+++ b/src/applications/nuance/controller/NuanceRequestorEditController.php
@@ -38,7 +38,7 @@ public function processRequest() {
}
$crumbs = $this->buildApplicationCrumbs();
- $title = 'TODO';
+ $title = pht('TODO');
return $this->buildApplicationPage(
$crumbs,
diff --git a/src/applications/nuance/source/NuancePhabricatorFormSourceDefinition.php b/src/applications/nuance/source/NuancePhabricatorFormSourceDefinition.php
index 6ebb07d0fb..1d49b17c55 100644
--- a/src/applications/nuance/source/NuancePhabricatorFormSourceDefinition.php
+++ b/src/applications/nuance/source/NuancePhabricatorFormSourceDefinition.php
@@ -20,7 +20,7 @@ protected function augmentEditForm(
PhabricatorApplicationTransactionValidationException $ex = null) {
/* TODO - add a box to allow for custom fields to be defined here, so that
- * these NuanceSource objects made from this defintion can be used to
+ * these NuanceSource objects made from this definition can be used to
* capture arbitrary data */
return $form;
diff --git a/src/applications/nuance/source/NuanceSourceDefinition.php b/src/applications/nuance/source/NuanceSourceDefinition.php
index e643daa0b1..b2092dfdff 100644
--- a/src/applications/nuance/source/NuanceSourceDefinition.php
+++ b/src/applications/nuance/source/NuanceSourceDefinition.php
@@ -15,7 +15,7 @@ public function getActor() {
public function requireActor() {
$actor = $this->getActor();
if (!$actor) {
- throw new Exception('You must "setActor()" first!');
+ throw new PhutilInvalidStateException('setActor');
}
return $actor;
}
@@ -31,7 +31,7 @@ public function getSourceObject() {
public function requireSourceObject() {
$source = $this->getSourceObject();
if (!$source) {
- throw new Exception('You must "setSourceObject()" first!');
+ throw new PhutilInvalidStateException('setSourceObject');
}
return $source;
}
@@ -75,11 +75,12 @@ public static function getAllDefinitions() {
$name = $definition->getName();
if (isset($definitions[$key])) {
$conflict = $definitions[$key];
- throw new Exception(sprintf(
- 'Defintion %s conflicts with definition %s. This is a programming '.
- 'error.',
- $conflict,
- $name));
+ throw new Exception(
+ pht(
+ 'Definition %s conflicts with definition %s. This is a '.
+ 'programming error.',
+ $conflict,
+ $name));
}
}
$definitions = $objects;
diff --git a/src/applications/oauthserver/PhabricatorOAuthServer.php b/src/applications/oauthserver/PhabricatorOAuthServer.php
index b7dc0d6301..5f75083c89 100644
--- a/src/applications/oauthserver/PhabricatorOAuthServer.php
+++ b/src/applications/oauthserver/PhabricatorOAuthServer.php
@@ -36,7 +36,7 @@ final class PhabricatorOAuthServer {
private function getUser() {
if (!$this->user) {
- throw new Exception('You must setUser before you can getUser!');
+ throw new PhutilInvalidStateException('setUser');
}
return $this->user;
}
@@ -48,7 +48,7 @@ public function setUser(PhabricatorUser $user) {
private function getClient() {
if (!$this->client) {
- throw new Exception('You must setClient before you can getClient!');
+ throw new PhutilInvalidStateException('setClient');
}
return $this->client;
}
@@ -65,16 +65,16 @@ public function setClient(PhabricatorOAuthServerClient $client) {
public function userHasAuthorizedClient(array $scope) {
$authorization = id(new PhabricatorOAuthClientAuthorization())->
- loadOneWhere('userPHID = %s AND clientPHID = %s',
- $this->getUser()->getPHID(),
- $this->getClient()->getPHID());
+ loadOneWhere(
+ 'userPHID = %s AND clientPHID = %s',
+ $this->getUser()->getPHID(),
+ $this->getClient()->getPHID());
if (empty($authorization)) {
return array(false, null);
}
if ($scope) {
- $missing_scope = array_diff_key($scope,
- $authorization->getScope());
+ $missing_scope = array_diff_key($scope, $authorization->getScope());
} else {
$missing_scope = false;
}
@@ -166,10 +166,10 @@ public function validateAccessToken(
$must_be_used_by = $created_time + self::ACCESS_TOKEN_TIMEOUT;
$expired = time() > $must_be_used_by;
$authorization = id(new PhabricatorOAuthClientAuthorization())
- ->loadOneWhere(
- 'userPHID = %s AND clientPHID = %s',
- $token->getUserPHID(),
- $token->getClientPHID());
+ ->loadOneWhere(
+ 'userPHID = %s AND clientPHID = %s',
+ $token->getUserPHID(),
+ $token->getClientPHID());
if (!$authorization) {
return false;
diff --git a/src/applications/oauthserver/PhabricatorOAuthServerScope.php b/src/applications/oauthserver/PhabricatorOAuthServerScope.php
index 38707fa3c3..dcba6b6234 100644
--- a/src/applications/oauthserver/PhabricatorOAuthServerScope.php
+++ b/src/applications/oauthserver/PhabricatorOAuthServerScope.php
@@ -60,10 +60,10 @@ static private function getCheckboxLabel($scope) {
$label = null;
switch ($scope) {
case self::SCOPE_OFFLINE_ACCESS:
- $label = 'Make access tokens granted to this client never expire.';
+ $label = pht('Make access tokens granted to this client never expire.');
break;
case self::SCOPE_WHOAMI:
- $label = 'Read access to Conduit method user.whoami.';
+ $label = pht('Read access to Conduit method %s.', 'user.whoami');
break;
}
diff --git a/src/applications/oauthserver/__tests__/PhabricatorOAuthServerTestCase.php b/src/applications/oauthserver/__tests__/PhabricatorOAuthServerTestCase.php
index 30fea69a94..2fa1778f51 100644
--- a/src/applications/oauthserver/__tests__/PhabricatorOAuthServerTestCase.php
+++ b/src/applications/oauthserver/__tests__/PhabricatorOAuthServerTestCase.php
@@ -18,7 +18,7 @@ public function testValidateRedirectURI() {
$this->assertEqual(
$expected,
$result,
- "Validation of redirect URI '{$input}'");
+ pht("Validation of redirect URI '%s'", $input));
}
}
@@ -39,8 +39,10 @@ public function testValidateSecondaryRedirectURI() {
$this->assertEqual(
$expected,
$server->validateSecondaryRedirectURI($uri, $primary_uri),
- "Validation of redirect URI '{$input}' ".
- "relative to '{$primary_uri}'");
+ pht(
+ "Validation of redirect URI '%s' relative to '%s'",
+ $input,
+ $primary_uri));
}
$primary_uri = new PhutilURI('http://www.google.com/?auth');
@@ -57,8 +59,10 @@ public function testValidateSecondaryRedirectURI() {
$this->assertEqual(
$expected,
$server->validateSecondaryRedirectURI($uri, $primary_uri),
- "Validation of secondary redirect URI '{$input}' ".
- "relative to '{$primary_uri}'");
+ pht(
+ "Validation of secondary redirect URI '%s' relative to '%s'",
+ $input,
+ $primary_uri));
}
$primary_uri = new PhutilURI('https://secure.example.com/');
@@ -71,7 +75,7 @@ public function testValidateSecondaryRedirectURI() {
$this->assertEqual(
$expected,
$server->validateSecondaryRedirectURI($uri, $primary_uri),
- "Validation (https): {$input}");
+ pht('Validation (https): %s', $input));
}
$primary_uri = new PhutilURI('http://example.com/?z=2&y=3');
@@ -88,7 +92,7 @@ public function testValidateSecondaryRedirectURI() {
$this->assertEqual(
$expected,
$server->validateSecondaryRedirectURI($uri, $primary_uri),
- "Validation (params): {$input}");
+ pht('Validation (params): %s', $input));
}
}
diff --git a/src/applications/oauthserver/controller/PhabricatorOAuthServerController.php b/src/applications/oauthserver/controller/PhabricatorOAuthServerController.php
index 1c0dc588ba..22388c8766 100644
--- a/src/applications/oauthserver/controller/PhabricatorOAuthServerController.php
+++ b/src/applications/oauthserver/controller/PhabricatorOAuthServerController.php
@@ -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);
diff --git a/src/applications/oauthserver/controller/PhabricatorOAuthServerTokenController.php b/src/applications/oauthserver/controller/PhabricatorOAuthServerTokenController.php
index 5b3db13fb9..aa9b8f71a0 100644
--- a/src/applications/oauthserver/controller/PhabricatorOAuthServerTokenController.php
+++ b/src/applications/oauthserver/controller/PhabricatorOAuthServerTokenController.php
@@ -26,25 +26,31 @@ public function processRequest() {
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 @@ public function processRequest() {
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 @@ public function processRequest() {
$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 @@ public function processRequest() {
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 @@ public function processRequest() {
$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 @@ public function processRequest() {
} 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;
}
}
diff --git a/src/applications/oauthserver/controller/client/PhabricatorOAuthClientEditController.php b/src/applications/oauthserver/controller/client/PhabricatorOAuthClientEditController.php
index 1f1b0e387b..cd194aa74b 100644
--- a/src/applications/oauthserver/controller/client/PhabricatorOAuthClientEditController.php
+++ b/src/applications/oauthserver/controller/client/PhabricatorOAuthClientEditController.php
@@ -82,13 +82,13 @@ public function processRequest() {
->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))
diff --git a/src/applications/oauthserver/controller/client/PhabricatorOAuthClientSecretController.php b/src/applications/oauthserver/controller/client/PhabricatorOAuthClientSecretController.php
index cdfc53e5b4..ceb1379b7a 100644
--- a/src/applications/oauthserver/controller/client/PhabricatorOAuthClientSecretController.php
+++ b/src/applications/oauthserver/controller/client/PhabricatorOAuthClientSecretController.php
@@ -50,11 +50,11 @@ public function handleRequest(AphrontRequest $request) {
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!');
diff --git a/src/applications/oauthserver/panel/PhabricatorOAuthServerAuthorizationsSettingsPanel.php b/src/applications/oauthserver/panel/PhabricatorOAuthServerAuthorizationsSettingsPanel.php
index 8504c97ce1..2e2cff1742 100644
--- a/src/applications/oauthserver/panel/PhabricatorOAuthServerAuthorizationsSettingsPanel.php
+++ b/src/applications/oauthserver/panel/PhabricatorOAuthServerAuthorizationsSettingsPanel.php
@@ -16,8 +16,8 @@ public function getPanelGroup() {
}
public function isEnabled() {
- $app_name = 'PhabricatorOAuthServerApplication';
- return PhabricatorApplication::isClassInstalled($app_name);
+ return PhabricatorApplication::isClassInstalled(
+ 'PhabricatorOAuthServerApplication');
}
public function processRequest(AphrontRequest $request) {
@@ -108,8 +108,7 @@ public function processRequest(AphrontRequest $request) {
$table = new AphrontTableView($rows);
$table->setNoDataString(
- pht(
- "You haven't authorized any OAuth applications."));
+ pht("You haven't authorized any OAuth applications."));
$table->setRowClasses($rowc);
$table->setHeaders(
diff --git a/src/applications/owners/application/PhabricatorOwnersApplication.php b/src/applications/owners/application/PhabricatorOwnersApplication.php
index ba44293016..3ed14212dc 100644
--- a/src/applications/owners/application/PhabricatorOwnersApplication.php
+++ b/src/applications/owners/application/PhabricatorOwnersApplication.php
@@ -42,12 +42,11 @@ public function getApplicationGroup() {
public function getRoutes() {
return array(
'/owners/' => array(
- '' => 'PhabricatorOwnersListController',
- 'view/(?P[^/]+)/' => 'PhabricatorOwnersListController',
+ '(?:query/(?P[^/]+)/)?' => 'PhabricatorOwnersListController',
'edit/(?P[1-9]\d*)/' => 'PhabricatorOwnersEditController',
'new/' => 'PhabricatorOwnersEditController',
'package/(?P[1-9]\d*)/' => 'PhabricatorOwnersDetailController',
- 'delete/(?P[1-9]\d*)/' => 'PhabricatorOwnersDeleteController',
+ 'paths/(?P[1-9]\d*)/' => 'PhabricatorOwnersPathsController',
),
);
}
diff --git a/src/applications/owners/conduit/OwnersQueryConduitAPIMethod.php b/src/applications/owners/conduit/OwnersQueryConduitAPIMethod.php
index f62c456283..5473ec6e00 100644
--- a/src/applications/owners/conduit/OwnersQueryConduitAPIMethod.php
+++ b/src/applications/owners/conduit/OwnersQueryConduitAPIMethod.php
@@ -7,10 +7,11 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return 'Query for packages by one of the following: repository/path, '.
+ return pht(
+ 'Query for packages by one of the following: repository/path, '.
'packages with a given user or project owner, or packages affiliated '.
'with a user (owned by either the user or a project they are a member '.
- 'of.) You should only provide at most one search query.';
+ 'of.) You should only provide at most one search query.');
}
protected function defineParamTypes() {
@@ -29,11 +30,11 @@ protected function defineReturnType() {
protected function defineErrorTypes() {
return array(
- 'ERR-INVALID-USAGE' =>
+ 'ERR-INVALID-USAGE' => pht(
'Provide one of a single owner phid (user/project), a single '.
- 'affiliated user phid (user), or a repository/path.',
- 'ERR-INVALID-PARAMETER' => 'parameter should be a phid',
- 'ERR_REP_NOT_FOUND' => 'The repository callsign is not recognized',
+ 'affiliated user phid (user), or a repository/path.'),
+ 'ERR-INVALID-PARAMETER' => pht('Parameter should be a phid.'),
+ 'ERR_REP_NOT_FOUND' => pht('The repository callsign is not recognized.'),
);
}
@@ -49,7 +50,9 @@ protected static function queryByOwner($owner) {
if (!$is_valid_phid) {
throw id(new ConduitException('ERR-INVALID-PARAMETER'))
->setErrorDescription(
- 'Expected user/project PHID for owner, got '.$owner);
+ pht(
+ 'Expected user/project PHID for owner, got %s.',
+ $owner));
}
$owners = id(new PhabricatorOwnersOwner())->loadAllWhere(
@@ -77,7 +80,9 @@ private static function queryByPath(
if (!$repository) {
throw id(new ConduitException('ERR_REP_NOT_FOUND'))
->setErrorDescription(
- 'Repository callsign '.$repo_callsign.' not recognized');
+ pht(
+ 'Repository callsign %s not recognized',
+ $repo_callsign));
}
if ($path == null) {
return PhabricatorOwnersPackage::loadPackagesForRepository($repository);
diff --git a/src/applications/owners/controller/PhabricatorOwnersController.php b/src/applications/owners/controller/PhabricatorOwnersController.php
index 4066b297dc..aa2e618775 100644
--- a/src/applications/owners/controller/PhabricatorOwnersController.php
+++ b/src/applications/owners/controller/PhabricatorOwnersController.php
@@ -1,70 +1,3 @@
filter;
- }
- protected function setSideNavFilter($filter) {
- $this->filter = $filter;
- return $this;
- }
-
- public function buildSideNavView() {
- $nav = new AphrontSideNavFilterView();
- $base_uri = new PhutilURI('/owners/');
- $nav->setBaseURI($base_uri);
-
- $nav->addLabel(pht('Packages'));
- $this->getExtraPackageViews($nav);
- $nav->addFilter('view/owned', pht('Owned'));
- $nav->addFilter('view/projects', pht('Projects'));
- $nav->addFilter('view/all', pht('All'));
-
- $nav->selectFilter($this->getSideNavFilter(), 'view/owned');
-
- $filter = $nav->getSelectedFilter();
- switch ($filter) {
- case 'view/owned':
- $title = pht('Owned Packages');
- break;
- case 'view/all':
- $title = pht('All Packages');
- break;
- case 'view/projects':
- $title = pht('Projects');
- break;
- case 'new':
- $title = pht('New Package');
- break;
- default:
- $title = pht('Package');
- break;
- }
-
- return $nav;
- }
-
- protected function buildApplicationCrumbs() {
- $crumbs = parent::buildApplicationCrumbs();
-
- $crumbs->addAction(
- id(new PHUIListItemView())
- ->setName(pht('Create Package'))
- ->setHref('/owners/new/')
- ->setIcon('fa-plus-square'));
-
- return $crumbs;
- }
-
- public function buildApplicationMenu() {
- return $this->buildSideNavView()->getMenu();
- }
-
- protected function getExtraPackageViews(AphrontSideNavFilterView $view) {
- return;
- }
-
-}
+abstract class PhabricatorOwnersController extends PhabricatorController {}
diff --git a/src/applications/owners/controller/PhabricatorOwnersDeleteController.php b/src/applications/owners/controller/PhabricatorOwnersDeleteController.php
deleted file mode 100644
index 4f14ddf66a..0000000000
--- a/src/applications/owners/controller/PhabricatorOwnersDeleteController.php
+++ /dev/null
@@ -1,42 +0,0 @@
-id = $data['id'];
- }
-
- public function processRequest() {
- $request = $this->getRequest();
- $user = $request->getUser();
-
- $package = id(new PhabricatorOwnersPackage())->load($this->id);
- if (!$package) {
- return new Aphront404Response();
- }
-
- if ($request->isDialogFormPost()) {
- id(new PhabricatorOwnersPackageEditor())
- ->setActor($user)
- ->setPackage($package)
- ->delete();
- return id(new AphrontRedirectResponse())->setURI('/owners/');
- }
-
- $text = pht('Are you sure you want to delete the "%s" package? This '.
- 'operation can not be undone.', $package->getName());
- $dialog = id(new AphrontDialogView())
- ->setUser($user)
- ->setTitle('Really delete this package?')
- ->appendChild(phutil_tag('p', array(), $text))
- ->addSubmitButton(pht('Delete'))
- ->addCancelButton('/owners/package/'.$package->getID().'/')
- ->setSubmitURI($request->getRequestURI());
-
- return id(new AphrontDialogResponse())->setDialog($dialog);
- }
-
-}
diff --git a/src/applications/owners/controller/PhabricatorOwnersDetailController.php b/src/applications/owners/controller/PhabricatorOwnersDetailController.php
index 0b50db02d5..7935031389 100644
--- a/src/applications/owners/controller/PhabricatorOwnersDetailController.php
+++ b/src/applications/owners/controller/PhabricatorOwnersDetailController.php
@@ -3,25 +3,22 @@
final class PhabricatorOwnersDetailController
extends PhabricatorOwnersController {
- private $id;
- private $package;
-
- public function willProcessRequest(array $data) {
- $this->id = $data['id'];
+ public function shouldAllowPublic() {
+ return true;
}
- public function processRequest() {
- $request = $this->getRequest();
- $user = $request->getUser();
+ public function handleRequest(AphrontRequest $request) {
+ $viewer = $this->getViewer();
- $package = id(new PhabricatorOwnersPackage())->load($this->id);
+ $package = id(new PhabricatorOwnersPackageQuery())
+ ->setViewer($viewer)
+ ->withIDs(array($request->getURIData('id')))
+ ->executeOne();
if (!$package) {
return new Aphront404Response();
}
- $this->package = $package;
$paths = $package->loadPaths();
- $owners = $package->loadOwners();
$repository_phids = array();
foreach ($paths as $path) {
@@ -30,7 +27,7 @@ public function processRequest() {
if ($repository_phids) {
$repositories = id(new PhabricatorRepositoryQuery())
- ->setViewer($user)
+ ->setViewer($viewer)
->withPHIDs(array_keys($repository_phids))
->execute();
$repositories = mpull($repositories, null, 'getPHID');
@@ -38,101 +35,18 @@ public function processRequest() {
$repositories = array();
}
- $phids = array();
- foreach ($owners as $owner) {
- $phids[$owner->getUserPHID()] = true;
- }
- $phids = array_keys($phids);
-
- $handles = $this->loadViewerHandles($phids);
-
- $rows = array();
-
- $rows[] = array(pht('Name'), $package->getName());
- $rows[] = array(pht('Description'), $package->getDescription());
-
- $primary_owner = null;
- $primary_phid = $package->getPrimaryOwnerPHID();
- if ($primary_phid && isset($handles[$primary_phid])) {
- $primary_owner = phutil_tag(
- 'strong',
- array(),
- $handles[$primary_phid]->renderLink());
- }
- $rows[] = array(pht('Primary Owner'), $primary_owner);
-
- $owner_links = array();
- foreach ($owners as $owner) {
- $owner_links[] = $handles[$owner->getUserPHID()]->renderLink();
- }
- $owner_links = phutil_implode_html(phutil_tag('br'), $owner_links);
- $rows[] = array(pht('Owners'), $owner_links);
-
- $rows[] = array(
- pht('Auditing'),
- $package->getAuditingEnabled() ?
- pht('Enabled') :
- pht('Disabled'),
- );
-
- $path_links = array();
- foreach ($paths as $path) {
- $repo = idx($repositories, $path->getRepositoryPHID());
- if (!$repo) {
- continue;
- }
- $href = DiffusionRequest::generateDiffusionURI(
- array(
- 'callsign' => $repo->getCallsign(),
- 'branch' => $repo->getDefaultBranch(),
- 'path' => $path->getPath(),
- 'action' => 'browse',
- ));
- $repo_name = phutil_tag('strong', array(), $repo->getName());
- $path_link = phutil_tag(
- 'a',
- array(
- 'href' => (string)$href,
- ),
- $path->getPath());
- $path_links[] = hsprintf(
- '%s %s %s',
- ($path->getExcluded() ? "\xE2\x80\x93" : '+'),
- $repo_name,
- $path_link);
- }
- $path_links = phutil_implode_html(phutil_tag('br'), $path_links);
- $rows[] = array(pht('Paths'), $path_links);
-
- $table = new AphrontTableView($rows);
- $table->setColumnClasses(
- array(
- 'header',
- 'wide',
- ));
-
- $panel = new PHUIObjectBoxView();
- $header = new PHUIHeaderView();
- $header->setHeader(
- pht('Package Details for "%s"', $package->getName()));
- $header->addActionLink(
- id(new PHUIButtonView())
- ->setTag('a')
- ->setHref('/owners/delete/'.$package->getID().'/')
- ->addSigil('workflow')
- ->setText(pht('Delete Package')));
-
- $header->addActionLink(
- id(new PHUIButtonView())
- ->setTag('a')
- ->setHref('/owners/edit/'.$package->getID().'/')
- ->setText(pht('Edit Package')));
+ $actions = $this->buildPackageActionView($package);
+ $properties = $this->buildPackagePropertyView($package);
+ $properties->setActionList($actions);
- $panel->setHeader($header);
- $panel->appendChild($table);
+ $header = id(new PHUIHeaderView())
+ ->setUser($viewer)
+ ->setHeader($package->getName())
+ ->setPolicyObject($package);
- $key = 'package/'.$package->getID();
- $this->setSideNavFilter($key);
+ $panel = id(new PHUIObjectBoxView())
+ ->setHeader($header)
+ ->addPropertyList($properties);
$commit_views = array();
@@ -151,7 +65,7 @@ public function processRequest() {
->execute();
if ($attention_commits) {
$view = id(new PhabricatorAuditListView())
- ->setUser($user)
+ ->setUser($viewer)
->setCommits($attention_commits);
$commit_views[] = array(
@@ -172,7 +86,7 @@ public function processRequest() {
->execute();
$view = id(new PhabricatorAuditListView())
- ->setUser($user)
+ ->setUser($viewer)
->setCommits($all_commits)
->setNoDataString(pht('No commits in this package.'));
@@ -210,21 +124,165 @@ public function processRequest() {
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb($package->getName());
- $nav = $this->buildSideNavView();
- $nav->appendChild($crumbs);
- $nav->appendChild($panel);
- $nav->appendChild($commit_panels);
+ $timeline = $this->buildTransactionTimeline(
+ $package,
+ new PhabricatorOwnersPackageTransactionQuery());
+ $timeline->setShouldTerminate(true);
return $this->buildApplicationPage(
- $nav,
array(
- 'title' => pht('Package %s', $package->getName()),
+ $crumbs,
+ $panel,
+ $this->renderPathsTable($paths, $repositories),
+ $commit_panels,
+ $timeline,
+ ),
+ array(
+ 'title' => $package->getName(),
));
}
- protected function getExtraPackageViews(AphrontSideNavFilterView $view) {
- $package = $this->package;
- $view->addFilter('package/'.$package->getID(), pht('Details'));
+
+ private function buildPackagePropertyView(PhabricatorOwnersPackage $package) {
+ $viewer = $this->getViewer();
+
+ $view = id(new PHUIPropertyListView())
+ ->setUser($viewer);
+
+ $primary_phid = $package->getPrimaryOwnerPHID();
+ if ($primary_phid) {
+ $primary_owner = $viewer->renderHandle($primary_phid);
+ } else {
+ $primary_owner = phutil_tag('em', array(), pht('None'));
+ }
+ $view->addProperty(pht('Primary Owner'), $primary_owner);
+
+ // TODO: needOwners() this on the Query.
+ $owners = $package->loadOwners();
+ if ($owners) {
+ $owner_list = $viewer->renderHandleList(mpull($owners, 'getUserPHID'));
+ } else {
+ $owner_list = phutil_tag('em', array(), pht('None'));
+ }
+ $view->addProperty(pht('Owners'), $owner_list);
+
+ if ($package->getAuditingEnabled()) {
+ $auditing = pht('Enabled');
+ } else {
+ $auditing = pht('Disabled');
+ }
+ $view->addProperty(pht('Auditing'), $auditing);
+
+ $description = $package->getDescription();
+ if (strlen($description)) {
+ $view->addSectionHeader(pht('Description'));
+ $view->addTextContent(
+ $output = PhabricatorMarkupEngine::renderOneObject(
+ id(new PhabricatorMarkupOneOff())->setContent($description),
+ 'default',
+ $viewer));
+ }
+
+ return $view;
+ }
+
+ private function buildPackageActionView(PhabricatorOwnersPackage $package) {
+ $viewer = $this->getViewer();
+
+ // TODO: Implement this capability.
+ $can_edit = true;
+
+ $id = $package->getID();
+ $edit_uri = $this->getApplicationURI("/edit/{$id}/");
+ $paths_uri = $this->getApplicationURI("/paths/{$id}/");
+
+ $view = id(new PhabricatorActionListView())
+ ->setUser($viewer)
+ ->setObject($package)
+ ->addAction(
+ id(new PhabricatorActionView())
+ ->setName(pht('Edit Package'))
+ ->setIcon('fa-pencil')
+ ->setDisabled(!$can_edit)
+ ->setWorkflow(!$can_edit)
+ ->setHref($edit_uri))
+ ->addAction(
+ id(new PhabricatorActionView())
+ ->setName(pht('Edit Paths'))
+ ->setIcon('fa-folder-open')
+ ->setDisabled(!$can_edit)
+ ->setWorkflow(!$can_edit)
+ ->setHref($paths_uri));
+
+ return $view;
+ }
+
+ private function renderPathsTable(array $paths, array $repositories) {
+ $viewer = $this->getViewer();
+
+ $rows = array();
+ foreach ($paths as $path) {
+ $repo = idx($repositories, $path->getRepositoryPHID());
+ if (!$repo) {
+ continue;
+ }
+ $href = DiffusionRequest::generateDiffusionURI(
+ array(
+ 'callsign' => $repo->getCallsign(),
+ 'branch' => $repo->getDefaultBranch(),
+ 'path' => $path->getPath(),
+ 'action' => 'browse',
+ ));
+
+ $path_link = phutil_tag(
+ 'a',
+ array(
+ 'href' => (string)$href,
+ ),
+ $path->getPath());
+
+ $rows[] = array(
+ ($path->getExcluded() ? '-' : '+'),
+ $repo->getName(),
+ $path_link,
+ );
+ }
+
+ $info = null;
+ if (!$paths) {
+ $info = id(new PHUIInfoView())
+ ->setSeverity(PHUIInfoView::SEVERITY_WARNING)
+ ->setErrors(
+ array(
+ pht(
+ 'This package does not contain any paths yet. Use '.
+ '"Edit Paths" to add some.'),
+ ));
+ }
+
+ $table = id(new AphrontTableView($rows))
+ ->setHeaders(
+ array(
+ null,
+ pht('Repository'),
+ pht('Path'),
+ ))
+ ->setColumnClasses(
+ array(
+ null,
+ null,
+ 'wide',
+ ));
+
+ $box = id(new PHUIObjectBoxView())
+ ->setHeaderText(pht('Paths'))
+ ->appendChild($table);
+
+ if ($info) {
+ $box->setInfoView($info);
+ }
+
+ return $box;
}
}
diff --git a/src/applications/owners/controller/PhabricatorOwnersEditController.php b/src/applications/owners/controller/PhabricatorOwnersEditController.php
index 34bf513737..9f1987814d 100644
--- a/src/applications/owners/controller/PhabricatorOwnersEditController.php
+++ b/src/applications/owners/controller/PhabricatorOwnersEditController.php
@@ -3,180 +3,132 @@
final class PhabricatorOwnersEditController
extends PhabricatorOwnersController {
- private $id;
-
- public function willProcessRequest(array $data) {
- $this->id = idx($data, 'id');
- }
-
- public function processRequest() {
- $request = $this->getRequest();
- $user = $request->getUser();
-
- if ($this->id) {
- $package = id(new PhabricatorOwnersPackage())->load($this->id);
+ public function handleRequest(AphrontRequest $request) {
+ $viewer = $request->getUser();
+
+ $id = $request->getURIData('id');
+ if ($id) {
+ $package = id(new PhabricatorOwnersPackageQuery())
+ ->setViewer($viewer)
+ ->withIDs(array($id))
+ ->requireCapabilities(
+ array(
+ PhabricatorPolicyCapability::CAN_VIEW,
+ // TODO: Support this capability.
+ // PhabricatorPolicyCapability::CAN_EDIT,
+ ))
+ ->executeOne();
if (!$package) {
return new Aphront404Response();
}
+ $is_new = false;
} else {
- $package = new PhabricatorOwnersPackage();
- $package->setPrimaryOwnerPHID($user->getPHID());
+ $package = PhabricatorOwnersPackage::initializeNewPackage($viewer);
+ $is_new = true;
}
$e_name = true;
$e_primary = true;
- $errors = array();
+ $v_name = $package->getName();
+ $v_primary = $package->getPrimaryOwnerPHID();
+ // TODO: Pull these off needOwners() on the Query.
+ $v_owners = mpull($package->loadOwners(), 'getUserPHID');
+ $v_auditing = $package->getAuditingEnabled();
+ $v_description = $package->getDescription();
+
+ $errors = array();
if ($request->isFormPost()) {
- $package->setName($request->getStr('name'));
- $package->setDescription($request->getStr('description'));
- $old_auditing_enabled = $package->getAuditingEnabled();
- $package->setAuditingEnabled(
- ($request->getStr('auditing') === 'enabled')
- ? 1
- : 0);
+ $xactions = array();
- $primary = $request->getArr('primary');
- $primary = reset($primary);
- $old_primary = $package->getPrimaryOwnerPHID();
- $package->setPrimaryOwnerPHID($primary);
+ $v_name = $request->getStr('name');
+ $v_primary = head($request->getArr('primary'));
+ $v_owners = $request->getArr('owners');
+ $v_auditing = ($request->getStr('auditing') == 'enabled');
+ $v_description = $request->getStr('description');
- $owners = $request->getArr('owners');
- if ($primary) {
- array_unshift($owners, $primary);
+ if ($v_primary) {
+ $v_owners[] = $v_primary;
+ $v_owners = array_unique($v_owners);
}
- $owners = array_unique($owners);
-
- $paths = $request->getArr('path');
- $repos = $request->getArr('repo');
- $excludes = $request->getArr('exclude');
- $path_refs = array();
- for ($ii = 0; $ii < count($paths); $ii++) {
- if (empty($paths[$ii]) || empty($repos[$ii])) {
- continue;
+ $type_name = PhabricatorOwnersPackageTransaction::TYPE_NAME;
+ $type_primary = PhabricatorOwnersPackageTransaction::TYPE_PRIMARY;
+ $type_owners = PhabricatorOwnersPackageTransaction::TYPE_OWNERS;
+ $type_auditing = PhabricatorOwnersPackageTransaction::TYPE_AUDITING;
+ $type_description = PhabricatorOwnersPackageTransaction::TYPE_DESCRIPTION;
+
+ $xactions[] = id(new PhabricatorOwnersPackageTransaction())
+ ->setTransactionType($type_name)
+ ->setNewValue($v_name);
+
+ $xactions[] = id(new PhabricatorOwnersPackageTransaction())
+ ->setTransactionType($type_primary)
+ ->setNewValue($v_primary);
+
+ $xactions[] = id(new PhabricatorOwnersPackageTransaction())
+ ->setTransactionType($type_owners)
+ ->setNewValue($v_owners);
+
+ $xactions[] = id(new PhabricatorOwnersPackageTransaction())
+ ->setTransactionType($type_auditing)
+ ->setNewValue($v_auditing);
+
+ $xactions[] = id(new PhabricatorOwnersPackageTransaction())
+ ->setTransactionType($type_description)
+ ->setNewValue($v_description);
+
+ $editor = id(new PhabricatorOwnersPackageTransactionEditor())
+ ->setActor($viewer)
+ ->setContentSourceFromRequest($request)
+ ->setContinueOnNoEffect(true);
+
+ try {
+ $editor->applyTransactions($package, $xactions);
+
+ $id = $package->getID();
+ if ($is_new) {
+ $next_uri = '/owners/paths/'.$id.'/';
+ } else {
+ $next_uri = '/owners/package/'.$id.'/';
}
- $path_refs[] = array(
- 'repositoryPHID' => $repos[$ii],
- 'path' => $paths[$ii],
- 'excluded' => $excludes[$ii],
- );
- }
-
- if (!strlen($package->getName())) {
- $e_name = pht('Required');
- $errors[] = pht('Package name is required.');
- } else {
- $e_name = null;
- }
-
- if (!$package->getPrimaryOwnerPHID()) {
- $e_primary = pht('Required');
- $errors[] = pht('Package must have a primary owner.');
- } else {
- $e_primary = null;
- }
- if (!$path_refs) {
- $errors[] = pht('Package must include at least one path.');
- }
+ return id(new AphrontRedirectResponse())->setURI($next_uri);
+ } catch (AphrontDuplicateKeyQueryException $ex) {
+ $e_name = pht('Duplicate');
+ $errors[] = pht('Package name must be unique.');
+ } catch (PhabricatorApplicationTransactionValidationException $ex) {
+ $validation_exception = $ex;
- if (!$errors) {
- $package->attachUnsavedOwners($owners);
- $package->attachUnsavedPaths($path_refs);
- $package->attachOldAuditingEnabled($old_auditing_enabled);
- $package->attachOldPrimaryOwnerPHID($old_primary);
- try {
- id(new PhabricatorOwnersPackageEditor())
- ->setActor($user)
- ->setPackage($package)
- ->save();
- return id(new AphrontRedirectResponse())
- ->setURI('/owners/package/'.$package->getID().'/');
- } catch (AphrontDuplicateKeyQueryException $ex) {
- $e_name = pht('Duplicate');
- $errors[] = pht('Package name must be unique.');
- }
- }
- } else {
- $owners = $package->loadOwners();
- $owners = mpull($owners, 'getUserPHID');
-
- $paths = $package->loadPaths();
- $path_refs = array();
- foreach ($paths as $path) {
- $path_refs[] = array(
- 'repositoryPHID' => $path->getRepositoryPHID(),
- 'path' => $path->getPath(),
- 'excluded' => $path->getExcluded(),
- );
+ $e_name = $ex->getShortMessage($type_name);
+ $e_primary = $ex->getShortMessage($type_primary);
}
}
- $primary = $package->getPrimaryOwnerPHID();
- if ($primary) {
- $value_primary_owner = array($primary);
+ if ($v_primary) {
+ $value_primary_owner = array($v_primary);
} else {
$value_primary_owner = array();
}
- if ($package->getID()) {
- $title = pht('Edit Package');
- $side_nav_filter = 'edit/'.$this->id;
- } else {
+ if ($is_new) {
+ $cancel_uri = '/owners/';
$title = pht('New Package');
- $side_nav_filter = 'new';
- }
- $this->setSideNavFilter($side_nav_filter);
-
- $repos = id(new PhabricatorRepositoryQuery())
- ->setViewer($user)
- ->execute();
-
- $default_paths = array();
- foreach ($repos as $repo) {
- $default_path = $repo->getDetail('default-owners-path');
- if ($default_path) {
- $default_paths[$repo->getPHID()] = $default_path;
- }
+ $button_text = pht('Continue');
+ } else {
+ $cancel_uri = '/owners/package/'.$package->getID().'/';
+ $title = pht('Edit Package');
+ $button_text = pht('Save Package');
}
- $repos = mpull($repos, 'getCallsign', 'getPHID');
- asort($repos);
-
- $template = new AphrontTypeaheadTemplateView();
- $template = $template->render();
-
- Javelin::initBehavior(
- 'owners-path-editor',
- array(
- 'root' => 'path-editor',
- 'table' => 'paths',
- 'add_button' => 'addpath',
- 'repositories' => $repos,
- 'input_template' => $template,
- 'pathRefs' => $path_refs,
-
- 'completeURI' => '/diffusion/services/path/complete/',
- 'validateURI' => '/diffusion/services/path/validate/',
-
- 'repositoryDefaultPaths' => $default_paths,
- ));
-
- require_celerity_resource('owners-path-editor-css');
-
- $cancel_uri = $package->getID()
- ? '/owners/package/'.$package->getID().'/'
- : '/owners/';
-
$form = id(new AphrontFormView())
- ->setUser($user)
+ ->setUser($viewer)
->appendChild(
id(new AphrontFormTextControl())
->setLabel(pht('Name'))
->setName('name')
- ->setValue($package->getName())
+ ->setValue($v_name)
->setError($e_name))
->appendControl(
id(new AphrontFormTokenizerControl())
@@ -191,56 +143,33 @@ public function processRequest() {
->setDatasource(new PhabricatorProjectOrUserDatasource())
->setLabel(pht('Owners'))
->setName('owners')
- ->setValue($owners))
+ ->setValue($v_owners))
->appendChild(
id(new AphrontFormSelectControl())
->setName('auditing')
->setLabel(pht('Auditing'))
->setCaption(
- pht('With auditing enabled, all future commits that touch '.
- 'this package will be reviewed to make sure an owner '.
- 'of the package is involved and the commit message has '.
- 'a valid revision, reviewed by, and author.'))
- ->setOptions(array(
- 'disabled' => pht('Disabled'),
- 'enabled' => pht('Enabled'),
- ))
- ->setValue(
- $package->getAuditingEnabled()
- ? 'enabled'
- : 'disabled'))
+ pht(
+ 'With auditing enabled, all future commits that touch '.
+ 'this package will be reviewed to make sure an owner '.
+ 'of the package is involved and the commit message has '.
+ 'a valid revision, reviewed by, and author.'))
+ ->setOptions(
+ array(
+ 'disabled' => pht('Disabled'),
+ 'enabled' => pht('Enabled'),
+ ))
+ ->setValue(($v_auditing ? 'enabled' : 'disabled')))
->appendChild(
- id(new PHUIFormInsetView())
- ->setTitle(pht('Paths'))
- ->addDivAttributes(array('id' => 'path-editor'))
- ->setRightButton(javelin_tag(
- 'a',
- array(
- 'href' => '#',
- 'class' => 'button green',
- 'sigil' => 'addpath',
- 'mustcapture' => true,
- ),
- pht('Add New Path')))
- ->setDescription(
- pht('Specify the files and directories which comprise '.
- 'this package.'))
- ->setContent(javelin_tag(
- 'table',
- array(
- 'class' => 'owners-path-editor-table',
- 'sigil' => 'paths',
- ),
- '')))
- ->appendChild(
- id(new AphrontFormTextAreaControl())
+ id(new PhabricatorRemarkupControl())
+ ->setUser($viewer)
->setLabel(pht('Description'))
->setName('description')
- ->setValue($package->getDescription()))
+ ->setValue($v_description))
->appendChild(
id(new AphrontFormSubmitControl())
->addCancelButton($cancel_uri)
- ->setValue(pht('Save Package')));
+ ->setValue($button_text));
$form_box = id(new PHUIObjectBoxView())
->setHeaderText($title)
@@ -249,29 +178,22 @@ public function processRequest() {
$crumbs = $this->buildApplicationCrumbs();
if ($package->getID()) {
- $crumbs->addTextCrumb(pht('Edit %s', $package->getName()));
+ $crumbs->addTextCrumb(
+ $package->getName(),
+ $this->getApplicationURI('package/'.$package->getID().'/'));
+ $crumbs->addTextCrumb(pht('Edit'));
} else {
$crumbs->addTextCrumb(pht('New Package'));
}
- $nav = $this->buildSideNavView();
- $nav->appendChild($crumbs);
- $nav->appendChild($form_box);
-
return $this->buildApplicationPage(
array(
- $nav,
+ $crumbs,
+ $form_box,
),
array(
'title' => $title,
));
}
- protected function getExtraPackageViews(AphrontSideNavFilterView $view) {
- if ($this->id) {
- $view->addFilter('edit/'.$this->id, pht('Edit'));
- } else {
- $view->addFilter('new', pht('New'));
- }
- }
}
diff --git a/src/applications/owners/controller/PhabricatorOwnersListController.php b/src/applications/owners/controller/PhabricatorOwnersListController.php
index 2a206616e6..7beb842c82 100644
--- a/src/applications/owners/controller/PhabricatorOwnersListController.php
+++ b/src/applications/owners/controller/PhabricatorOwnersListController.php
@@ -3,341 +3,52 @@
final class PhabricatorOwnersListController
extends PhabricatorOwnersController {
- protected $view;
-
- public function willProcessRequest(array $data) {
- $this->view = idx($data, 'view', 'owned');
- $this->setSideNavFilter('view/'.$this->view);
+ public function shouldAllowPublic() {
+ return true;
}
- public function processRequest() {
-
- $request = $this->getRequest();
- $user = $request->getUser();
-
- $package = new PhabricatorOwnersPackage();
- $owner = new PhabricatorOwnersOwner();
- $path = new PhabricatorOwnersPath();
-
- $repository_phid = '';
- if ($request->getStr('repository') != '') {
- $repository_phid = id(new PhabricatorRepositoryQuery())
- ->setViewer($user)
- ->withCallsigns(array($request->getStr('repository')))
- ->executeOne()
- ->getPHID();
- }
-
- switch ($this->view) {
- case 'search':
- $packages = array();
-
- $conn_r = $package->establishConnection('r');
-
- $where = array('1 = 1');
- $join = array();
- $having = '';
-
- if ($request->getStr('name')) {
- $where[] = qsprintf(
- $conn_r,
- 'p.name LIKE %~',
- $request->getStr('name'));
- }
-
- if ($repository_phid || $request->getStr('path')) {
-
- $join[] = qsprintf(
- $conn_r,
- 'JOIN %T path ON path.packageID = p.id',
- $path->getTableName());
-
- if ($repository_phid) {
- $where[] = qsprintf(
- $conn_r,
- 'path.repositoryPHID = %s',
- $repository_phid);
- }
-
- if ($request->getStr('path')) {
- $where[] = qsprintf(
- $conn_r,
- '(path.path LIKE %~ AND NOT path.excluded) OR
- %s LIKE CONCAT(REPLACE(path.path, %s, %s), %s)',
- $request->getStr('path'),
- $request->getStr('path'),
- '_',
- '\_',
- '%');
- $having = 'HAVING MAX(path.excluded) = 0';
- }
-
- }
-
- if ($request->getArr('owner')) {
- $join[] = qsprintf(
- $conn_r,
- 'JOIN %T o ON o.packageID = p.id',
- $owner->getTableName());
- $where[] = qsprintf(
- $conn_r,
- 'o.userPHID IN (%Ls)',
- $request->getArr('owner'));
- }
-
- $data = queryfx_all(
- $conn_r,
- 'SELECT p.* FROM %T p %Q WHERE %Q GROUP BY p.id %Q',
- $package->getTableName(),
- implode(' ', $join),
- '('.implode(') AND (', $where).')',
- $having);
- $packages = $package->loadAllFromArray($data);
-
- $header = pht('Search Results');
- $nodata = pht('No packages match your query.');
- break;
- case 'owned':
- $data = queryfx_all(
- $package->establishConnection('r'),
- 'SELECT p.* FROM %T p JOIN %T o ON p.id = o.packageID
- WHERE o.userPHID = %s GROUP BY p.id',
- $package->getTableName(),
- $owner->getTableName(),
- $user->getPHID());
- $packages = $package->loadAllFromArray($data);
-
- $header = pht('Owned Packages');
- $nodata = pht('No owned packages');
- break;
- case 'projects':
- $projects = id(new PhabricatorProjectQuery())
- ->setViewer($user)
- ->withMemberPHIDs(array($user->getPHID()))
- ->withStatus(PhabricatorProjectQuery::STATUS_ANY)
- ->execute();
- $owner_phids = mpull($projects, 'getPHID');
- if ($owner_phids) {
- $data = queryfx_all(
- $package->establishConnection('r'),
- 'SELECT p.* FROM %T p JOIN %T o ON p.id = o.packageID
- WHERE o.userPHID IN (%Ls) GROUP BY p.id',
- $package->getTableName(),
- $owner->getTableName(),
- $owner_phids);
- } else {
- $data = array();
- }
- $packages = $package->loadAllFromArray($data);
-
- $header = pht('Project Packages');
- $nodata = pht('No owned packages');
- break;
- case 'all':
- $packages = $package->loadAll();
-
- $header = pht('All Packages');
- $nodata = pht('There are no defined packages.');
- break;
- }
-
- $content = $this->renderPackageTable(
- $packages,
- $header,
- $nodata);
-
- $filter = new AphrontListFilterView();
-
- $owner_phids = $request->getArr('owner');
-
- $callsigns = array('' => pht('(Any Repository)'));
- $repositories = id(new PhabricatorRepositoryQuery())
- ->setViewer($user)
- ->setOrder('callsign')
- ->execute();
- foreach ($repositories as $repository) {
- $callsigns[$repository->getCallsign()] =
- $repository->getCallsign().': '.$repository->getName();
- }
-
- $form = id(new AphrontFormView())
- ->setUser($user)
- ->setAction('/owners/view/search/')
- ->setMethod('GET')
- ->appendChild(
- id(new AphrontFormTextControl())
- ->setName('name')
- ->setLabel(pht('Name'))
- ->setValue($request->getStr('name')))
- ->appendControl(
- id(new AphrontFormTokenizerControl())
- ->setDatasource(new PhabricatorProjectOrUserDatasource())
- ->setLimit(1)
- ->setName('owner')
- ->setLabel(pht('Owner'))
- ->setValue($owner_phids))
- ->appendChild(
- id(new AphrontFormSelectControl())
- ->setName('repository')
- ->setLabel(pht('Repository'))
- ->setOptions($callsigns)
- ->setValue($request->getStr('repository')))
- ->appendChild(
- id(new AphrontFormTextControl())
- ->setName('path')
- ->setLabel(pht('Path'))
- ->setValue($request->getStr('path')))
- ->appendChild(
- id(new AphrontFormSubmitControl())
- ->setValue(pht('Search for Packages')));
-
- $filter->appendChild($form);
- $title = pht('Package Index');
-
- $crumbs = $this->buildApplicationCrumbs();
- $crumbs->addTextCrumb($header);
- $crumbs->setBorder(true);
-
- $nav = $this->buildSideNavView();
- $nav->appendChild($crumbs);
- $nav->appendChild($filter);
- $nav->appendChild($content);
+ public function handleRequest(AphrontRequest $request) {
+ $controller = id(new PhabricatorApplicationSearchController())
+ ->setQueryKey($request->getURIData('queryKey'))
+ ->setSearchEngine(new PhabricatorOwnersPackageSearchEngine())
+ ->setNavigation($this->buildSideNavView());
- return $this->buildApplicationPage(
- $nav,
- array(
- 'title' => pht('Package Index'),
- ));
+ return $this->delegateToController($controller);
}
- private function renderPackageTable(array $packages, $header, $nodata) {
- assert_instances_of($packages, 'PhabricatorOwnersPackage');
+ public function buildSideNavView($for_app = false) {
+ $viewer = $this->getViewer();
- if ($packages) {
- $package_ids = mpull($packages, 'getID');
+ $nav = new AphrontSideNavFilterView();
+ $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
- $owners = id(new PhabricatorOwnersOwner())->loadAllWhere(
- 'packageID IN (%Ld)',
- $package_ids);
-
- $paths = id(new PhabricatorOwnersPath())->loadAllWhere(
- 'packageID in (%Ld)',
- $package_ids);
-
- $phids = array();
- foreach ($owners as $owner) {
- $phids[$owner->getUserPHID()] = true;
- }
- $phids = array_keys($phids);
- $handles = $this->loadViewerHandles($phids);
-
- $repository_phids = array();
- foreach ($paths as $path) {
- $repository_phids[$path->getRepositoryPHID()] = true;
- }
-
- if ($repository_phids) {
- $repositories = id(new PhabricatorRepositoryQuery())
- ->setViewer($this->getRequest()->getUser())
- ->withPHIDs(array_keys($repository_phids))
- ->execute();
- } else {
- $repositories = array();
- }
-
- $repositories = mpull($repositories, null, 'getPHID');
- $owners = mgroup($owners, 'getPackageID');
- $paths = mgroup($paths, 'getPackageID');
- } else {
- $handles = array();
- $repositories = array();
- $owners = array();
- $paths = array();
+ if ($for_app) {
+ $nav->addFilter('new/', pht('Create Package'));
}
- $rows = array();
- foreach ($packages as $package) {
+ id(new PhabricatorOwnersPackageSearchEngine())
+ ->setViewer($viewer)
+ ->addNavigationItems($nav->getMenu());
- $pkg_owners = idx($owners, $package->getID(), array());
- foreach ($pkg_owners as $key => $owner) {
- $pkg_owners[$key] = $handles[$owner->getUserPHID()]->renderLink();
- if ($owner->getUserPHID() == $package->getPrimaryOwnerPHID()) {
- $pkg_owners[$key] = phutil_tag('strong', array(), $pkg_owners[$key]);
- }
- }
- $pkg_owners = phutil_implode_html(phutil_tag('br'), $pkg_owners);
+ $nav->selectFilter(null);
- $pkg_paths = idx($paths, $package->getID(), array());
- foreach ($pkg_paths as $key => $path) {
- $repo = idx($repositories, $path->getRepositoryPHID());
- if ($repo) {
- $href = DiffusionRequest::generateDiffusionURI(
- array(
- 'callsign' => $repo->getCallsign(),
- 'branch' => $repo->getDefaultBranch(),
- 'path' => $path->getPath(),
- 'action' => 'browse',
- ));
- $pkg_paths[$key] = hsprintf(
- '%s %s%s',
- ($path->getExcluded() ? "\xE2\x80\x93" : '+'),
- phutil_tag('strong', array(), $repo->getName()),
- phutil_tag(
- 'a',
- array(
- 'href' => (string)$href,
- ),
- $path->getPath()));
- } else {
- $pkg_paths[$key] = $path->getPath();
- }
- }
- $pkg_paths = phutil_implode_html(phutil_tag('br'), $pkg_paths);
+ return $nav;
+ }
- $rows[] = array(
- phutil_tag(
- 'a',
- array(
- 'href' => '/owners/package/'.$package->getID().'/',
- ),
- $package->getName()),
- $pkg_owners,
- $pkg_paths,
- phutil_tag(
- 'a',
- array(
- 'href' => '/audit/?auditorPHIDs='.$package->getPHID(),
- ),
- pht('Related Commits')),
- );
- }
+ public function buildApplicationMenu() {
+ return $this->buildSideNavView(true)->getMenu();
+ }
- $table = new AphrontTableView($rows);
- $table->setHeaders(
- array(
- pht('Name'),
- pht('Owners'),
- pht('Paths'),
- pht('Related Commits'),
- ));
- $table->setColumnClasses(
- array(
- 'pri',
- '',
- 'wide wrap',
- 'narrow',
- ));
+ protected function buildApplicationCrumbs() {
+ $crumbs = parent::buildApplicationCrumbs();
- $panel = new PHUIObjectBoxView();
- $panel->setHeaderText($header);
- $panel->appendChild($table);
+ $crumbs->addAction(
+ id(new PHUIListItemView())
+ ->setName(pht('Create Package'))
+ ->setHref($this->getApplicationURI('new/'))
+ ->setIcon('fa-plus-square'));
- return $panel;
+ return $crumbs;
}
- protected function getExtraPackageViews(AphrontSideNavFilterView $view) {
- if ($this->view == 'search') {
- $view->addFilter('view/search', pht('Search Results'));
- }
- }
}
diff --git a/src/applications/owners/controller/PhabricatorOwnersPathsController.php b/src/applications/owners/controller/PhabricatorOwnersPathsController.php
new file mode 100644
index 0000000000..95df2cb807
--- /dev/null
+++ b/src/applications/owners/controller/PhabricatorOwnersPathsController.php
@@ -0,0 +1,165 @@
+getUser();
+
+ $package = id(new PhabricatorOwnersPackageQuery())
+ ->setViewer($viewer)
+ ->withIDs(array($request->getURIData('id')))
+ ->requireCapabilities(
+ array(
+ PhabricatorPolicyCapability::CAN_VIEW,
+ // TODO: Support this capability.
+ // PhabricatorPolicyCapability::CAN_EDIT,
+ ))
+ ->executeOne();
+ if (!$package) {
+ return new Aphront404Response();
+ }
+
+ if ($request->isFormPost()) {
+ $paths = $request->getArr('path');
+ $repos = $request->getArr('repo');
+ $excludes = $request->getArr('exclude');
+
+ $path_refs = array();
+ foreach ($paths as $key => $path) {
+ if (!isset($repos[$key])) {
+ throw new Exception(
+ pht(
+ 'No repository PHID for path "%s"!',
+ $key));
+ }
+
+ if (!isset($excludes[$key])) {
+ throw new Exception(
+ pht(
+ 'No exclusion value for path "%s"!',
+ $key));
+ }
+
+ $path_refs[] = array(
+ 'repositoryPHID' => $repos[$key],
+ 'path' => $path,
+ 'excluded' => (int)$excludes[$key],
+ );
+ }
+
+ $type_paths = PhabricatorOwnersPackageTransaction::TYPE_PATHS;
+
+ $xactions = array();
+ $xactions[] = id(new PhabricatorOwnersPackageTransaction())
+ ->setTransactionType($type_paths)
+ ->setNewValue($path_refs);
+
+ $editor = id(new PhabricatorOwnersPackageTransactionEditor())
+ ->setActor($viewer)
+ ->setContentSourceFromRequest($request)
+ ->setContinueOnNoEffect(true)
+ ->setContinueOnMissingFields(true);
+
+ $editor->applyTransactions($package, $xactions);
+
+ return id(new AphrontRedirectResponse())
+ ->setURI('/owners/package/'.$package->getID().'/');
+ } else {
+ $paths = $package->loadPaths();
+ $path_refs = mpull($paths, 'getRef');
+ }
+
+ $repos = id(new PhabricatorRepositoryQuery())
+ ->setViewer($viewer)
+ ->execute();
+
+ $default_paths = array();
+ foreach ($repos as $repo) {
+ $default_path = $repo->getDetail('default-owners-path');
+ if ($default_path) {
+ $default_paths[$repo->getPHID()] = $default_path;
+ }
+ }
+
+ $repos = mpull($repos, 'getCallsign', 'getPHID');
+ asort($repos);
+
+ $template = new AphrontTypeaheadTemplateView();
+ $template = $template->render();
+
+ Javelin::initBehavior(
+ 'owners-path-editor',
+ array(
+ 'root' => 'path-editor',
+ 'table' => 'paths',
+ 'add_button' => 'addpath',
+ 'repositories' => $repos,
+ 'input_template' => $template,
+ 'pathRefs' => $path_refs,
+
+ 'completeURI' => '/diffusion/services/path/complete/',
+ 'validateURI' => '/diffusion/services/path/validate/',
+
+ 'repositoryDefaultPaths' => $default_paths,
+ ));
+
+ require_celerity_resource('owners-path-editor-css');
+
+ $cancel_uri = '/owners/package/'.$package->getID().'/';
+
+ $form = id(new AphrontFormView())
+ ->setUser($viewer)
+ ->appendChild(
+ id(new PHUIFormInsetView())
+ ->setTitle(pht('Paths'))
+ ->addDivAttributes(array('id' => 'path-editor'))
+ ->setRightButton(javelin_tag(
+ 'a',
+ array(
+ 'href' => '#',
+ 'class' => 'button green',
+ 'sigil' => 'addpath',
+ 'mustcapture' => true,
+ ),
+ pht('Add New Path')))
+ ->setDescription(
+ pht(
+ 'Specify the files and directories which comprise '.
+ 'this package.'))
+ ->setContent(javelin_tag(
+ 'table',
+ array(
+ 'class' => 'owners-path-editor-table',
+ 'sigil' => 'paths',
+ ),
+ '')))
+ ->appendChild(
+ id(new AphrontFormSubmitControl())
+ ->addCancelButton($cancel_uri)
+ ->setValue(pht('Save Paths')));
+
+ $form_box = id(new PHUIObjectBoxView())
+ ->setHeaderText(pht('Edit Paths'))
+ ->setForm($form);
+
+ $crumbs = $this->buildApplicationCrumbs();
+ $crumbs->addTextCrumb(
+ $package->getName(),
+ $this->getApplicationURI('package/'.$package->getID().'/'));
+ $crumbs->addTextCrumb(pht('Edit Paths'));
+
+ return $this->buildApplicationPage(
+ array(
+ $crumbs,
+ $form_box,
+ ),
+ array(
+ 'title' => array(
+ $package->getName(),
+ pht('Edit Paths'),
+ ),
+ ));
+ }
+
+}
diff --git a/src/applications/owners/editor/PhabricatorOwnersPackageEditor.php b/src/applications/owners/editor/PhabricatorOwnersPackageEditor.php
deleted file mode 100644
index 160c9039aa..0000000000
--- a/src/applications/owners/editor/PhabricatorOwnersPackageEditor.php
+++ /dev/null
@@ -1,198 +0,0 @@
-package = $package;
- return $this;
- }
-
- public function getPackage() {
- return $this->package;
- }
-
- public function save() {
- $actor = $this->getActor();
- $package = $this->getPackage();
- $package->attachActorPHID($actor->getPHID());
-
- if ($package->getID()) {
- $is_new = false;
- } else {
- $is_new = true;
- }
-
- $package->openTransaction();
-
- $ret = $package->save();
-
- $add_owners = array();
- $remove_owners = array();
- $all_owners = array();
- if ($package->getUnsavedOwners()) {
- $new_owners = array_fill_keys($package->getUnsavedOwners(), true);
- $cur_owners = array();
- foreach ($package->loadOwners() as $owner) {
- if (empty($new_owners[$owner->getUserPHID()])) {
- $remove_owners[$owner->getUserPHID()] = true;
- $owner->delete();
- continue;
- }
- $cur_owners[$owner->getUserPHID()] = true;
- }
-
- $add_owners = array_diff_key($new_owners, $cur_owners);
- $all_owners = array_merge(
- array($package->getPrimaryOwnerPHID() => true),
- $new_owners,
- $remove_owners);
- foreach ($add_owners as $phid => $ignored) {
- $owner = new PhabricatorOwnersOwner();
- $owner->setPackageID($package->getID());
- $owner->setUserPHID($phid);
- $owner->save();
- }
- $package->attachUnsavedOwners(array());
- }
-
- $add_paths = array();
- $remove_paths = array();
- $touched_repos = array();
- if ($package->getUnsavedPaths()) {
- $new_paths = igroup(
- $package->getUnsavedPaths(),
- 'repositoryPHID',
- 'path');
- $cur_paths = $package->loadPaths();
- foreach ($cur_paths as $key => $path) {
- $repository_phid = $path->getRepositoryPHID();
- $new_path = head(idx(
- idx($new_paths, $repository_phid, array()),
- $path->getPath(),
- array()));
- $excluded = $path->getExcluded();
- if ($new_path === false ||
- idx($new_path, 'excluded') != $excluded) {
- $touched_repos[$repository_phid] = true;
- $remove_paths[$repository_phid][$path->getPath()] = $excluded;
- $path->delete();
- unset($cur_paths[$key]);
- }
- }
-
- $cur_paths = mgroup($cur_paths, 'getRepositoryPHID', 'getPath');
- $repositories = id(new PhabricatorRepositoryQuery())
- ->setViewer($actor)
- ->withPHIDs(array_keys($cur_paths))
- ->execute();
- $repositories = mpull($repositories, null, 'getPHID');
- foreach ($new_paths as $repository_phid => $paths) {
- $repository = idx($repositories, $repository_phid);
- if (!$repository) {
- continue;
- }
- foreach ($paths as $path => $dicts) {
- $path = ltrim($path, '/');
- // build query to validate path
- $drequest = DiffusionRequest::newFromDictionary(
- array(
- 'user' => $actor,
- 'repository' => $repository,
- 'path' => $path,
- ));
- $results = DiffusionBrowseResultSet::newFromConduit(
- DiffusionQuery::callConduitWithDiffusionRequest(
- $actor,
- $drequest,
- 'diffusion.browsequery',
- array(
- 'commit' => $drequest->getCommit(),
- 'path' => $path,
- 'needValidityOnly' => true,
- )));
- $valid = $results->isValidResults();
- $is_directory = true;
- if (!$valid) {
- switch ($results->getReasonForEmptyResultSet()) {
- case DiffusionBrowseResultSet::REASON_IS_FILE:
- $valid = true;
- $is_directory = false;
- break;
- case DiffusionBrowseResultSet::REASON_IS_EMPTY:
- $valid = true;
- break;
- }
- }
- if ($is_directory && substr($path, -1) != '/') {
- $path .= '/';
- }
- if (substr($path, 0, 1) != '/') {
- $path = '/'.$path;
- }
- if (empty($cur_paths[$repository_phid][$path]) && $valid) {
- $touched_repos[$repository_phid] = true;
- $excluded = idx(reset($dicts), 'excluded', 0);
- $add_paths[$repository_phid][$path] = $excluded;
- $obj = new PhabricatorOwnersPath();
- $obj->setPackageID($package->getID());
- $obj->setRepositoryPHID($repository_phid);
- $obj->setPath($path);
- $obj->setExcluded($excluded);
- $obj->save();
- }
- }
- }
- $package->attachUnsavedPaths(array());
- }
-
- $package->saveTransaction();
-
- if ($is_new) {
- $mail = new PackageCreateMail($package);
- } else {
- $mail = new PackageModifyMail(
- $package,
- array_keys($add_owners),
- array_keys($remove_owners),
- array_keys($all_owners),
- array_keys($touched_repos),
- $add_paths,
- $remove_paths);
- }
- $mail->setActor($actor);
- $mail->send();
-
- return $ret;
- }
-
- public function delete() {
- $actor = $this->getActor();
- $package = $this->getPackage();
- $package->attachActorPHID($actor->getPHID());
-
- $mails = id(new PackageDeleteMail($package))
- ->setActor($actor)
- ->prepareMails();
-
- $package->openTransaction();
-
- foreach ($package->loadOwners() as $owner) {
- $owner->delete();
- }
- foreach ($package->loadPaths() as $path) {
- $path->delete();
- }
- $ret = $package->delete();
-
- $package->saveTransaction();
-
- foreach ($mails as $mail) {
- $mail->saveAndSend();
- }
-
- return $ret;
- }
-
-}
diff --git a/src/applications/owners/editor/PhabricatorOwnersPackageTransactionEditor.php b/src/applications/owners/editor/PhabricatorOwnersPackageTransactionEditor.php
new file mode 100644
index 0000000000..8ce1e48c29
--- /dev/null
+++ b/src/applications/owners/editor/PhabricatorOwnersPackageTransactionEditor.php
@@ -0,0 +1,290 @@
+getTransactionType()) {
+ case PhabricatorOwnersPackageTransaction::TYPE_NAME:
+ return $object->getName();
+ case PhabricatorOwnersPackageTransaction::TYPE_PRIMARY:
+ return $object->getPrimaryOwnerPHID();
+ case PhabricatorOwnersPackageTransaction::TYPE_OWNERS:
+ // TODO: needOwners() this on the Query.
+ $phids = mpull($object->loadOwners(), 'getUserPHID');
+ $phids = array_values($phids);
+ return $phids;
+ case PhabricatorOwnersPackageTransaction::TYPE_AUDITING:
+ return (int)$object->getAuditingEnabled();
+ case PhabricatorOwnersPackageTransaction::TYPE_DESCRIPTION:
+ return $object->getDescription();
+ case PhabricatorOwnersPackageTransaction::TYPE_PATHS:
+ // TODO: needPaths() this on the query
+ $paths = $object->loadPaths();
+ return mpull($paths, 'getRef');
+ }
+ }
+
+ protected function getCustomTransactionNewValue(
+ PhabricatorLiskDAO $object,
+ PhabricatorApplicationTransaction $xaction) {
+
+ switch ($xaction->getTransactionType()) {
+ case PhabricatorOwnersPackageTransaction::TYPE_NAME:
+ case PhabricatorOwnersPackageTransaction::TYPE_PRIMARY:
+ case PhabricatorOwnersPackageTransaction::TYPE_DESCRIPTION:
+ case PhabricatorOwnersPackageTransaction::TYPE_PATHS:
+ return $xaction->getNewValue();
+ case PhabricatorOwnersPackageTransaction::TYPE_AUDITING:
+ return (int)$xaction->getNewValue();
+ case PhabricatorOwnersPackageTransaction::TYPE_OWNERS:
+ $phids = $xaction->getNewValue();
+ $phids = array_unique($phids);
+ $phids = array_values($phids);
+ return $phids;
+ }
+ }
+
+ protected function transactionHasEffect(
+ PhabricatorLiskDAO $object,
+ PhabricatorApplicationTransaction $xaction) {
+
+ switch ($xaction->getTransactionType()) {
+ case PhabricatorOwnersPackageTransaction::TYPE_PATHS:
+ $old = $xaction->getOldValue();
+ $new = $xaction->getNewValue();
+
+ $diffs = PhabricatorOwnersPath::getTransactionValueChanges($old, $new);
+ list($rem, $add) = $diffs;
+
+ return ($rem || $add);
+ }
+
+ return parent::transactionHasEffect($object, $xaction);
+ }
+
+ protected function applyCustomInternalTransaction(
+ PhabricatorLiskDAO $object,
+ PhabricatorApplicationTransaction $xaction) {
+
+ switch ($xaction->getTransactionType()) {
+ case PhabricatorOwnersPackageTransaction::TYPE_NAME:
+ $object->setName($xaction->getNewValue());
+ return;
+ case PhabricatorOwnersPackageTransaction::TYPE_PRIMARY:
+ $object->setPrimaryOwnerPHID($xaction->getNewValue());
+ return;
+ case PhabricatorOwnersPackageTransaction::TYPE_DESCRIPTION:
+ $object->setDescription($xaction->getNewValue());
+ return;
+ case PhabricatorOwnersPackageTransaction::TYPE_AUDITING:
+ $object->setAuditingEnabled($xaction->getNewValue());
+ return;
+ case PhabricatorOwnersPackageTransaction::TYPE_OWNERS:
+ case PhabricatorOwnersPackageTransaction::TYPE_PATHS:
+ return;
+ }
+
+ return parent::applyCustomInternalTransaction($object, $xaction);
+ }
+
+ protected function applyCustomExternalTransaction(
+ PhabricatorLiskDAO $object,
+ PhabricatorApplicationTransaction $xaction) {
+
+ switch ($xaction->getTransactionType()) {
+ case PhabricatorOwnersPackageTransaction::TYPE_NAME:
+ case PhabricatorOwnersPackageTransaction::TYPE_PRIMARY:
+ case PhabricatorOwnersPackageTransaction::TYPE_DESCRIPTION:
+ case PhabricatorOwnersPackageTransaction::TYPE_AUDITING:
+ return;
+ case PhabricatorOwnersPackageTransaction::TYPE_OWNERS:
+ $old = $xaction->getOldValue();
+ $new = $xaction->getNewValue();
+
+ // TODO: needOwners this
+ $owners = $object->loadOwners();
+ $owners = mpull($owners, null, 'getUserPHID');
+
+ $rem = array_diff($old, $new);
+ foreach ($rem as $phid) {
+ if (isset($owners[$phid])) {
+ $owners[$phid]->delete();
+ unset($owners[$phid]);
+ }
+ }
+
+ $add = array_diff($new, $old);
+ foreach ($add as $phid) {
+ $owners[$phid] = id(new PhabricatorOwnersOwner())
+ ->setPackageID($object->getID())
+ ->setUserPHID($phid)
+ ->save();
+ }
+
+ // TODO: Attach owners here
+ return;
+ case PhabricatorOwnersPackageTransaction::TYPE_PATHS:
+ $old = $xaction->getOldValue();
+ $new = $xaction->getNewValue();
+
+ // TODO: needPaths this
+ $paths = $object->loadPaths();
+
+ $diffs = PhabricatorOwnersPath::getTransactionValueChanges($old, $new);
+ list($rem, $add) = $diffs;
+
+ $set = PhabricatorOwnersPath::getSetFromTransactionValue($rem);
+ foreach ($paths as $path) {
+ $ref = $path->getRef();
+ if (PhabricatorOwnersPath::isRefInSet($ref, $set)) {
+ $path->delete();
+ }
+ }
+
+ foreach ($add as $ref) {
+ $path = PhabricatorOwnersPath::newFromRef($ref)
+ ->setPackageID($object->getID())
+ ->save();
+ }
+
+ return;
+ }
+
+ return parent::applyCustomExternalTransaction($object, $xaction);
+ }
+
+ protected function validateTransaction(
+ PhabricatorLiskDAO $object,
+ $type,
+ array $xactions) {
+
+ $errors = parent::validateTransaction($object, $type, $xactions);
+
+ switch ($type) {
+ case PhabricatorOwnersPackageTransaction::TYPE_NAME:
+ $missing = $this->validateIsEmptyTextField(
+ $object->getName(),
+ $xactions);
+
+ if ($missing) {
+ $error = new PhabricatorApplicationTransactionValidationError(
+ $type,
+ pht('Required'),
+ pht('Package name is required.'),
+ nonempty(last($xactions), null));
+
+ $error->setIsMissingFieldError(true);
+ $errors[] = $error;
+ }
+ break;
+ case PhabricatorOwnersPackageTransaction::TYPE_PRIMARY:
+ $missing = $this->validateIsEmptyTextField(
+ $object->getPrimaryOwnerPHID(),
+ $xactions);
+
+ if ($missing) {
+ $error = new PhabricatorApplicationTransactionValidationError(
+ $type,
+ pht('Required'),
+ pht('Packages must have a primary owner.'),
+ nonempty(last($xactions), null));
+
+ $error->setIsMissingFieldError(true);
+ $errors[] = $error;
+ }
+ break;
+ }
+
+ return $errors;
+ }
+
+ protected function extractFilePHIDsFromCustomTransaction(
+ PhabricatorLiskDAO $object,
+ PhabricatorApplicationTransaction $xaction) {
+
+ switch ($xaction->getTransactionType()) {
+ case PhabricatorOwnersPackageTransaction::TYPE_DESCRIPTION:
+ return array($xaction->getNewValue());
+ }
+
+ return parent::extractFilePHIDsFromCustomTransaction($object, $xaction);
+ }
+
+ protected function shouldSendMail(
+ PhabricatorLiskDAO $object,
+ array $xactions) {
+ return true;
+ }
+
+ protected function getMailSubjectPrefix() {
+ return PhabricatorEnv::getEnvConfig('metamta.package.subject-prefix');
+ }
+
+ protected function getMailTo(PhabricatorLiskDAO $object) {
+ return array(
+ $object->getPrimaryOwnerPHID(),
+ $this->requireActor()->getPHID(),
+ );
+ }
+
+ protected function getMailCC(PhabricatorLiskDAO $object) {
+ // TODO: needOwners() this
+ return mpull($object->loadOwners(), 'getUserPHID');
+ }
+
+ protected function buildReplyHandler(PhabricatorLiskDAO $object) {
+ return id(new OwnersPackageReplyHandler())
+ ->setMailReceiver($object);
+ }
+
+ protected function buildMailTemplate(PhabricatorLiskDAO $object) {
+ $id = $object->getID();
+ $name = $object->getName();
+
+ return id(new PhabricatorMetaMTAMail())
+ ->setSubject($name)
+ ->addHeader('Thread-Topic', $object->getPHID());
+ }
+
+ protected function buildMailBody(
+ PhabricatorLiskDAO $object,
+ array $xactions) {
+
+ $body = parent::buildMailBody($object, $xactions);
+
+ $detail_uri = PhabricatorEnv::getProductionURI(
+ '/owners/package/'.$object->getID().'/');
+
+ $body->addLinkSection(
+ pht('PACKAGE DETAIL'),
+ $detail_uri);
+
+ return $body;
+ }
+
+}
diff --git a/src/applications/owners/mail/OwnersPackageReplyHandler.php b/src/applications/owners/mail/OwnersPackageReplyHandler.php
index b0f397249e..0e28ff12b1 100644
--- a/src/applications/owners/mail/OwnersPackageReplyHandler.php
+++ b/src/applications/owners/mail/OwnersPackageReplyHandler.php
@@ -3,7 +3,10 @@
final class OwnersPackageReplyHandler extends PhabricatorMailReplyHandler {
public function validateMailReceiver($mail_receiver) {
if (!($mail_receiver instanceof PhabricatorOwnersPackage)) {
- throw new Exception('Receiver is not a PhabricatorOwnersPackage!');
+ throw new Exception(
+ pht(
+ 'Receiver is not a %s!',
+ 'PhabricatorOwnersPackage'));
}
}
diff --git a/src/applications/owners/mail/PackageCreateMail.php b/src/applications/owners/mail/PackageCreateMail.php
deleted file mode 100644
index 486704afd8..0000000000
--- a/src/applications/owners/mail/PackageCreateMail.php
+++ /dev/null
@@ -1,12 +0,0 @@
-package = $package;
- }
-
- abstract protected function getVerb();
-
- abstract protected function isNewThread();
-
- final protected function getPackage() {
- return $this->package;
- }
-
- final protected function getHandles() {
- return $this->handles;
- }
-
- final protected function getOwners() {
- return $this->owners;
- }
-
- final protected function getPaths() {
- return $this->paths;
- }
-
- final protected function getMailTo() {
- return $this->mailTo;
- }
-
- final protected function renderPackageTitle() {
- return $this->getPackage()->getName();
- }
-
- final protected function renderRepoSubSection($repository_phid, $paths) {
- $handles = $this->getHandles();
- $section = array();
- $section[] = ' In repository '.$handles[$repository_phid]->getName().
- ' - '.PhabricatorEnv::getProductionURI($handles[$repository_phid]
- ->getURI());
- foreach ($paths as $path => $excluded) {
- $section[] = ' '.($excluded ? 'Excluded' : 'Included').' '.$path;
- }
-
- return implode("\n", $section);
- }
-
- protected function needSend() {
- return true;
- }
-
- protected function loadData() {
- $package = $this->getPackage();
- $owners = $package->loadOwners();
- $this->owners = $owners;
-
- $owner_phids = mpull($owners, 'getUserPHID');
- $primary_owner_phid = $package->getPrimaryOwnerPHID();
- $mail_to = $owner_phids;
- if (!in_array($primary_owner_phid, $owner_phids)) {
- $mail_to[] = $primary_owner_phid;
- }
- $this->mailTo = $mail_to;
-
- $this->paths = array();
- $repository_paths = mgroup($package->loadPaths(), 'getRepositoryPHID');
- foreach ($repository_paths as $repository_phid => $paths) {
- $this->paths[$repository_phid] = mpull($paths, 'getExcluded', 'getPath');
- }
-
- $phids = array_merge(
- $this->mailTo,
- array($package->getActorPHID()),
- array_keys($this->paths));
- $this->handles = id(new PhabricatorHandleQuery())
- ->setViewer($this->getActor())
- ->withPHIDs($phids)
- ->execute();
- }
-
- final protected function renderSummarySection() {
- $package = $this->getPackage();
- $handles = $this->getHandles();
- $section = array();
- $section[] = $handles[$package->getActorPHID()]->getName().' '.
- strtolower($this->getVerb()).' '.$this->renderPackageTitle().'.';
- $section[] = '';
-
- $section[] = 'PACKAGE DETAIL';
- $section[] = ' '.PhabricatorEnv::getProductionURI(
- '/owners/package/'.$package->getID().'/');
-
- return implode("\n", $section);
- }
-
- protected function renderDescriptionSection() {
- return "PACKAGE DESCRIPTION\n".
- ' '.$this->getPackage()->getDescription();
- }
-
- protected function renderPrimaryOwnerSection() {
- $handles = $this->getHandles();
- return "PRIMARY OWNER\n".
- ' '.$handles[$this->getPackage()->getPrimaryOwnerPHID()]->getName();
- }
-
- protected function renderOwnersSection() {
- $handles = $this->getHandles();
- $owners = $this->getOwners();
- if (!$owners) {
- return null;
- }
-
- $owners = mpull($owners, 'getUserPHID');
- $owners = array_select_keys($handles, $owners);
- $owners = mpull($owners, 'getName');
- return "OWNERS\n".
- ' '.implode(', ', $owners);
- }
-
- protected function renderAuditingEnabledSection() {
- return "AUDITING ENABLED STATUS\n".
- ' '.($this->getPackage()->getAuditingEnabled() ? 'Enabled' : 'Disabled');
- }
-
- protected function renderPathsSection() {
- $section = array();
- $section[] = 'PATHS';
- foreach ($this->paths as $repository_phid => $paths) {
- $section[] = $this->renderRepoSubSection($repository_phid, $paths);
- }
-
- return implode("\n", $section);
- }
-
- final protected function renderBody() {
- $body = array();
- $body[] = $this->renderSummarySection();
- $body[] = $this->renderDescriptionSection();
- $body[] = $this->renderPrimaryOwnerSection();
- $body[] = $this->renderOwnersSection();
- $body[] = $this->renderAuditingEnabledSection();
- $body[] = $this->renderPathsSection();
- $body = array_filter($body);
- return implode("\n\n", $body)."\n";
- }
-
- final public function send() {
- $mails = $this->prepareMails();
-
- foreach ($mails as $mail) {
- $mail->saveAndSend();
- }
- }
-
- final public function prepareMails() {
- if (!$this->needSend()) {
- return array();
- }
-
- $this->loadData();
-
- $package = $this->getPackage();
- $prefix = PhabricatorEnv::getEnvConfig('metamta.package.subject-prefix');
- $verb = $this->getVerb();
- $threading = $this->getMailThreading();
- list($thread_id, $thread_topic) = $threading;
-
- $template = id(new PhabricatorMetaMTAMail())
- ->setSubject($this->renderPackageTitle())
- ->setSubjectPrefix($prefix)
- ->setVarySubjectPrefix("[{$verb}]")
- ->setFrom($package->getActorPHID())
- ->setThreadID($thread_id, $this->isNewThread())
- ->addHeader('Thread-Topic', $thread_topic)
- ->setRelatedPHID($package->getPHID())
- ->setIsBulk(true)
- ->setBody($this->renderBody());
-
- $reply_handler = $this->newReplyHandler();
- $mails = $reply_handler->multiplexMail(
- $template,
- array_select_keys($this->getHandles(), $this->getMailTo()),
- array());
- return $mails;
- }
-
- private function getMailThreading() {
- return array(
- 'package-'.$this->getPackage()->getPHID(),
- 'Package '.$this->getPackage()->getOriginalName(),
- );
- }
-
- private function newReplyHandler() {
- $reply_handler = new OwnersPackageReplyHandler();
- $reply_handler->setMailReceiver($this->getPackage());
- return $reply_handler;
- }
-
-}
diff --git a/src/applications/owners/mail/PackageModifyMail.php b/src/applications/owners/mail/PackageModifyMail.php
deleted file mode 100644
index 206fece688..0000000000
--- a/src/applications/owners/mail/PackageModifyMail.php
+++ /dev/null
@@ -1,160 +0,0 @@
-package = $package;
-
- $this->addOwners = $add_owners;
- $this->removeOwners = $remove_owners;
- $this->allOwners = $all_owners;
- $this->touchedRepos = $touched_repos;
- $this->addPaths = $add_paths;
- $this->removePaths = $remove_paths;
- }
-
- protected function getVerb() {
- return 'Modified';
- }
-
- protected function isNewThread() {
- return false;
- }
-
- protected function needSend() {
- $package = $this->getPackage();
- if ($package->getOldPrimaryOwnerPHID() !== $package->getPrimaryOwnerPHID()
- || $package->getOldAuditingEnabled() != $package->getAuditingEnabled()
- || $this->addOwners
- || $this->removeOwners
- || $this->addPaths
- || $this->removePaths) {
- return true;
- } else {
- return false;
- }
- }
-
- protected function loadData() {
- $this->mailTo = $this->allOwners;
-
- $phids = array_merge(
- $this->allOwners,
- $this->touchedRepos,
- array(
- $this->getPackage()->getActorPHID(),
- ));
- $this->handles = id(new PhabricatorHandleQuery())
- ->setViewer($this->getActor())
- ->withPHIDs($phids)
- ->execute();
- }
-
- protected function renderDescriptionSection() {
- return null;
- }
-
- protected function renderPrimaryOwnerSection() {
- $package = $this->getPackage();
- $handles = $this->getHandles();
-
- $old_primary_owner_phid = $package->getOldPrimaryOwnerPHID();
- $primary_owner_phid = $package->getPrimaryOwnerPHID();
- if ($old_primary_owner_phid == $primary_owner_phid) {
- return null;
- }
-
- $section = array();
- $section[] = 'PRIMARY OWNER CHANGE';
- $section[] = ' Old owner: '.
- $handles[$old_primary_owner_phid]->getName();
- $section[] = ' New owner: '.
- $handles[$primary_owner_phid]->getName();
-
- return implode("\n", $section);
- }
-
- protected function renderOwnersSection() {
- $section = array();
- $add_owners = $this->addOwners;
- $remove_owners = $this->removeOwners;
- $handles = $this->getHandles();
-
- if ($add_owners) {
- $add_owners = array_select_keys($handles, $add_owners);
- $add_owners = mpull($add_owners, 'getName');
- $section[] = 'ADDED OWNERS';
- $section[] = ' '.implode(', ', $add_owners);
- }
-
- if ($remove_owners) {
- if ($add_owners) {
- $section[] = '';
- }
- $remove_owners = array_select_keys($handles, $remove_owners);
- $remove_owners = mpull($remove_owners, 'getName');
- $section[] = 'REMOVED OWNERS';
- $section[] = ' '.implode(', ', $remove_owners);
- }
-
- if ($section) {
- return implode("\n", $section);
- } else {
- return null;
- }
- }
-
- protected function renderAuditingEnabledSection() {
- $package = $this->getPackage();
- $old_auditing_enabled = $package->getOldAuditingEnabled();
- $auditing_enabled = $package->getAuditingEnabled();
- if ($old_auditing_enabled == $auditing_enabled) {
- return null;
- }
-
- $section = array();
- $section[] = 'AUDITING ENABLED STATUS CHANGE';
- $section[] = ' Old value: '.
- ($old_auditing_enabled ? 'Enabled' : 'Disabled');
- $section[] = ' New value: '.
- ($auditing_enabled ? 'Enabled' : 'Disabled');
- return implode("\n", $section);
- }
-
- protected function renderPathsSection() {
- $section = array();
- if ($this->addPaths) {
- $section[] = 'ADDED PATHS';
- foreach ($this->addPaths as $repository_phid => $paths) {
- $section[] = $this->renderRepoSubSection($repository_phid, $paths);
- }
- }
-
- if ($this->removePaths) {
- if ($this->addPaths) {
- $section[] = '';
- }
- $section[] = 'REMOVED PATHS';
- foreach ($this->removePaths as $repository_phid => $paths) {
- $section[] = $this->renderRepoSubSection($repository_phid, $paths);
- }
- }
- return implode("\n", $section);
- }
-
-}
diff --git a/src/applications/owners/query/PhabricatorOwnersPackageQuery.php b/src/applications/owners/query/PhabricatorOwnersPackageQuery.php
index 3bbb3b8fe2..64ed2f4098 100644
--- a/src/applications/owners/query/PhabricatorOwnersPackageQuery.php
+++ b/src/applications/owners/query/PhabricatorOwnersPackageQuery.php
@@ -3,8 +3,10 @@
final class PhabricatorOwnersPackageQuery
extends PhabricatorCursorPagedPolicyAwareQuery {
+ private $ids;
private $phids;
private $ownerPHIDs;
+ private $repositoryPHIDs;
/**
* Owners are direct owners, and members of owning projects.
@@ -19,6 +21,16 @@ public function withPHIDs(array $phids) {
return $this;
}
+ public function withIDs(array $ids) {
+ $this->ids = $ids;
+ return $this;
+ }
+
+ public function withRepositoryPHIDs(array $phids) {
+ $this->repositoryPHIDs = $phids;
+ return $this;
+ }
+
protected function loadPage() {
$table = new PhabricatorOwnersPackage();
$conn_r = $table->establishConnection('r');
@@ -38,27 +50,48 @@ protected function loadPage() {
protected function buildJoinClause(AphrontDatabaseConnection $conn_r) {
$joins = array();
- if ($this->ownerPHIDs) {
+ if ($this->ownerPHIDs !== null) {
$joins[] = qsprintf(
$conn_r,
'JOIN %T o ON o.packageID = p.id',
id(new PhabricatorOwnersOwner())->getTableName());
}
+ if ($this->repositoryPHIDs !== null) {
+ $joins[] = qsprintf(
+ $conn_r,
+ 'JOIN %T rpath ON rpath.packageID = p.id',
+ id(new PhabricatorOwnersPath())->getTableName());
+ }
+
return implode(' ', $joins);
}
protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
$where = array();
- if ($this->phids) {
+ if ($this->phids !== null) {
$where[] = qsprintf(
$conn_r,
'p.phid IN (%Ls)',
$this->phids);
}
- if ($this->ownerPHIDs) {
+ if ($this->ids !== null) {
+ $where[] = qsprintf(
+ $conn_r,
+ 'p.id IN (%Ld)',
+ $this->ids);
+ }
+
+ if ($this->repositoryPHIDs !== null) {
+ $where[] = qsprintf(
+ $conn_r,
+ 'rpath.repositoryPHID IN (%Ls)',
+ $this->repositoryPHIDs);
+ }
+
+ if ($this->ownerPHIDs !== null) {
$base_phids = $this->ownerPHIDs;
$query = new PhabricatorProjectQuery();
diff --git a/src/applications/owners/query/PhabricatorOwnersPackageSearchEngine.php b/src/applications/owners/query/PhabricatorOwnersPackageSearchEngine.php
new file mode 100644
index 0000000000..f421e3d3ce
--- /dev/null
+++ b/src/applications/owners/query/PhabricatorOwnersPackageSearchEngine.php
@@ -0,0 +1,134 @@
+setParameter(
+ 'ownerPHIDs',
+ $this->readUsersFromRequest(
+ $request,
+ 'owners',
+ array(
+ PhabricatorProjectProjectPHIDType::TYPECONST,
+ )));
+
+ $saved->setParameter(
+ 'repositoryPHIDs',
+ $this->readPHIDsFromRequest(
+ $request,
+ 'repositories',
+ array(
+ PhabricatorRepositoryRepositoryPHIDType::TYPECONST,
+ )));
+
+ return $saved;
+ }
+
+ public function buildQueryFromSavedQuery(PhabricatorSavedQuery $saved) {
+ $query = id(new PhabricatorOwnersPackageQuery());
+
+ $owner_phids = $saved->getParameter('ownerPHIDs', array());
+ if ($owner_phids) {
+ $query->withOwnerPHIDs($owner_phids);
+ }
+
+ $repository_phids = $saved->getParameter('repositoryPHIDs', array());
+ if ($repository_phids) {
+ $query->withRepositoryPHIDs($repository_phids);
+ }
+
+ return $query;
+ }
+
+ public function buildSearchForm(
+ AphrontFormView $form,
+ PhabricatorSavedQuery $saved) {
+
+ $owner_phids = $saved->getParameter('ownerPHIDs', array());
+ $repository_phids = $saved->getParameter('repositoryPHIDs', array());
+
+ $form
+ ->appendControl(
+ id(new AphrontFormTokenizerControl())
+ ->setDatasource(new PhabricatorProjectOrUserDatasource())
+ ->setName('owners')
+ ->setLabel(pht('Owners'))
+ ->setValue($owner_phids))
+ ->appendControl(
+ id(new AphrontFormTokenizerControl())
+ ->setDatasource(new DiffusionRepositoryDatasource())
+ ->setName('repositories')
+ ->setLabel(pht('Repositories'))
+ ->setValue($repository_phids));
+ }
+
+ protected function getURI($path) {
+ return '/owners/'.$path;
+ }
+
+ protected function getBuiltinQueryNames() {
+ $names = array();
+
+ if ($this->requireViewer()->isLoggedIn()) {
+ $names['owned'] = pht('Owned');
+ }
+
+ $names += array(
+ 'all' => pht('All Packages'),
+ );
+
+ return $names;
+ }
+
+ public function buildSavedQueryFromBuiltin($query_key) {
+ $query = $this->newSavedQuery();
+ $query->setQueryKey($query_key);
+
+ switch ($query_key) {
+ case 'all':
+ return $query;
+ case 'owned':
+ return $query->setParameter(
+ 'ownerPHIDs',
+ array($this->requireViewer()->getPHID()));
+ }
+
+ return parent::buildSavedQueryFromBuiltin($query_key);
+ }
+
+ protected function renderResultList(
+ array $packages,
+ PhabricatorSavedQuery $query,
+ array $handles) {
+ assert_instances_of($packages, 'PhabricatorOwnersPackage');
+
+ $viewer = $this->requireViewer();
+
+ $list = id(new PHUIObjectItemListView())
+ ->setUser($viewer);
+ foreach ($packages as $package) {
+ $id = $package->getID();
+
+ $item = id(new PHUIObjectItemView())
+ ->setObject($package)
+ ->setObjectName(pht('Package %d', $id))
+ ->setHeader($package->getName())
+ ->setHref('/owners/package/'.$id.'/');
+
+ $list->addItem($item);
+ }
+
+ return $list;
+ }
+}
diff --git a/src/applications/owners/query/PhabricatorOwnersPackageTransactionQuery.php b/src/applications/owners/query/PhabricatorOwnersPackageTransactionQuery.php
new file mode 100644
index 0000000000..e0e7c2792f
--- /dev/null
+++ b/src/applications/owners/query/PhabricatorOwnersPackageTransactionQuery.php
@@ -0,0 +1,10 @@
+setAuditingEnabled(0)
+ ->setPrimaryOwnerPHID($actor->getPHID());
+ }
public function getCapabilities() {
return array(
@@ -37,13 +41,14 @@ protected function getConfiguration() {
return array(
// This information is better available from the history table.
self::CONFIG_TIMESTAMPS => false,
- self::CONFIG_AUX_PHID => true,
+ self::CONFIG_AUX_PHID => true,
self::CONFIG_COLUMN_SCHEMA => array(
'name' => 'text128',
'originalName' => 'text255',
'description' => 'text',
'primaryOwnerPHID' => 'phid?',
'auditingEnabled' => 'bool',
+ 'mailKey' => 'bytes20',
),
self::CONFIG_KEY_SCHEMA => array(
'key_phid' => null,
@@ -60,52 +65,16 @@ protected function getConfiguration() {
}
public function generatePHID() {
- return PhabricatorPHID::generateNewPHID('OPKG');
- }
-
- public function attachUnsavedOwners(array $owners) {
- $this->unsavedOwners = $owners;
- return $this;
- }
-
- public function getUnsavedOwners() {
- return $this->assertAttached($this->unsavedOwners);
- }
-
- public function attachUnsavedPaths(array $paths) {
- $this->unsavedPaths = $paths;
- return $this;
- }
-
- public function getUnsavedPaths() {
- return $this->assertAttached($this->unsavedPaths);
- }
-
- public function attachActorPHID($actor_phid) {
- $this->actorPHID = $actor_phid;
- return $this;
- }
-
- public function getActorPHID() {
- return $this->actorPHID;
+ return PhabricatorPHID::generateNewPHID(
+ PhabricatorOwnersPackagePHIDType::TYPECONST);
}
- public function attachOldPrimaryOwnerPHID($old_primary) {
- $this->oldPrimaryOwnerPHID = $old_primary;
- return $this;
- }
-
- public function getOldPrimaryOwnerPHID() {
- return $this->oldPrimaryOwnerPHID;
- }
-
- public function attachOldAuditingEnabled($auditing_enabled) {
- $this->oldAuditingEnabled = $auditing_enabled;
- return $this;
- }
+ public function save() {
+ if (!$this->getMailKey()) {
+ $this->setMailKey(Filesystem::readRandomCharacters(20));
+ }
- public function getOldAuditingEnabled() {
- return $this->oldAuditingEnabled;
+ return parent::save();
}
public function setName($name) {
@@ -143,15 +112,15 @@ public static function loadAffectedPackages(
}
return self::loadPackagesForPaths($repository, $paths);
- }
+ }
- public static function loadOwningPackages($repository, $path) {
+ public static function loadOwningPackages($repository, $path) {
if (empty($path)) {
return array();
}
return self::loadPackagesForPaths($repository, array($path), 1);
- }
+ }
private static function loadPackagesForPaths(
PhabricatorRepository $repository,
@@ -268,4 +237,27 @@ private static function splitPath($path) {
}
return $result;
}
+
+
+/* -( PhabricatorApplicationTransactionInterface )------------------------- */
+
+
+ public function getApplicationTransactionEditor() {
+ return new PhabricatorOwnersPackageTransactionEditor();
+ }
+
+ public function getApplicationTransactionObject() {
+ return $this;
+ }
+
+ public function getApplicationTransactionTemplate() {
+ return new PhabricatorOwnersPackageTransaction();
+ }
+
+ public function willRenderTimeline(
+ PhabricatorApplicationTransactionView $timeline,
+ AphrontRequest $request) {
+ return $timeline;
+ }
+
}
diff --git a/src/applications/owners/storage/PhabricatorOwnersPackageTransaction.php b/src/applications/owners/storage/PhabricatorOwnersPackageTransaction.php
new file mode 100644
index 0000000000..3686125887
--- /dev/null
+++ b/src/applications/owners/storage/PhabricatorOwnersPackageTransaction.php
@@ -0,0 +1,211 @@
+getOldValue();
+ $new = $this->getNewValue();
+
+ switch ($this->getTransactionType()) {
+ case self::TYPE_PRIMARY:
+ if ($old) {
+ $phids[] = $old;
+ }
+ if ($new) {
+ $phids[] = $new;
+ }
+ break;
+ case self::TYPE_OWNERS:
+ $add = array_diff($new, $old);
+ foreach ($add as $phid) {
+ $phids[] = $phid;
+ }
+ $rem = array_diff($old, $new);
+ foreach ($rem as $phid) {
+ $phids[] = $phid;
+ }
+ break;
+ }
+
+ return $phids;
+ }
+
+ public function shouldHide() {
+ $old = $this->getOldValue();
+ $new = $this->getNewValue();
+
+ switch ($this->getTransactionType()) {
+ case self::TYPE_DESCRIPTION:
+ return ($old === null);
+ }
+ }
+
+ public function getTitle() {
+ $old = $this->getOldValue();
+ $new = $this->getNewValue();
+ $author_phid = $this->getAuthorPHID();
+
+ switch ($this->getTransactionType()) {
+ case self::TYPE_NAME:
+ if ($old === null) {
+ return pht(
+ '%s created this package.',
+ $this->renderHandleLink($author_phid));
+ } else {
+ return pht(
+ '%s renamed this package from "%s" to "%s".',
+ $this->renderHandleLink($author_phid),
+ $old,
+ $new);
+ }
+ case self::TYPE_PRIMARY:
+ return pht(
+ '%s changed the primary owner for this package from %s to %s.',
+ $this->renderHandleLink($author_phid),
+ $this->renderHandleLink($old),
+ $this->renderHandleLink($new));
+ case self::TYPE_OWNERS:
+ $add = array_diff($new, $old);
+ $rem = array_diff($old, $new);
+ if ($add && !$rem) {
+ return pht(
+ '%s added %s owner(s): %s.',
+ $this->renderHandleLink($author_phid),
+ count($add),
+ $this->renderHandleList($add));
+ } else if ($rem && !$add) {
+ return pht(
+ '%s removed %s owner(s): %s.',
+ $this->renderHandleLink($author_phid),
+ count($rem),
+ $this->renderHandleList($rem));
+ } else {
+ return pht(
+ '%s changed %s package owner(s), added %s: %s; removed %s: %s.',
+ $this->renderHandleLink($author_phid),
+ count($add) + count($rem),
+ count($add),
+ $this->renderHandleList($add),
+ count($rem),
+ $this->renderHandleList($rem));
+ }
+ case self::TYPE_AUDITING:
+ if ($new) {
+ return pht(
+ '%s enabled auditing for this package.',
+ $this->renderHandleLink($author_phid));
+ } else {
+ return pht(
+ '%s disabled auditing for this package.',
+ $this->renderHandleLink($author_phid));
+ }
+ case self::TYPE_DESCRIPTION:
+ return pht(
+ '%s updated the description for this package.',
+ $this->renderHandleLink($author_phid));
+ case self::TYPE_PATHS:
+ // TODO: Flesh this out.
+ return pht(
+ '%s updated paths for this package.',
+ $this->renderHandleLink($author_phid));
+ }
+
+ return parent::getTitle();
+ }
+
+ public function hasChangeDetails() {
+ switch ($this->getTransactionType()) {
+ case self::TYPE_DESCRIPTION:
+ return ($this->getOldValue() !== null);
+ case self::TYPE_PATHS:
+ return true;
+ }
+
+ return parent::hasChangeDetails();
+ }
+
+ public function renderChangeDetails(PhabricatorUser $viewer) {
+ switch ($this->getTransactionType()) {
+ case self::TYPE_DESCRIPTION:
+ $old = $this->getOldValue();
+ $new = $this->getNewValue();
+
+ return $this->renderTextCorpusChangeDetails(
+ $viewer,
+ $old,
+ $new);
+ case self::TYPE_PATHS:
+ $old = $this->getOldValue();
+ $new = $this->getNewValue();
+
+ $diffs = PhabricatorOwnersPath::getTransactionValueChanges($old, $new);
+ list($rem, $add) = $diffs;
+
+ $rows = array();
+ foreach ($rem as $ref) {
+ $rows[] = array(
+ 'class' => 'diff-removed',
+ 'change' => '-',
+ ) + $ref;
+ }
+
+ foreach ($add as $ref) {
+ $rows[] = array(
+ 'class' => 'diff-added',
+ 'change' => '+',
+ ) + $ref;
+ }
+
+ $rowc = array();
+ foreach ($rows as $key => $row) {
+ $rowc[] = $row['class'];
+ $rows[$key] = array(
+ $row['change'],
+ $row['excluded'] ? pht('Exclude') : pht('Include'),
+ $viewer->renderHandle($row['repositoryPHID']),
+ $row['path'],
+ );
+ }
+
+ $table = id(new AphrontTableView($rows))
+ ->setRowClasses($rowc)
+ ->setHeaders(
+ array(
+ null,
+ pht('Type'),
+ pht('Repository'),
+ pht('Path'),
+ ))
+ ->setColumnClasses(
+ array(
+ null,
+ null,
+ null,
+ 'wide',
+ ));
+
+ return $table;
+ }
+
+ return parent::renderChangeDetails($viewer);
+ }
+
+}
diff --git a/src/applications/owners/storage/PhabricatorOwnersPath.php b/src/applications/owners/storage/PhabricatorOwnersPath.php
index 0cc987e6bb..f65d6052db 100644
--- a/src/applications/owners/storage/PhabricatorOwnersPath.php
+++ b/src/applications/owners/storage/PhabricatorOwnersPath.php
@@ -22,4 +22,52 @@ protected function getConfiguration() {
) + parent::getConfiguration();
}
+
+ public static function newFromRef(array $ref) {
+ $path = new PhabricatorOwnersPath();
+ $path->repositoryPHID = $ref['repositoryPHID'];
+ $path->path = $ref['path'];
+ $path->excluded = $ref['excluded'];
+ return $path;
+ }
+
+ public function getRef() {
+ return array(
+ 'repositoryPHID' => $this->getRepositoryPHID(),
+ 'path' => $this->getPath(),
+ 'excluded' => (int)$this->getExcluded(),
+ );
+ }
+
+ public static function getTransactionValueChanges(array $old, array $new) {
+ return array(
+ self::getTransactionValueDiff($old, $new),
+ self::getTransactionValueDiff($new, $old),
+ );
+ }
+
+ private static function getTransactionValueDiff(array $u, array $v) {
+ $set = self::getSetFromTransactionValue($v);
+
+ foreach ($u as $key => $ref) {
+ if (self::isRefInSet($ref, $set)) {
+ unset($u[$key]);
+ }
+ }
+
+ return $u;
+ }
+
+ public static function getSetFromTransactionValue(array $v) {
+ $set = array();
+ foreach ($v as $ref) {
+ $set[$ref['repositoryPHID']][$ref['path']][$ref['excluded']] = true;
+ }
+ return $set;
+ }
+
+ public static function isRefInSet(array $ref, array $set) {
+ return isset($set[$ref['repositoryPHID']][$ref['path']][$ref['excluded']]);
+ }
+
}
diff --git a/src/applications/passphrase/controller/PassphraseCredentialConduitController.php b/src/applications/passphrase/controller/PassphraseCredentialConduitController.php
index cea1aeac6a..4c65b5d07d 100644
--- a/src/applications/passphrase/controller/PassphraseCredentialConduitController.php
+++ b/src/applications/passphrase/controller/PassphraseCredentialConduitController.php
@@ -60,8 +60,8 @@ public function processRequest() {
->appendChild(
pht(
'This credential and its secret will no longer be able '.
- 'to be retrieved using the `passphrase.query` method '.
- 'in Conduit.'))
+ 'to be retrieved using the `%s` method in Conduit.',
+ 'passphrase.query'))
->addSubmitButton(pht('Prevent Conduit Access'))
->addCancelButton($view_uri);
} else {
@@ -70,7 +70,7 @@ public function processRequest() {
->appendChild(
pht(
'This credential will be able to be retrieved via the Conduit '.
- 'API by users who have access to this credential. You should '.
+ 'API by users who have access to this credential. You should '.
'only enable this for credentials which need to be accessed '.
'programmatically (such as from build agents).'))
->addSubmitButton(pht('Allow Conduit Access'))
diff --git a/src/applications/passphrase/credentialtype/PassphraseCredentialTypeSSHPrivateKeyText.php b/src/applications/passphrase/credentialtype/PassphraseCredentialTypeSSHPrivateKeyText.php
index dc2b80a857..c197d7eae0 100644
--- a/src/applications/passphrase/credentialtype/PassphraseCredentialTypeSSHPrivateKeyText.php
+++ b/src/applications/passphrase/credentialtype/PassphraseCredentialTypeSSHPrivateKeyText.php
@@ -45,9 +45,11 @@ public function decryptSecret(
if (!Filesystem::binaryExists('ssh-keygen')) {
throw new Exception(
pht(
- 'Decrypting SSH keys requires the `ssh-keygen` binary, but it '.
- 'is not available in PATH. Either make it available or strip the '.
- 'password fromt his SSH key manually before uploading it.'));
+ 'Decrypting SSH keys requires the `%s` binary, but it '.
+ 'is not available in %s. Either make it available or strip the '.
+ 'password fromt his SSH key manually before uploading it.',
+ 'ssh-keygen',
+ '$PATH'));
}
list($err, $stdout, $stderr) = exec_manual(
diff --git a/src/applications/paste/conduit/PasteCreateConduitAPIMethod.php b/src/applications/paste/conduit/PasteCreateConduitAPIMethod.php
index 0c09109a2c..379f5b6e8d 100644
--- a/src/applications/paste/conduit/PasteCreateConduitAPIMethod.php
+++ b/src/applications/paste/conduit/PasteCreateConduitAPIMethod.php
@@ -7,7 +7,7 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return 'Create a new paste.';
+ return pht('Create a new paste.');
}
protected function defineParamTypes() {
@@ -24,7 +24,7 @@ protected function defineReturnType() {
protected function defineErrorTypes() {
return array(
- 'ERR-NO-PASTE' => 'Paste may not be empty.',
+ 'ERR-NO-PASTE' => pht('Paste may not be empty.'),
);
}
@@ -37,7 +37,7 @@ protected function execute(ConduitAPIRequest $request) {
throw new ConduitException('ERR-NO-PASTE');
}
- $title = nonempty($title, 'Masterwork From Distant Lands');
+ $title = nonempty($title, pht('Masterwork From Distant Lands'));
$language = nonempty($language, '');
$viewer = $request->getUser();
diff --git a/src/applications/paste/conduit/PasteInfoConduitAPIMethod.php b/src/applications/paste/conduit/PasteInfoConduitAPIMethod.php
index ea39b9c18c..e34583e76a 100644
--- a/src/applications/paste/conduit/PasteInfoConduitAPIMethod.php
+++ b/src/applications/paste/conduit/PasteInfoConduitAPIMethod.php
@@ -11,11 +11,11 @@ public function getMethodStatus() {
}
public function getMethodStatusDescription() {
- return "Replaced by 'paste.query'.";
+ return pht("Replaced by '%s'.", 'paste.query');
}
public function getMethodDescription() {
- return 'Retrieve an array of information about a paste.';
+ return pht('Retrieve an array of information about a paste.');
}
protected function defineParamTypes() {
@@ -30,7 +30,7 @@ protected function defineReturnType() {
protected function defineErrorTypes() {
return array(
- 'ERR_BAD_PASTE' => 'No such paste exists',
+ 'ERR_BAD_PASTE' => pht('No such paste exists.'),
);
}
diff --git a/src/applications/paste/conduit/PasteQueryConduitAPIMethod.php b/src/applications/paste/conduit/PasteQueryConduitAPIMethod.php
index b03079245a..6f3f87acf2 100644
--- a/src/applications/paste/conduit/PasteQueryConduitAPIMethod.php
+++ b/src/applications/paste/conduit/PasteQueryConduitAPIMethod.php
@@ -7,7 +7,7 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return 'Query Pastes.';
+ return pht('Query Pastes.');
}
protected function defineParamTypes() {
diff --git a/src/applications/paste/config/PhabricatorPasteConfigOptions.php b/src/applications/paste/config/PhabricatorPasteConfigOptions.php
index e12fdc954d..bb970905c4 100644
--- a/src/applications/paste/config/PhabricatorPasteConfigOptions.php
+++ b/src/applications/paste/config/PhabricatorPasteConfigOptions.php
@@ -21,20 +21,6 @@ public function getGroup() {
public function getOptions() {
return array(
- $this->newOption(
- 'metamta.paste.public-create-email',
- 'string',
- null)
- ->setLocked(true)
- ->setLockedMessage(pht(
- 'This configuration is deprecated. See description for details.'))
- ->setSummary(pht('DEPRECATED - Allow creating pastes via email.'))
- ->setDescription(
- pht(
- 'This config has been deprecated in favor of [[ '.
- '/applications/view/PhabricatorPasteApplication/ | '.
- 'application settings ]], which allow for multiple email '.
- 'addresses and other functionality.')),
$this->newOption(
'metamta.paste.subject-prefix',
'string',
diff --git a/src/applications/paste/mail/PasteReplyHandler.php b/src/applications/paste/mail/PasteReplyHandler.php
index b8c498b76e..6a58eb64e6 100644
--- a/src/applications/paste/mail/PasteReplyHandler.php
+++ b/src/applications/paste/mail/PasteReplyHandler.php
@@ -5,7 +5,8 @@ final class PasteReplyHandler
public function validateMailReceiver($mail_receiver) {
if (!($mail_receiver instanceof PhabricatorPaste)) {
- throw new Exception('Mail receiver is not a PhabricatorPaste.');
+ throw new Exception(
+ pht('Mail receiver is not a %s.', 'PhabricatorPaste'));
}
}
diff --git a/src/applications/people/conduit/UserDisableConduitAPIMethod.php b/src/applications/people/conduit/UserDisableConduitAPIMethod.php
index 6d9850a8ab..3512d3f742 100644
--- a/src/applications/people/conduit/UserDisableConduitAPIMethod.php
+++ b/src/applications/people/conduit/UserDisableConduitAPIMethod.php
@@ -7,7 +7,7 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return 'Permanently disable specified users (admin only).';
+ return pht('Permanently disable specified users (admin only).');
}
protected function defineParamTypes() {
@@ -22,8 +22,8 @@ protected function defineReturnType() {
protected function defineErrorTypes() {
return array(
- 'ERR-PERMISSIONS' => 'Only admins can call this method.',
- 'ERR-BAD-PHID' => 'Non existent user PHID.',
+ 'ERR-PERMISSIONS' => pht('Only admins can call this method.'),
+ 'ERR-BAD-PHID' => pht('Non existent user PHID.'),
);
}
diff --git a/src/applications/people/conduit/UserEnableConduitAPIMethod.php b/src/applications/people/conduit/UserEnableConduitAPIMethod.php
index e29ce3ca61..f7cb117df6 100644
--- a/src/applications/people/conduit/UserEnableConduitAPIMethod.php
+++ b/src/applications/people/conduit/UserEnableConduitAPIMethod.php
@@ -7,7 +7,7 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return 'Re-enable specified users (admin only).';
+ return pht('Re-enable specified users (admin only).');
}
protected function defineParamTypes() {
@@ -22,8 +22,8 @@ protected function defineReturnType() {
protected function defineErrorTypes() {
return array(
- 'ERR-PERMISSIONS' => 'Only admins can call this method.',
- 'ERR-BAD-PHID' => 'Non existent user PHID.',
+ 'ERR-PERMISSIONS' => pht('Only admins can call this method.'),
+ 'ERR-BAD-PHID' => pht('Non existent user PHID.'),
);
}
diff --git a/src/applications/people/conduit/UserFindConduitAPIMethod.php b/src/applications/people/conduit/UserFindConduitAPIMethod.php
index 06f124d3a3..2390abad06 100644
--- a/src/applications/people/conduit/UserFindConduitAPIMethod.php
+++ b/src/applications/people/conduit/UserFindConduitAPIMethod.php
@@ -11,11 +11,11 @@ public function getMethodStatus() {
}
public function getMethodStatusDescription() {
- return pht('Obsoleted by "user.query".');
+ return pht('Obsoleted by "%s".', 'user.query');
}
public function getMethodDescription() {
- return pht('Lookup PHIDs by username. Obsoleted by "user.query".');
+ return pht('Lookup PHIDs by username. Obsoleted by "%s".', 'user.query');
}
protected function defineParamTypes() {
diff --git a/src/applications/people/conduit/UserQueryConduitAPIMethod.php b/src/applications/people/conduit/UserQueryConduitAPIMethod.php
index 4a567a0158..c42414a6be 100644
--- a/src/applications/people/conduit/UserQueryConduitAPIMethod.php
+++ b/src/applications/people/conduit/UserQueryConduitAPIMethod.php
@@ -7,7 +7,7 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return 'Query users.';
+ return pht('Query users.');
}
protected function defineParamTypes() {
@@ -28,7 +28,7 @@ protected function defineReturnType() {
protected function defineErrorTypes() {
return array(
- 'ERR-INVALID-PARAMETER' => 'Missing or malformed parameter.',
+ 'ERR-INVALID-PARAMETER' => pht('Missing or malformed parameter.'),
);
}
diff --git a/src/applications/people/conduit/UserWhoAmIConduitAPIMethod.php b/src/applications/people/conduit/UserWhoAmIConduitAPIMethod.php
index b646246c5d..13884e1e83 100644
--- a/src/applications/people/conduit/UserWhoAmIConduitAPIMethod.php
+++ b/src/applications/people/conduit/UserWhoAmIConduitAPIMethod.php
@@ -7,7 +7,7 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return 'Retrieve information about the logged-in user.';
+ return pht('Retrieve information about the logged-in user.');
}
protected function defineParamTypes() {
diff --git a/src/applications/people/controller/PhabricatorPeopleApproveController.php b/src/applications/people/controller/PhabricatorPeopleApproveController.php
index bbf69f23f8..a906b15655 100644
--- a/src/applications/people/controller/PhabricatorPeopleApproveController.php
+++ b/src/applications/people/controller/PhabricatorPeopleApproveController.php
@@ -33,11 +33,13 @@ public function processRequest() {
'Phabricator Account "%s" Approved',
$user->getUsername());
- $body = pht(
- "Your Phabricator account (%s) has been approved by %s. You can ".
- "login here:\n\n %s\n\n",
- $user->getUsername(),
- $admin->getUsername(),
+ $body = sprintf(
+ "%s\n\n %s\n\n",
+ pht(
+ 'Your Phabricator account (%s) has been approved by %s. You can '.
+ 'login here:',
+ $user->getUsername(),
+ $admin->getUsername()),
PhabricatorEnv::getProductionURI('/'));
$mail = id(new PhabricatorMetaMTAMail())
diff --git a/src/applications/people/controller/PhabricatorPeopleDeleteController.php b/src/applications/people/controller/PhabricatorPeopleDeleteController.php
index fcd819e06b..e95dd4c646 100644
--- a/src/applications/people/controller/PhabricatorPeopleDeleteController.php
+++ b/src/applications/people/controller/PhabricatorPeopleDeleteController.php
@@ -44,8 +44,7 @@ public function processRequest() {
'so on), but less safe to delete established users. If possible, '.
'disable them instead.');
- $str4 = pht(
- 'To permanently destroy this user, run this command:');
+ $str4 = pht('To permanently destroy this user, run this command:');
$form = id(new AphrontFormView())
->setUser($admin)
@@ -73,9 +72,7 @@ private function buildDeleteSelfResponse($profile_uri) {
pht(
'As you stare into the gaping maw of the abyss, something '.
'holds you back.'))
- ->appendParagraph(
- pht(
- 'You can not delete your own account.'))
+ ->appendParagraph(pht('You can not delete your own account.'))
->addCancelButton($profile_uri, pht('Turn Back'));
}
diff --git a/src/applications/people/controller/PhabricatorPeopleDisableController.php b/src/applications/people/controller/PhabricatorPeopleDisableController.php
index a1715dffda..7ef4099709 100644
--- a/src/applications/people/controller/PhabricatorPeopleDisableController.php
+++ b/src/applications/people/controller/PhabricatorPeopleDisableController.php
@@ -41,8 +41,7 @@ public function processRequest() {
->setTitle(pht('Something Stays Your Hand'))
->appendParagraph(
pht(
- 'Try as you might, you find you can not disable your '.
- 'own account.'))
+ 'Try as you might, you find you can not disable your own account.'))
->addCancelButton($done_uri, pht('Curses!'));
}
diff --git a/src/applications/people/controller/PhabricatorPeopleFeedController.php b/src/applications/people/controller/PhabricatorPeopleFeedController.php
index 5907ae4a1e..64a443cabe 100644
--- a/src/applications/people/controller/PhabricatorPeopleFeedController.php
+++ b/src/applications/people/controller/PhabricatorPeopleFeedController.php
@@ -38,8 +38,9 @@ public function processRequest() {
$builder = new PhabricatorFeedBuilder($stories);
$builder->setUser($viewer);
$builder->setShowHovercards(true);
- $builder->setNoDataString(pht('To begin on such a grand journey, '.
- 'requires but just a single step.'));
+ $builder->setNoDataString(
+ pht(
+ 'To begin on such a grand journey, requires but just a single step.'));
$view = $builder->buildView();
$feed = phutil_tag_div(
diff --git a/src/applications/people/controller/PhabricatorPeopleLdapController.php b/src/applications/people/controller/PhabricatorPeopleLdapController.php
index 22cb29be02..6f5fa09f3f 100644
--- a/src/applications/people/controller/PhabricatorPeopleLdapController.php
+++ b/src/applications/people/controller/PhabricatorPeopleLdapController.php
@@ -26,7 +26,7 @@ public function handleRequest(AphrontRequest $request) {
->appendChild(
id(new AphrontFormTextControl())
->setLabel(pht('LDAP query'))
- ->setCaption(pht('A filter such as (objectClass=*)'))
+ ->setCaption(pht('A filter such as %s.', '(objectClass=*)'))
->setName('query'))
->appendChild(
id(new AphrontFormSubmitControl())
@@ -131,7 +131,7 @@ private function processSearchRequest($request) {
$ldap_provider = PhabricatorLDAPAuthProvider::getLDAPProvider();
if (!$ldap_provider) {
- throw new Exception('No LDAP provider enabled!');
+ throw new Exception(pht('No LDAP provider enabled!'));
}
$ldap_adapter = $ldap_provider->getAdapter();
diff --git a/src/applications/people/controller/PhabricatorPeopleNewController.php b/src/applications/people/controller/PhabricatorPeopleNewController.php
index 21dce04192..93f9c42faa 100644
--- a/src/applications/people/controller/PhabricatorPeopleNewController.php
+++ b/src/applications/people/controller/PhabricatorPeopleNewController.php
@@ -123,12 +123,10 @@ public function handleRequest(AphrontRequest $request) {
if ($is_bot) {
$form->appendRemarkupInstructions(
- pht(
- 'You are creating a new **bot/script** user account.'));
+ pht('You are creating a new **bot/script** user account.'));
} else {
$form->appendRemarkupInstructions(
- pht(
- 'You are creating a new **standard** user account.'));
+ pht('You are creating a new **standard** user account.'));
}
$form
diff --git a/src/applications/people/controller/PhabricatorPeopleWelcomeController.php b/src/applications/people/controller/PhabricatorPeopleWelcomeController.php
index 7b0131a4b5..b3762e67c9 100644
--- a/src/applications/people/controller/PhabricatorPeopleWelcomeController.php
+++ b/src/applications/people/controller/PhabricatorPeopleWelcomeController.php
@@ -40,9 +40,7 @@ public function processRequest() {
'The email contains a link to log in to their account. Sending '.
'another copy of the email can be useful if the original was lost '.
'or never sent.'))
- ->appendParagraph(
- pht(
- 'The email will identify you as the sender.'))
+ ->appendParagraph(pht('The email will identify you as the sender.'))
->addSubmitButton(pht('Send Email'))
->addCancelButton($profile_uri);
}
diff --git a/src/applications/people/editor/PhabricatorUserEditor.php b/src/applications/people/editor/PhabricatorUserEditor.php
index 3a3ccdc351..cc34696f2d 100644
--- a/src/applications/people/editor/PhabricatorUserEditor.php
+++ b/src/applications/people/editor/PhabricatorUserEditor.php
@@ -27,7 +27,7 @@ public function createNewUser(
$allow_reassign = false) {
if ($user->getID()) {
- throw new Exception('User has already been created!');
+ throw new Exception(pht('User has already been created!'));
}
$is_reassign = false;
@@ -35,18 +35,17 @@ public function createNewUser(
if ($allow_reassign) {
if ($email->getIsPrimary()) {
throw new Exception(
- pht(
- 'Primary email addresses can not be reassigned.'));
+ pht('Primary email addresses can not be reassigned.'));
}
$is_reassign = true;
} else {
- throw new Exception('Email has already been created!');
+ throw new Exception(pht('Email has already been created!'));
}
}
if (!PhabricatorUser::validateUsername($user->getUsername())) {
$valid = PhabricatorUser::describeValidUsername();
- throw new Exception("Username is invalid! {$valid}");
+ throw new Exception(pht('Username is invalid! %s', $valid));
}
// Always set a new user's email address to primary.
@@ -107,8 +106,9 @@ public function createNewUser(
public function updateUser(
PhabricatorUser $user,
PhabricatorUserEmail $email = null) {
+
if (!$user->getID()) {
- throw new Exception('User has not been created yet!');
+ throw new Exception(pht('User has not been created yet!'));
}
$user->openTransaction();
@@ -137,7 +137,7 @@ public function changePassword(
PhutilOpaqueEnvelope $envelope) {
if (!$user->getID()) {
- throw new Exception('User has not been created yet!');
+ throw new Exception(pht('User has not been created yet!'));
}
$user->openTransaction();
@@ -163,12 +163,12 @@ public function changeUsername(PhabricatorUser $user, $username) {
$actor = $this->requireActor();
if (!$user->getID()) {
- throw new Exception('User has not been created yet!');
+ throw new Exception(pht('User has not been created yet!'));
}
if (!PhabricatorUser::validateUsername($username)) {
$valid = PhabricatorUser::describeValidUsername();
- throw new Exception("Username is invalid! {$valid}");
+ throw new Exception(pht('Username is invalid! %s', $valid));
}
$old_username = $user->getUsername();
@@ -209,7 +209,7 @@ public function makeAdminUser(PhabricatorUser $user, $admin) {
$actor = $this->requireActor();
if (!$user->getID()) {
- throw new Exception('User has not been created yet!');
+ throw new Exception(pht('User has not been created yet!'));
}
$user->openTransaction();
@@ -247,7 +247,7 @@ public function makeSystemAgentUser(PhabricatorUser $user, $system_agent) {
$actor = $this->requireActor();
if (!$user->getID()) {
- throw new Exception('User has not been created yet!');
+ throw new Exception(pht('User has not been created yet!'));
}
$user->openTransaction();
@@ -286,7 +286,7 @@ public function disableUser(PhabricatorUser $user, $disable) {
$actor = $this->requireActor();
if (!$user->getID()) {
- throw new Exception('User has not been created yet!');
+ throw new Exception(pht('User has not been created yet!'));
}
$user->openTransaction();
@@ -325,7 +325,7 @@ public function approveUser(PhabricatorUser $user, $approve) {
$actor = $this->requireActor();
if (!$user->getID()) {
- throw new Exception('User has not been created yet!');
+ throw new Exception(pht('User has not been created yet!'));
}
$user->openTransaction();
@@ -370,10 +370,10 @@ public function addEmail(
$actor = $this->requireActor();
if (!$user->getID()) {
- throw new Exception('User has not been created yet!');
+ throw new Exception(pht('User has not been created yet!'));
}
if ($email->getID()) {
- throw new Exception('Email has already been created!');
+ throw new Exception(pht('Email has already been created!'));
}
// Use changePrimaryEmail() to change primary email.
@@ -420,10 +420,10 @@ public function removeEmail(
$actor = $this->requireActor();
if (!$user->getID()) {
- throw new Exception('User has not been created yet!');
+ throw new Exception(pht('User has not been created yet!'));
}
if (!$email->getID()) {
- throw new Exception('Email has not been created yet!');
+ throw new Exception(pht('Email has not been created yet!'));
}
$user->openTransaction();
@@ -433,10 +433,10 @@ public function removeEmail(
$email->reload();
if ($email->getIsPrimary()) {
- throw new Exception("Can't remove primary email!");
+ throw new Exception(pht("Can't remove primary email!"));
}
if ($email->getUserPHID() != $user->getPHID()) {
- throw new Exception('Email not owned by user!');
+ throw new Exception(pht('Email not owned by user!'));
}
$email->delete();
@@ -466,10 +466,10 @@ public function changePrimaryEmail(
$actor = $this->requireActor();
if (!$user->getID()) {
- throw new Exception('User has not been created yet!');
+ throw new Exception(pht('User has not been created yet!'));
}
if (!$email->getID()) {
- throw new Exception('Email has not been created yet!');
+ throw new Exception(pht('Email has not been created yet!'));
}
$user->openTransaction();
@@ -479,15 +479,15 @@ public function changePrimaryEmail(
$email->reload();
if ($email->getUserPHID() != $user->getPHID()) {
- throw new Exception('User does not own email!');
+ throw new Exception(pht('User does not own email!'));
}
if ($email->getIsPrimary()) {
- throw new Exception('Email is already primary!');
+ throw new Exception(pht('Email is already primary!'));
}
if (!$email->getIsVerified()) {
- throw new Exception('Email is not verified!');
+ throw new Exception(pht('Email is not verified!'));
}
$old_primary = $user->loadPrimaryEmail();
@@ -538,10 +538,10 @@ public function verifyEmail(
$actor = $this->requireActor();
if (!$user->getID()) {
- throw new Exception('User has not been created yet!');
+ throw new Exception(pht('User has not been created yet!'));
}
if (!$email->getID()) {
- throw new Exception('Email has not been created yet!');
+ throw new Exception(pht('Email has not been created yet!'));
}
$user->openTransaction();
@@ -610,13 +610,11 @@ public function reassignEmail(
if ($old_user != $user->getPHID()) {
if ($email->getIsVerified()) {
throw new Exception(
- pht(
- 'Verified email addresses can not be reassigned.'));
+ pht('Verified email addresses can not be reassigned.'));
}
if ($email->getIsPrimary()) {
throw new Exception(
- pht(
- 'Primary email addresses can not be reassigned.'));
+ pht('Primary email addresses can not be reassigned.'));
}
$email->setUserPHID($user->getPHID());
diff --git a/src/applications/people/editor/__tests__/PhabricatorUserEditorTestCase.php b/src/applications/people/editor/__tests__/PhabricatorUserEditorTestCase.php
index 6cc6abf37b..ef0c58060a 100644
--- a/src/applications/people/editor/__tests__/PhabricatorUserEditorTestCase.php
+++ b/src/applications/people/editor/__tests__/PhabricatorUserEditorTestCase.php
@@ -27,9 +27,7 @@ public function testRegistrationEmailInvalid() {
$email = $prefix.'@evil.com@example.com';
try {
- $this->registerUser(
- 'PhabricatorUserEditorTestCaseInvalid',
- $email);
+ $this->registerUser('PhabricatorUserEditorTestCaseInvalid', $email);
} catch (Exception $ex) {
$caught = $ex;
}
diff --git a/src/applications/people/storage/PhabricatorUser.php b/src/applications/people/storage/PhabricatorUser.php
index e66a34d9a1..d69fa146d1 100644
--- a/src/applications/people/storage/PhabricatorUser.php
+++ b/src/applications/people/storage/PhabricatorUser.php
@@ -184,8 +184,9 @@ public function generatePHID() {
public function setPassword(PhutilOpaqueEnvelope $envelope) {
if (!$this->getPHID()) {
throw new Exception(
- 'You can not set a password for an unsaved user because their PHID '.
- 'is a salt component in the password hash.');
+ pht(
+ 'You can not set a password for an unsaved user because their PHID '.
+ 'is a salt component in the password hash.'));
}
if (!strlen($envelope->openEnvelope())) {
@@ -372,7 +373,7 @@ public function validateCSRFToken($token) {
}
break;
default:
- throw new Exception('Unknown CSRF token format!');
+ throw new Exception(pht('Unknown CSRF token format!'));
}
}
@@ -425,7 +426,7 @@ public function loadUserProfile() {
public function loadPrimaryEmailAddress() {
$email = $this->loadPrimaryEmail();
if (!$email) {
- throw new Exception('User has no primary email address!');
+ throw new Exception(pht('User has no primary email address!'));
}
return $email->getAddress();
}
@@ -564,36 +565,31 @@ public function sendWelcomeEmail(PhabricatorUser $admin) {
$this->loadPrimaryEmail(),
PhabricatorAuthSessionEngine::ONETIME_WELCOME);
- $body = <<addTos(array($this->getPHID()))
->setForceDelivery(true)
- ->setSubject('[Phabricator] Welcome to Phabricator')
+ ->setSubject(pht('[Phabricator] Welcome to Phabricator'))
->setBody($body)
->saveAndSend();
}
@@ -613,31 +609,36 @@ public function sendUsernameChangeEmail(
$this,
null,
PhabricatorAuthSessionEngine::ONETIME_USERNAME);
- $password_instructions = <<addTos(array($this->getPHID()))
->setForceDelivery(true)
- ->setSubject('[Phabricator] Username Changed')
+ ->setSubject(pht('[Phabricator] Username Changed'))
->setBody($body)
->saveAndSend();
}
diff --git a/src/applications/people/storage/PhabricatorUserEmail.php b/src/applications/people/storage/PhabricatorUserEmail.php
index 4ae58130a2..42946015de 100644
--- a/src/applications/people/storage/PhabricatorUserEmail.php
+++ b/src/applications/people/storage/PhabricatorUserEmail.php
@@ -83,8 +83,9 @@ public static function isValidAddress($address) {
*/
public static function describeValidAddresses() {
return pht(
- "Email addresses should be in the form 'user@domain.com'. The maximum ".
- "length of an email address is %d character(s).",
+ "Email addresses should be in the form '%s'. The maximum ".
+ "length of an email address is %s character(s).",
+ 'user@domain.com',
new PhutilNumber(self::MAX_ADDRESS_LENGTH));
}
@@ -131,10 +132,11 @@ public static function describeAllowedAddresses() {
}
if (count($domains) == 1) {
- return 'Email address must be @'.head($domains);
+ return pht('Email address must be @%s', head($domains));
} else {
- return 'Email address must be at one of: '.
- implode(', ', $domains);
+ return pht(
+ 'Email address must be at one of: %s',
+ implode(', ', $domains));
}
}
@@ -174,27 +176,23 @@ public function sendVerificationEmail(PhabricatorUser $user) {
$signature = null;
if (!$is_serious) {
- $signature = <<addRawTos(array($address))
->setForceDelivery(true)
- ->setSubject('[Phabricator] Email Verification')
+ ->setSubject(pht('[Phabricator] Email Verification'))
->setBody($body)
->setRelatedPHID($user->getPHID())
->saveAndSend();
@@ -220,19 +218,20 @@ public function sendOldPrimaryEmail(
$old_address = $this->getAddress();
$new_address = $new->getAddress();
- $body = <<addRawTos(array($old_address))
->setForceDelivery(true)
- ->setSubject('[Phabricator] Primary Address Changed')
+ ->setSubject(pht('[Phabricator] Primary Address Changed'))
->setBody($body)
->setFrom($user->getPHID())
->setRelatedPHID($user->getPHID())
@@ -253,18 +252,18 @@ public function sendNewPrimaryEmail(PhabricatorUser $user) {
$new_address = $this->getAddress();
- $body = <<addRawTos(array($new_address))
->setForceDelivery(true)
- ->setSubject('[Phabricator] Primary Address Changed')
+ ->setSubject(pht('[Phabricator] Primary Address Changed'))
->setBody($body)
->setFrom($user->getPHID())
->setRelatedPHID($user->getPHID())
diff --git a/src/applications/people/storage/__tests__/PhabricatorUserTestCase.php b/src/applications/people/storage/__tests__/PhabricatorUserTestCase.php
index 561bcb2d63..a29dd4f20c 100644
--- a/src/applications/people/storage/__tests__/PhabricatorUserTestCase.php
+++ b/src/applications/people/storage/__tests__/PhabricatorUserTestCase.php
@@ -49,7 +49,7 @@ public function testUsernameValidation() {
$this->assertEqual(
$expect,
PhabricatorUser::validateUsername($name),
- "Validity of '{$name}'.");
+ pht("Validity of '%s'.", $name));
}
}
diff --git a/src/applications/people/typeahead/PhabricatorPeopleNoOwnerDatasource.php b/src/applications/people/typeahead/PhabricatorPeopleNoOwnerDatasource.php
index 90c887ac06..35f62e31dc 100644
--- a/src/applications/people/typeahead/PhabricatorPeopleNoOwnerDatasource.php
+++ b/src/applications/people/typeahead/PhabricatorPeopleNoOwnerDatasource.php
@@ -23,16 +23,14 @@ public function getDatasourceFunctions() {
'name' => pht('No Owner'),
'summary' => pht('Find results which are not assigned.'),
'description' => pht(
- 'This function includes results which have no owner. Use a query '.
- 'like this to find unassigned results:'.
- "\n\n".
- '> none()'.
- "\n\n".
- 'If you combine this function with other functions, the query will '.
- 'return results which match the other selectors //or// have no '.
- 'owner. For example, this query will find results which are owned '.
- 'by `alincoln`, and will also find results which have no owner:'.
- "\n\n".
+ "This function includes results which have no owner. Use a query ".
+ "like this to find unassigned results:\n\n%s\n\n".
+ "If you combine this function with other functions, the query will ".
+ "return results which match the other selectors //or// have no ".
+ "owner. For example, this query will find results which are owned ".
+ "by `alincoln`, and will also find results which have no owner:".
+ "\n\n%s",
+ '> none()',
'> alincoln, none()'),
),
);
diff --git a/src/applications/people/typeahead/PhabricatorViewerDatasource.php b/src/applications/people/typeahead/PhabricatorViewerDatasource.php
index 5e08a7e702..1c9276ae8d 100644
--- a/src/applications/people/typeahead/PhabricatorViewerDatasource.php
+++ b/src/applications/people/typeahead/PhabricatorViewerDatasource.php
@@ -21,16 +21,15 @@ public function getDatasourceFunctions() {
'name' => pht('Current Viewer'),
'summary' => pht('Use the current viewing user.'),
'description' => pht(
- 'This function allows you to change the behavior of a query '.
- 'based on who is running it. When you use this function, you will '.
- 'be the current viewer, so it works like you typed your own '.
- 'username.'.
- "\n\n".
- 'However, if you save a query using this function and send it '.
- 'to someone else, it will work like //their// username was the '.
- 'one that was typed. This can be useful for building dashboard '.
- 'panels that always show relevant information to the user who '.
- 'is looking at them.'),
+ "This function allows you to change the behavior of a query ".
+ "based on who is running it. When you use this function, you will ".
+ "be the current viewer, so it works like you typed your own ".
+ "username.\n\n".
+ "However, if you save a query using this function and send it ".
+ "to someone else, it will work like //their// username was the ".
+ "one that was typed. This can be useful for building dashboard ".
+ "panels that always show relevant information to the user who ".
+ "is looking at them."),
),
);
}
diff --git a/src/applications/phame/conduit/PhameQueryConduitAPIMethod.php b/src/applications/phame/conduit/PhameQueryConduitAPIMethod.php
index 8b882674a3..d82afc2faf 100644
--- a/src/applications/phame/conduit/PhameQueryConduitAPIMethod.php
+++ b/src/applications/phame/conduit/PhameQueryConduitAPIMethod.php
@@ -7,7 +7,7 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return 'Query phame blogs.';
+ return pht('Query phame blogs.');
}
public function getMethodStatus() {
diff --git a/src/applications/phame/conduit/PhameQueryPostsConduitAPIMethod.php b/src/applications/phame/conduit/PhameQueryPostsConduitAPIMethod.php
index 822c32a8da..06c20c7720 100644
--- a/src/applications/phame/conduit/PhameQueryPostsConduitAPIMethod.php
+++ b/src/applications/phame/conduit/PhameQueryPostsConduitAPIMethod.php
@@ -7,7 +7,7 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return 'Query phame posts.';
+ return pht('Query phame posts.');
}
public function getMethodStatus() {
diff --git a/src/applications/phame/controller/PhameController.php b/src/applications/phame/controller/PhameController.php
index a9ede96133..5e786e9d41 100644
--- a/src/applications/phame/controller/PhameController.php
+++ b/src/applications/phame/controller/PhameController.php
@@ -64,12 +64,16 @@ protected function renderPostList(
$blogger = phutil_tag('strong', array(), $blogger);
if ($post->isDraft()) {
- $title = pht('%s drafted a blog post on %s.',
- $blogger, $blog);
+ $title = pht(
+ '%s drafted a blog post on %s.',
+ $blogger,
+ $blog);
$title = phutil_tag('em', array(), $title);
} else {
- $title = pht('%s wrote a blog post on %s.',
- $blogger, $blog);
+ $title = pht(
+ '%s wrote a blog post on %s.',
+ $blogger,
+ $blog);
}
$item = id(new PHUIObjectItemView())
diff --git a/src/applications/phame/controller/blog/PhameBlogEditController.php b/src/applications/phame/controller/blog/PhameBlogEditController.php
index 8b1b3b81e1..65eabeb055 100644
--- a/src/applications/phame/controller/blog/PhameBlogEditController.php
+++ b/src/applications/phame/controller/blog/PhameBlogEditController.php
@@ -153,7 +153,7 @@ public function handleRequest(AphrontRequest $request) {
->setName('custom_domain')
->setValue($custom_domain)
->setCaption(
- pht('Must include at least one dot (.), e.g. blog.example.com'))
+ pht('Must include at least one dot (.), e.g. %s', 'blog.example.com'))
->setError($e_custom_domain))
->appendChild(
id(new AphrontFormSelectControl())
diff --git a/src/applications/phame/controller/blog/PhameBlogListController.php b/src/applications/phame/controller/blog/PhameBlogListController.php
index f9a4aeb2d9..9b16203170 100644
--- a/src/applications/phame/controller/blog/PhameBlogListController.php
+++ b/src/applications/phame/controller/blog/PhameBlogListController.php
@@ -26,7 +26,7 @@ public function handleRequest(AphrontRequest $request) {
));
break;
default:
- throw new Exception("Unknown filter '{$filter}'!");
+ throw new Exception(pht("Unknown filter '%s'!", $filter));
}
$pager = id(new AphrontPagerView())
diff --git a/src/applications/phame/controller/blog/PhameBlogViewController.php b/src/applications/phame/controller/blog/PhameBlogViewController.php
index 76491278b5..a9fb9d73a7 100644
--- a/src/applications/phame/controller/blog/PhameBlogViewController.php
+++ b/src/applications/phame/controller/blog/PhameBlogViewController.php
@@ -161,7 +161,7 @@ private function renderActions(PhameBlog $blog, PhabricatorUser $user) {
id(new PhabricatorActionView())
->setIcon('fa-pencil')
->setHref($this->getApplicationURI('blog/edit/'.$blog->getID().'/'))
- ->setName('Edit Blog')
+ ->setName(pht('Edit Blog'))
->setDisabled(!$can_edit)
->setWorkflow(!$can_edit));
@@ -169,7 +169,7 @@ private function renderActions(PhameBlog $blog, PhabricatorUser $user) {
id(new PhabricatorActionView())
->setIcon('fa-times')
->setHref($this->getApplicationURI('blog/delete/'.$blog->getID().'/'))
- ->setName('Delete Blog')
+ ->setName(pht('Delete Blog'))
->setDisabled(!$can_edit)
->setWorkflow(true));
diff --git a/src/applications/phame/controller/post/PhamePostListController.php b/src/applications/phame/controller/post/PhamePostListController.php
index 23e9c985f1..7c82319158 100644
--- a/src/applications/phame/controller/post/PhamePostListController.php
+++ b/src/applications/phame/controller/post/PhamePostListController.php
@@ -54,7 +54,7 @@ public function processRequest() {
$nav->selectFilter('post/all');
break;
default:
- throw new Exception("Unknown filter '{$this->filter}'!");
+ throw new Exception(pht("Unknown filter '%s'!", $this->filter));
}
$pager = id(new AphrontCursorPagerView())
diff --git a/src/applications/phame/controller/post/PhamePostViewController.php b/src/applications/phame/controller/post/PhamePostViewController.php
index c1f6405377..1b2b8c1a3c 100644
--- a/src/applications/phame/controller/post/PhamePostViewController.php
+++ b/src/applications/phame/controller/post/PhamePostViewController.php
@@ -41,8 +41,9 @@ public function handleRequest(AphrontRequest $request) {
->setSeverity(PHUIInfoView::SEVERITY_NOTICE)
->setTitle(pht('Draft Post'))
->appendChild(
- pht('Only you can see this draft until you publish it. '.
- 'Use "Preview / Publish" to publish this post.')));
+ pht(
+ 'Only you can see this draft until you publish it. '.
+ 'Use "Preview / Publish" to publish this post.')));
}
if (!$post->getBlog()) {
@@ -51,8 +52,9 @@ public function handleRequest(AphrontRequest $request) {
->setSeverity(PHUIInfoView::SEVERITY_WARNING)
->setTitle(pht('Not On A Blog'))
->appendChild(
- pht('This post is not associated with a blog (the blog may have '.
- 'been deleted). Use "Move Post" to move it to a new blog.')));
+ pht(
+ 'This post is not associated with a blog (the blog may have '.
+ 'been deleted). Use "Move Post" to move it to a new blog.')));
}
$nav->appendChild(
diff --git a/src/applications/phame/skins/PhameSkinSpecification.php b/src/applications/phame/skins/PhameSkinSpecification.php
index 506f89a811..7dedf8ab4b 100644
--- a/src/applications/phame/skins/PhameSkinSpecification.php
+++ b/src/applications/phame/skins/PhameSkinSpecification.php
@@ -42,9 +42,13 @@ public static function loadAllSkinSpecifications() {
$that_dir = $specs[$name]->getRootDirectory();
$this_dir = $spec->getRootDirectory();
throw new Exception(
- "Two skins have the same name ('{$name}'), in '{$this_dir}' and ".
- "'{$that_dir}'. Rename one or adjust your 'phame.skins' ".
- "configuration.");
+ pht(
+ "Two skins have the same name ('%s'), in '%s' and '%s'. ".
+ "Rename one or adjust your '%s' configuration.",
+ $name,
+ $this_dir,
+ $that_dir,
+ 'phame.skins'));
}
$specs[$name] = $spec;
@@ -124,7 +128,7 @@ private static function loadSkinSpecification($path) {
$spec->addPhutilLibrary($path.DIRECTORY_SEPARATOR.'src');
break;
default:
- throw new Exception('Unknown skin type!');
+ throw new Exception(pht('Unknown skin type!'));
}
$spec->setType($type);
diff --git a/src/applications/phame/storage/PhameBlog.php b/src/applications/phame/storage/PhameBlog.php
index 1c4017fbd1..349d40d773 100644
--- a/src/applications/phame/storage/PhameBlog.php
+++ b/src/applications/phame/storage/PhameBlog.php
@@ -74,8 +74,9 @@ public function getSkinRenderer(AphrontRequest $request) {
if (!$spec) {
throw new Exception(
- 'This blog has an invalid skin, and the default skin failed to '.
- 'load.');
+ pht(
+ 'This blog has an invalid skin, and the default skin failed to '.
+ 'load.'));
}
$skin = newv($spec->getSkinClass(), array());
diff --git a/src/applications/phame/storage/PhamePost.php b/src/applications/phame/storage/PhamePost.php
index 8a02a7c564..e44e9615d3 100644
--- a/src/applications/phame/storage/PhamePost.php
+++ b/src/applications/phame/storage/PhamePost.php
@@ -155,8 +155,9 @@ public function toDictionary() {
public static function getVisibilityOptionsForSelect() {
return array(
- self::VISIBILITY_DRAFT => 'Draft: visible only to me.',
- self::VISIBILITY_PUBLISHED => 'Published: visible to the whole world.',
+ self::VISIBILITY_DRAFT => pht('Draft: visible only to me.'),
+ self::VISIBILITY_PUBLISHED => pht(
+ 'Published: visible to the whole world.'),
);
}
@@ -217,8 +218,7 @@ public function hasAutomaticCapability($capability, PhabricatorUser $user) {
}
public function describeAutomaticCapability($capability) {
- return pht(
- 'The author of a blog post can always view and edit it.');
+ return pht('The author of a blog post can always view and edit it.');
}
diff --git a/src/applications/phid/conduit/PHIDInfoConduitAPIMethod.php b/src/applications/phid/conduit/PHIDInfoConduitAPIMethod.php
index 465697c60e..76afb1ef54 100644
--- a/src/applications/phid/conduit/PHIDInfoConduitAPIMethod.php
+++ b/src/applications/phid/conduit/PHIDInfoConduitAPIMethod.php
@@ -11,11 +11,11 @@ public function getMethodStatus() {
}
public function getMethodStatusDescription() {
- return "Replaced by 'phid.query'.";
+ return pht("Replaced by 'phid.query'.");
}
public function getMethodDescription() {
- return 'Retrieve information about an arbitrary PHID.';
+ return pht('Retrieve information about an arbitrary PHID.');
}
protected function defineParamTypes() {
@@ -30,7 +30,7 @@ protected function defineReturnType() {
protected function defineErrorTypes() {
return array(
- 'ERR-BAD-PHID' => 'No such object exists.',
+ 'ERR-BAD-PHID' => pht('No such object exists.'),
);
}
diff --git a/src/applications/phid/conduit/PHIDLookupConduitAPIMethod.php b/src/applications/phid/conduit/PHIDLookupConduitAPIMethod.php
index 73196daaff..f70afb9931 100644
--- a/src/applications/phid/conduit/PHIDLookupConduitAPIMethod.php
+++ b/src/applications/phid/conduit/PHIDLookupConduitAPIMethod.php
@@ -7,7 +7,7 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return 'Look up objects by name.';
+ return pht('Look up objects by name.');
}
protected function defineParamTypes() {
diff --git a/src/applications/phid/conduit/PHIDQueryConduitAPIMethod.php b/src/applications/phid/conduit/PHIDQueryConduitAPIMethod.php
index 69b6fe0acb..420d6a2f92 100644
--- a/src/applications/phid/conduit/PHIDQueryConduitAPIMethod.php
+++ b/src/applications/phid/conduit/PHIDQueryConduitAPIMethod.php
@@ -7,7 +7,7 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return 'Retrieve information about arbitrary PHIDs.';
+ return pht('Retrieve information about arbitrary PHIDs.');
}
protected function defineParamTypes() {
diff --git a/src/applications/phid/storage/PhabricatorPHID.php b/src/applications/phid/storage/PhabricatorPHID.php
index 43896045b9..d3c43bfc47 100644
--- a/src/applications/phid/storage/PhabricatorPHID.php
+++ b/src/applications/phid/storage/PhabricatorPHID.php
@@ -9,7 +9,7 @@ final class PhabricatorPHID {
public static function generateNewPHID($type, $subtype = null) {
if (!$type) {
- throw new Exception('Can not generate PHID with no type.');
+ throw new Exception(pht('Can not generate PHID with no type.'));
}
if ($subtype === null) {
diff --git a/src/applications/phid/type/PhabricatorPHIDType.php b/src/applications/phid/type/PhabricatorPHIDType.php
index fd64ab7bd1..62107233e1 100644
--- a/src/applications/phid/type/PhabricatorPHIDType.php
+++ b/src/applications/phid/type/PhabricatorPHIDType.php
@@ -9,16 +9,20 @@ final public function getTypeConstant() {
if ($const === false) {
throw new Exception(
pht(
- 'PHIDType class "%s" must define an TYPECONST property.',
- get_class($this)));
+ '%s class "%s" must define a %s property.',
+ __CLASS__,
+ get_class($this),
+ 'TYPECONST'));
}
if (!is_string($const) || !preg_match('/^[A-Z]{4}$/', $const)) {
throw new Exception(
pht(
- 'PHIDType class "%s" has an invalid TYPECONST property. PHID '.
+ '%s class "%s" has an invalid %s property. PHID '.
'constants must be a four character uppercase string.',
- get_class($this)));
+ __CLASS__,
+ get_class($this),
+ 'TYPECONST'));
}
return $const;
diff --git a/src/applications/pholio/controller/PholioInlineController.php b/src/applications/pholio/controller/PholioInlineController.php
index 782383cdb8..4cc5510b99 100644
--- a/src/applications/pholio/controller/PholioInlineController.php
+++ b/src/applications/pholio/controller/PholioInlineController.php
@@ -70,7 +70,7 @@ public function processRequest() {
$file = $image->getFile();
if (!$file->isViewableImage()) {
- throw new Exception('File is not viewable.');
+ throw new Exception(pht('File is not viewable.'));
}
$image_uri = $file->getBestURI();
diff --git a/src/applications/pholio/controller/PholioMockEditController.php b/src/applications/pholio/controller/PholioMockEditController.php
index 7cfa0b35b4..17abba6e60 100644
--- a/src/applications/pholio/controller/PholioMockEditController.php
+++ b/src/applications/pholio/controller/PholioMockEditController.php
@@ -276,7 +276,7 @@ public function processRequest() {
'id' => $drop_id,
'class' => 'pholio-edit-drop',
),
- 'Drag and drop images here to add them to the mock.');
+ pht('Drag and drop images here to add them to the mock.'));
$order_control = phutil_tag(
'input',
diff --git a/src/applications/pholio/mail/PholioReplyHandler.php b/src/applications/pholio/mail/PholioReplyHandler.php
index 3f20ea6371..1109d901f0 100644
--- a/src/applications/pholio/mail/PholioReplyHandler.php
+++ b/src/applications/pholio/mail/PholioReplyHandler.php
@@ -5,7 +5,7 @@ final class PholioReplyHandler
public function validateMailReceiver($mail_receiver) {
if (!($mail_receiver instanceof PholioMock)) {
- throw new Exception('Mail receiver is not a PholioMock!');
+ throw new Exception(pht('Mail receiver is not a %s!', 'PholioMock'));
}
}
diff --git a/src/applications/pholio/view/PholioMockImagesView.php b/src/applications/pholio/view/PholioMockImagesView.php
index c1bcb46230..cf8d0c6143 100644
--- a/src/applications/pholio/view/PholioMockImagesView.php
+++ b/src/applications/pholio/view/PholioMockImagesView.php
@@ -54,7 +54,7 @@ public function __construct() {
public function getBehaviorConfig() {
if (!$this->getMock()) {
- throw new Exception('Call setMock() before getBehaviorConfig()!');
+ throw new PhutilInvalidStateException('setMock');
}
if ($this->behaviorConfig === null) {
@@ -158,7 +158,7 @@ private function calculateBehaviorConfig() {
public function render() {
if (!$this->getMock()) {
- throw new Exception('Call setMock() before render()!');
+ throw new PhutilInvalidStateException('setMock');
}
$mock = $this->getMock();
diff --git a/src/applications/pholio/view/PholioTransactionView.php b/src/applications/pholio/view/PholioTransactionView.php
index 50d764910d..cf2f44a3aa 100644
--- a/src/applications/pholio/view/PholioTransactionView.php
+++ b/src/applications/pholio/view/PholioTransactionView.php
@@ -67,7 +67,7 @@ protected function renderTransactionContent(
$inlines[] = $xaction;
break;
default:
- throw new Exception('Unknown grouped transaction type!');
+ throw new Exception(pht('Unknown grouped transaction type!'));
}
}
@@ -101,12 +101,12 @@ private function renderInlineContent(PholioTransaction $inline) {
$image = idx($images, $comment->getImageID());
if (!$image) {
- throw new Exception('No image attached!');
+ throw new Exception(pht('No image attached!'));
}
$file = $image->getFile();
if (!$file->isViewableImage()) {
- throw new Exception('File is not viewable.');
+ throw new Exception(pht('File is not viewable.'));
}
$image_uri = $file->getBestURI();
diff --git a/src/applications/phortune/control/PhortuneMonthYearExpiryControl.php b/src/applications/phortune/control/PhortuneMonthYearExpiryControl.php
index b9c48cd595..73f26bc26d 100644
--- a/src/applications/phortune/control/PhortuneMonthYearExpiryControl.php
+++ b/src/applications/phortune/control/PhortuneMonthYearExpiryControl.php
@@ -38,7 +38,7 @@ protected function getCustomControlClass() {
protected function renderInput() {
if (!$this->getUser()) {
- throw new Exception('You must setUser() before render()!');
+ throw new PhutilInvalidStateException('setUser');
}
// represent months like a credit card does
diff --git a/src/applications/phortune/controller/PhortuneCartCancelController.php b/src/applications/phortune/controller/PhortuneCartCancelController.php
index b7415c5211..3aedceb6b0 100644
--- a/src/applications/phortune/controller/PhortuneCartCancelController.php
+++ b/src/applications/phortune/controller/PhortuneCartCancelController.php
@@ -175,8 +175,7 @@ public function processRequest() {
if ($is_refund) {
$title = pht('Refund Order?');
- $body = pht(
- 'Really refund this order?');
+ $body = pht('Really refund this order?');
$button = pht('Refund Order');
$cancel_text = pht('Cancel');
@@ -193,8 +192,7 @@ public function processRequest() {
} else {
$title = pht('Cancel Order?');
- $body = pht(
- 'Really cancel this order? Any payment will be refunded.');
+ $body = pht('Really cancel this order? Any payment will be refunded.');
$button = pht('Cancel Order');
// Don't give the user a "Cancel" button in response to a "Cancel?"
diff --git a/src/applications/phortune/controller/PhortuneCartCheckoutController.php b/src/applications/phortune/controller/PhortuneCartCheckoutController.php
index b6b9287104..2d6ff2342a 100644
--- a/src/applications/phortune/controller/PhortuneCartCheckoutController.php
+++ b/src/applications/phortune/controller/PhortuneCartCheckoutController.php
@@ -200,7 +200,7 @@ public function processRequest() {
$provider_form = new PHUIFormLayoutView();
$provider_form->appendChild(
id(new AphrontFormMarkupControl())
- ->setLabel('Pay With')
+ ->setLabel(pht('Pay With'))
->setValue($one_time_options));
}
diff --git a/src/applications/phortune/controller/PhortuneMerchantViewController.php b/src/applications/phortune/controller/PhortuneMerchantViewController.php
index c1512e9d32..5026597121 100644
--- a/src/applications/phortune/controller/PhortuneMerchantViewController.php
+++ b/src/applications/phortune/controller/PhortuneMerchantViewController.php
@@ -297,5 +297,4 @@ private function buildProviderList(
}
-
}
diff --git a/src/applications/phortune/controller/PhortunePaymentMethodCreateController.php b/src/applications/phortune/controller/PhortunePaymentMethodCreateController.php
index 844dd2ed5e..6b7e55bb54 100644
--- a/src/applications/phortune/controller/PhortunePaymentMethodCreateController.php
+++ b/src/applications/phortune/controller/PhortunePaymentMethodCreateController.php
@@ -44,8 +44,9 @@ public function processRequest() {
$providers = $this->loadCreatePaymentMethodProvidersForMerchant($merchant);
if (!$providers) {
throw new Exception(
- 'There are no payment providers enabled that can add payment '.
- 'methods.');
+ pht(
+ 'There are no payment providers enabled that can add payment '.
+ 'methods.'));
}
if (count($providers) == 1) {
diff --git a/src/applications/phortune/controller/PhortuneProviderEditController.php b/src/applications/phortune/controller/PhortuneProviderEditController.php
index da18fdbb45..3ed97b5a4b 100644
--- a/src/applications/phortune/controller/PhortuneProviderEditController.php
+++ b/src/applications/phortune/controller/PhortuneProviderEditController.php
@@ -260,8 +260,7 @@ private function processChooseClassRequest(
->setUser($viewer)
->addHiddenInput('merchantID', $merchant->getID())
->appendRemarkupInstructions(
- pht(
- 'Choose the type of payment provider to add:'))
+ pht('Choose the type of payment provider to add:'))
->appendChild($panel_classes)
->appendChild(
id(new AphrontFormSubmitControl())
diff --git a/src/applications/phortune/currency/PhortuneCurrency.php b/src/applications/phortune/currency/PhortuneCurrency.php
index b59d9b144a..f69dd362fe 100644
--- a/src/applications/phortune/currency/PhortuneCurrency.php
+++ b/src/applications/phortune/currency/PhortuneCurrency.php
@@ -52,7 +52,7 @@ public static function newFromString($string, $default = null) {
case 'USD':
break;
default:
- throw new Exception("Unsupported currency '{$currency}'!");
+ throw new Exception(pht("Unsupported currency '%s'!", $currency));
}
return self::newFromValueAndCurrency($value, $currency);
@@ -121,7 +121,7 @@ public function getValueInUSDCents() {
}
private static function throwFormatException($string) {
- throw new Exception("Invalid currency format ('{$string}').");
+ throw new Exception(pht("Invalid currency format ('%s').", $string));
}
private function throwUnlikeCurrenciesException(PhortuneCurrency $other) {
diff --git a/src/applications/phortune/currency/PhortuneCurrencySerializer.php b/src/applications/phortune/currency/PhortuneCurrencySerializer.php
index affcb77517..b5f7560443 100644
--- a/src/applications/phortune/currency/PhortuneCurrencySerializer.php
+++ b/src/applications/phortune/currency/PhortuneCurrencySerializer.php
@@ -11,7 +11,8 @@ public function willWriteValue($value) {
throw new Exception(
pht(
'Trying to save object with a currency column, but the column '.
- 'value is not a PhortuneCurrency object.'));
+ 'value is not a %s object.',
+ 'PhortuneCurrency'));
}
return $value->serializeForStorage();
diff --git a/src/applications/phortune/exception/PhortuneNotImplementedException.php b/src/applications/phortune/exception/PhortuneNotImplementedException.php
index 7912ab30f2..eac3b3b7a8 100644
--- a/src/applications/phortune/exception/PhortuneNotImplementedException.php
+++ b/src/applications/phortune/exception/PhortuneNotImplementedException.php
@@ -3,9 +3,10 @@
final class PhortuneNotImplementedException extends Exception {
public function __construct(PhortunePaymentProvider $provider) {
- $class = get_class($provider);
return parent::__construct(
- "Provider '{$class}' does not implement this method.");
+ pht(
+ "Provider '%s' does not implement this method.",
+ get_class($provider)));
}
}
diff --git a/src/applications/phortune/mail/PhortuneCartReplyHandler.php b/src/applications/phortune/mail/PhortuneCartReplyHandler.php
index 4f333d8301..9c781fc900 100644
--- a/src/applications/phortune/mail/PhortuneCartReplyHandler.php
+++ b/src/applications/phortune/mail/PhortuneCartReplyHandler.php
@@ -5,7 +5,7 @@ final class PhortuneCartReplyHandler
public function validateMailReceiver($mail_receiver) {
if (!($mail_receiver instanceof PhortuneCart)) {
- throw new Exception('Mail receiver is not a PhortuneCart!');
+ throw new Exception(pht('Mail receiver is not a %s!', 'PhortuneCart'));
}
}
diff --git a/src/applications/phortune/management/PhabricatorPhortuneManagementInvoiceWorkflow.php b/src/applications/phortune/management/PhabricatorPhortuneManagementInvoiceWorkflow.php
index e1053e74a1..673bf812d7 100644
--- a/src/applications/phortune/management/PhabricatorPhortuneManagementInvoiceWorkflow.php
+++ b/src/applications/phortune/management/PhabricatorPhortuneManagementInvoiceWorkflow.php
@@ -54,7 +54,8 @@ public function execute(PhutilArgumentParser $args) {
if (!$subscription_phid) {
throw new PhutilArgumentUsageException(
pht(
- 'Specify which subscription to invoice with --subscription.'));
+ 'Specify which subscription to invoice with %s.',
+ '--subscription'));
}
$subscription = id(new PhortuneSubscriptionQuery())
@@ -90,30 +91,38 @@ public function execute(PhutilArgumentParser $args) {
if (!$auto_range && !$last_arg && !$next_arg) {
throw new PhutilArgumentUsageException(
pht(
- 'Specify a billing range with --last and --next, or use '.
- '--auto-range.'));
+ 'Specify a billing range with %s and %s, or use %s.',
+ '--last',
+ '--next',
+ '--auto-range'));
} else if (!$auto_range & (!$last_arg || !$next_arg)) {
throw new PhutilArgumentUsageException(
pht(
- 'When specifying --last or --next, you must specify both arguments '.
- 'to define the beginning and end of the billing range.'));
+ 'When specifying %s or %s, you must specify both arguments '.
+ 'to define the beginning and end of the billing range.',
+ '--last',
+ '--next'));
} else if (!$auto_range && ($last_arg && $next_arg)) {
$last_time = $this->parseTimeArgument($args->getArg('last'));
$next_time = $this->parseTimeArgument($args->getArg('next'));
} else if ($auto_range && ($last_arg || $next_arg)) {
throw new PhutilArgumentUsageException(
pht(
- 'Use either --auto-range or --last and --next to specify the '.
- 'billing range, but not both.'));
+ 'Use either %s or %s and %s to specify the '.
+ 'billing range, but not both.',
+ '--auto-range',
+ '--last',
+ '--next'));
} else {
$trigger = $subscription->getTrigger();
$event = $trigger->getEvent();
if (!$event) {
throw new PhutilArgumentUsageException(
pht(
- 'Unable to calculate --auto-range, this subscription has not been '.
+ 'Unable to calculate %s, this subscription has not been '.
'scheduled for billing yet. Wait for the trigger daemon to '.
- 'schedule the subscription.'));
+ 'schedule the subscription.',
+ '--auto-range'));
}
$last_time = $event->getLastEventEpoch();
$next_time = $event->getNextEventEpoch();
diff --git a/src/applications/phortune/provider/PhortunePayPalPaymentProvider.php b/src/applications/phortune/provider/PhortunePayPalPaymentProvider.php
index fcc0d12bf4..078141f8a1 100644
--- a/src/applications/phortune/provider/PhortunePayPalPaymentProvider.php
+++ b/src/applications/phortune/provider/PhortunePayPalPaymentProvider.php
@@ -27,8 +27,7 @@ public function getConfigureDescription() {
}
public function getConfigureProvidesDescription() {
- return pht(
- 'This merchant accepts payments via PayPal.');
+ return pht('This merchant accepts payments via PayPal.');
}
public function getConfigureInstructions() {
diff --git a/src/applications/phortune/provider/PhortuneStripePaymentProvider.php b/src/applications/phortune/provider/PhortuneStripePaymentProvider.php
index f751e3cbc5..1e7c348297 100644
--- a/src/applications/phortune/provider/PhortuneStripePaymentProvider.php
+++ b/src/applications/phortune/provider/PhortuneStripePaymentProvider.php
@@ -24,8 +24,7 @@ public function getConfigureDescription() {
}
public function getConfigureProvidesDescription() {
- return pht(
- 'This merchant accepts credit and debit cards via Stripe.');
+ return pht('This merchant accepts credit and debit cards via Stripe.');
}
public function getPaymentMethodDescription() {
@@ -147,7 +146,7 @@ protected function executeCharge(
$id = $stripe_charge->id;
if (!$id) {
- throw new Exception('Stripe charge call did not return an ID!');
+ throw new Exception(pht('Stripe charge call did not return an ID!'));
}
$charge->setMetadataValue('stripe.chargeID', $id);
diff --git a/src/applications/phortune/storage/PhortuneCart.php b/src/applications/phortune/storage/PhortuneCart.php
index 70ecbb21c9..22dc27a9ed 100644
--- a/src/applications/phortune/storage/PhortuneCart.php
+++ b/src/applications/phortune/storage/PhortuneCart.php
@@ -87,8 +87,9 @@ public function activateCart() {
if ($copy->getStatus() !== self::STATUS_BUILDING) {
throw new Exception(
pht(
- 'Cart has wrong status ("%s") to call willApplyCharge().',
- $copy->getStatus()));
+ 'Cart has wrong status ("%s") to call %s.',
+ $copy->getStatus(),
+ 'willApplyCharge()'));
}
$this->setStatus(self::STATUS_READY)->save();
@@ -129,9 +130,9 @@ public function willApplyCharge(
if ($copy->getStatus() !== self::STATUS_READY) {
throw new Exception(
pht(
- 'Cart has wrong status ("%s") to call willApplyCharge(), '.
- 'expected "%s".',
+ 'Cart has wrong status ("%s") to call %s, expected "%s".',
$copy->getStatus(),
+ 'willApplyCharge()',
self::STATUS_READY));
}
@@ -156,9 +157,9 @@ public function didHoldCharge(PhortuneCharge $charge) {
if ($copy->getStatus() !== self::STATUS_PURCHASING) {
throw new Exception(
pht(
- 'Cart has wrong status ("%s") to call didHoldCharge(), '.
- 'expected "%s".',
+ 'Cart has wrong status ("%s") to call %s, expected "%s".',
$copy->getStatus(),
+ 'didHoldCharge()',
self::STATUS_PURCHASING));
}
@@ -184,8 +185,9 @@ public function didApplyCharge(PhortuneCharge $charge) {
($copy->getStatus() !== self::STATUS_HOLD)) {
throw new Exception(
pht(
- 'Cart has wrong status ("%s") to call didApplyCharge().',
- $copy->getStatus()));
+ 'Cart has wrong status ("%s") to call %s.',
+ $copy->getStatus(),
+ 'didApplyCharge()'));
}
$charge->save();
@@ -219,8 +221,9 @@ public function willReviewCart() {
if (($copy->getStatus() !== self::STATUS_CHARGED)) {
throw new Exception(
pht(
- 'Cart has wrong status ("%s") to call willReviewCart()!',
- $copy->getStatus()));
+ 'Cart has wrong status ("%s") to call %s!',
+ $copy->getStatus(),
+ 'willReviewCart()'));
}
$this->setStatus(self::STATUS_REVIEW)->save();
@@ -244,8 +247,9 @@ public function didReviewCart() {
($copy->getStatus() !== self::STATUS_REVIEW)) {
throw new Exception(
pht(
- 'Cart has wrong status ("%s") to call didReviewCart()!',
- $copy->getStatus()));
+ 'Cart has wrong status ("%s") to call %s!',
+ $copy->getStatus(),
+ 'didReviewCart()'));
}
foreach ($this->purchases as $purchase) {
@@ -275,8 +279,9 @@ public function didFailCharge(PhortuneCharge $charge) {
($copy->getStatus() !== self::STATUS_HOLD)) {
throw new Exception(
pht(
- 'Cart has wrong status ("%s") to call didFailCharge().',
- $copy->getStatus()));
+ 'Cart has wrong status ("%s") to call %s.',
+ $copy->getStatus(),
+ 'didFailCharge()'));
}
$charge->save();
@@ -300,7 +305,7 @@ public function willRefundCharge(
if (!$amount->isPositive()) {
throw new Exception(
- pht('Trying to refund nonpositive amount of money!'));
+ pht('Trying to refund non-positive amount of money!'));
}
if ($amount->isGreaterThan($charge->getAmountRefundableAsCurrency())) {
diff --git a/src/applications/phortune/view/PhortuneCreditCardForm.php b/src/applications/phortune/view/PhortuneCreditCardForm.php
index 58bf4cda0c..956e14499c 100644
--- a/src/applications/phortune/view/PhortuneCreditCardForm.php
+++ b/src/applications/phortune/view/PhortuneCreditCardForm.php
@@ -81,20 +81,20 @@ public function buildForm() {
->setID($form_id)
->appendChild(
id(new AphrontFormTextControl())
- ->setLabel('Card Number')
+ ->setLabel(pht('Card Number'))
->setDisableAutocomplete(true)
->setSigil('number-input')
->setError($e_number))
->appendChild(
id(new AphrontFormTextControl())
- ->setLabel('CVC')
+ ->setLabel(pht('CVC'))
->setDisableAutocomplete(true)
->addClass('aphront-form-cvc-input')
->setSigil('cvc-input')
->setError($e_cvc))
->appendChild(
id(new PhortuneMonthYearExpiryControl())
- ->setLabel('Expiration')
+ ->setLabel(pht('Expiration'))
->setUser($this->user)
->setError($e_expiry));
diff --git a/src/applications/phortune/worker/PhortuneSubscriptionWorker.php b/src/applications/phortune/worker/PhortuneSubscriptionWorker.php
index 747b4b3889..96f1948528 100644
--- a/src/applications/phortune/worker/PhortuneSubscriptionWorker.php
+++ b/src/applications/phortune/worker/PhortuneSubscriptionWorker.php
@@ -198,8 +198,7 @@ private function getBillingPeriodRange(PhortuneSubscription $subscription) {
if (!$last_epoch || !$this_epoch) {
throw new PhabricatorWorkerPermanentFailureException(
- pht(
- 'Subscription is missing billing period information.'));
+ pht('Subscription is missing billing period information.'));
}
$period_length = ($this_epoch - $last_epoch);
diff --git a/src/applications/phpast/application/PhabricatorPHPASTApplication.php b/src/applications/phpast/application/PhabricatorPHPASTApplication.php
index 8a9efa5a99..3118ed68c9 100644
--- a/src/applications/phpast/application/PhabricatorPHPASTApplication.php
+++ b/src/applications/phpast/application/PhabricatorPHPASTApplication.php
@@ -15,7 +15,7 @@ public function getFontIcon() {
}
public function getShortDescription() {
- return 'Visual PHP Parser';
+ return pht('Visual PHP Parser');
}
public function getTitleGlyph() {
diff --git a/src/applications/phpast/controller/PhabricatorXHPASTViewFrameController.php b/src/applications/phpast/controller/PhabricatorXHPASTViewFrameController.php
index 65ec7731f1..8d6e690205 100644
--- a/src/applications/phpast/controller/PhabricatorXHPASTViewFrameController.php
+++ b/src/applications/phpast/controller/PhabricatorXHPASTViewFrameController.php
@@ -22,7 +22,7 @@ public function processRequest() {
'',
)),
array(
- 'title' => 'XHPAST View',
+ 'title' => pht('XHPAST View'),
));
}
}
diff --git a/src/applications/phpast/controller/PhabricatorXHPASTViewPanelController.php b/src/applications/phpast/controller/PhabricatorXHPASTViewPanelController.php
index 53a93b1382..ab68948af3 100644
--- a/src/applications/phpast/controller/PhabricatorXHPASTViewPanelController.php
+++ b/src/applications/phpast/controller/PhabricatorXHPASTViewPanelController.php
@@ -11,7 +11,7 @@ public function willProcessRequest(array $data) {
$this->storageTree = id(new PhabricatorXHPASTViewParseTree())
->load($this->id);
if (!$this->storageTree) {
- throw new Exception('No such AST!');
+ throw new Exception(pht('No such AST!'));
}
}
diff --git a/src/applications/phpast/controller/PhabricatorXHPASTViewRunController.php b/src/applications/phpast/controller/PhabricatorXHPASTViewRunController.php
index 3e6e2b3fb1..b235f5b842 100644
--- a/src/applications/phpast/controller/PhabricatorXHPASTViewRunController.php
+++ b/src/applications/phpast/controller/PhabricatorXHPASTViewRunController.php
@@ -35,7 +35,7 @@ public function processRequest() {
->setUser($user)
->appendChild(
id(new AphrontFormTextAreaControl())
- ->setLabel('Source')
+ ->setLabel(pht('Source'))
->setName('source')
->setValue("setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_TALL))
diff --git a/src/applications/phpast/controller/PhabricatorXHPASTViewStreamController.php b/src/applications/phpast/controller/PhabricatorXHPASTViewStreamController.php
index 4931ab29e3..4a098f1591 100644
--- a/src/applications/phpast/controller/PhabricatorXHPASTViewStreamController.php
+++ b/src/applications/phpast/controller/PhabricatorXHPASTViewStreamController.php
@@ -16,7 +16,7 @@ public function processRequest() {
foreach ($tree->getRawTokenStream() as $id => $token) {
$seq = $id;
$name = $token->getTypeName();
- $title = "Token {$seq}: {$name}";
+ $title = pht('Token %s: %s', $seq, $name);
$tokens[] = phutil_tag(
'span',
diff --git a/src/applications/phragment/conduit/PhragmentGetPatchConduitAPIMethod.php b/src/applications/phragment/conduit/PhragmentGetPatchConduitAPIMethod.php
index dedf00e1eb..aa9e008007 100644
--- a/src/applications/phragment/conduit/PhragmentGetPatchConduitAPIMethod.php
+++ b/src/applications/phragment/conduit/PhragmentGetPatchConduitAPIMethod.php
@@ -28,7 +28,7 @@ protected function defineReturnType() {
protected function defineErrorTypes() {
return array(
- 'ERR_BAD_FRAGMENT' => 'No such fragment exists',
+ 'ERR_BAD_FRAGMENT' => pht('No such fragment exists.'),
);
}
diff --git a/src/applications/phragment/conduit/PhragmentQueryFragmentsConduitAPIMethod.php b/src/applications/phragment/conduit/PhragmentQueryFragmentsConduitAPIMethod.php
index 27ddac1d36..08a1bcba49 100644
--- a/src/applications/phragment/conduit/PhragmentQueryFragmentsConduitAPIMethod.php
+++ b/src/applications/phragment/conduit/PhragmentQueryFragmentsConduitAPIMethod.php
@@ -27,7 +27,7 @@ protected function defineReturnType() {
protected function defineErrorTypes() {
return array(
- 'ERR_BAD_FRAGMENT' => 'No such fragment exists',
+ 'ERR_BAD_FRAGMENT' => pht('No such fragment exists.'),
);
}
diff --git a/src/applications/phragment/controller/PhragmentController.php b/src/applications/phragment/controller/PhragmentController.php
index 096ee21a1f..a96c25878e 100644
--- a/src/applications/phragment/controller/PhragmentController.php
+++ b/src/applications/phragment/controller/PhragmentController.php
@@ -201,12 +201,16 @@ public function renderConfigurationWarningIfRequired() {
return id(new PHUIInfoView())
->setTitle(pht('security.alternate-file-domain must be configured!'))
->setSeverity(PHUIInfoView::SEVERITY_ERROR)
- ->appendChild(phutil_tag('p', array(), pht(
- 'Because Phragment generates files (such as ZIP archives and '.
- 'patches) as they are requested, it requires that you configure '.
- 'the `security.alternate-file-domain` option. This option on it\'s '.
- 'own will also provide additional security when serving files '.
- 'across Phabricator.')));
+ ->appendChild(
+ phutil_tag(
+ 'p',
+ array(),
+ pht(
+ "Because Phragment generates files (such as ZIP archives and ".
+ "patches) as they are requested, it requires that you configure ".
+ "the `%s` option. This option on it's own will also provide ".
+ "additional security when serving files across Phabricator.",
+ 'security.alternate-file-domain')));
}
return null;
}
diff --git a/src/applications/phragment/controller/PhragmentCreateController.php b/src/applications/phragment/controller/PhragmentCreateController.php
index d899754a1c..2a5b54538c 100644
--- a/src/applications/phragment/controller/PhragmentCreateController.php
+++ b/src/applications/phragment/controller/PhragmentCreateController.php
@@ -40,7 +40,7 @@ public function processRequest() {
$v_editpolicy = $request->getStr('editPolicy');
if (strpos($v_name, '/') !== false) {
- $errors[] = pht('The fragment name can not contain \'/\'.');
+ $errors[] = pht("The fragment name can not contain '/'.");
}
$file = id(new PhabricatorFileQuery())
@@ -48,7 +48,7 @@ public function processRequest() {
->withIDs(array($v_fileid))
->executeOne();
if (!$file) {
- $errors[] = pht('The specified file doesn\'t exist.');
+ $errors[] = pht("The specified file doesn't exist.");
}
if (!count($errors)) {
@@ -117,7 +117,7 @@ public function processRequest() {
$crumbs->addTextCrumb(pht('Create Fragment'));
$box = id(new PHUIObjectBoxView())
- ->setHeaderText('Create Fragment')
+ ->setHeaderText(pht('Create Fragment'))
->setForm($form);
if ($error_view) {
diff --git a/src/applications/phragment/controller/PhragmentHistoryController.php b/src/applications/phragment/controller/PhragmentHistoryController.php
index 3df7095c9d..cb84fd819f 100644
--- a/src/applications/phragment/controller/PhragmentHistoryController.php
+++ b/src/applications/phragment/controller/PhragmentHistoryController.php
@@ -59,7 +59,7 @@ public function processRequest() {
$first = true;
foreach ($versions as $version) {
$item = id(new PHUIObjectItemView());
- $item->setHeader('Version '.$version->getSequence());
+ $item->setHeader(pht('Version %s', $version->getSequence()));
$item->setHref($version->getURI());
$item->addAttribute(phabricator_datetime(
$version->getDateCreated(),
diff --git a/src/applications/phragment/controller/PhragmentRevertController.php b/src/applications/phragment/controller/PhragmentRevertController.php
index 84e8cbb71e..92da1f27a3 100644
--- a/src/applications/phragment/controller/PhragmentRevertController.php
+++ b/src/applications/phragment/controller/PhragmentRevertController.php
@@ -47,7 +47,7 @@ public function processRequest() {
->executeOne();
if ($file === null) {
throw new Exception(
- 'The file associated with this version was not found.');
+ pht('The file associated with this version was not found.'));
}
}
diff --git a/src/applications/phragment/controller/PhragmentVersionController.php b/src/applications/phragment/controller/PhragmentVersionController.php
index 9267fdc5b1..e2906a7454 100644
--- a/src/applications/phragment/controller/PhragmentVersionController.php
+++ b/src/applications/phragment/controller/PhragmentVersionController.php
@@ -101,7 +101,7 @@ private function renderPreviousVersionList(
foreach ($previous_versions as $previous_version) {
$item = id(new PHUIObjectItemView());
- $item->setHeader('Version '.$previous_version->getSequence());
+ $item->setHeader(pht('Version %s', $previous_version->getSequence()));
$item->setHref($previous_version->getURI());
$item->addAttribute(phabricator_datetime(
$previous_version->getDateCreated(),
@@ -117,8 +117,8 @@ private function renderPreviousVersionList(
}
$item = id(new PHUIObjectItemView());
- $item->setHeader('Prior to Version 0');
- $item->addAttribute('Prior to any content (empty file)');
+ $item->setHeader(pht('Prior to Version 0'));
+ $item->addAttribute(pht('Prior to any content (empty file)'));
$item->addAction(id(new PHUIListItemView())
->setIcon('fa-file-o')
->setName(pht('Get Patch'))
diff --git a/src/applications/phragment/storage/PhragmentFragment.php b/src/applications/phragment/storage/PhragmentFragment.php
index d58be033c0..1ab156e60f 100644
--- a/src/applications/phragment/storage/PhragmentFragment.php
+++ b/src/applications/phragment/storage/PhragmentFragment.php
@@ -142,7 +142,8 @@ public function updateFromZIP(
PhabricatorFile $file) {
if ($file->getMimeType() !== 'application/zip') {
- throw new Exception("File must have mimetype 'application/zip'");
+ throw new Exception(
+ pht("File must have mimetype '%s'.", 'application/zip'));
}
// First apply the ZIP as normal.
@@ -160,7 +161,7 @@ public function updateFromZIP(
$temp = new TempFile();
Filesystem::writeFile($temp, $file->loadFileData());
if (!$zip->open($temp)) {
- throw new Exception('Unable to open ZIP');
+ throw new Exception(pht('Unable to open ZIP.'));
}
// Get all of the paths and their data from the ZIP.
diff --git a/src/applications/phrequent/conduit/PhrequentTrackingConduitAPIMethod.php b/src/applications/phrequent/conduit/PhrequentTrackingConduitAPIMethod.php
index f5391a56fb..4f73019544 100644
--- a/src/applications/phrequent/conduit/PhrequentTrackingConduitAPIMethod.php
+++ b/src/applications/phrequent/conduit/PhrequentTrackingConduitAPIMethod.php
@@ -8,8 +8,7 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return pht(
- 'Returns current objects being tracked in Phrequent.');
+ return pht('Returns current objects being tracked in Phrequent.');
}
public function getMethodStatus() {
diff --git a/src/applications/phrequent/controller/PhrequentTrackController.php b/src/applications/phrequent/controller/PhrequentTrackController.php
index fd52bcea16..de0b75324c 100644
--- a/src/applications/phrequent/controller/PhrequentTrackController.php
+++ b/src/applications/phrequent/controller/PhrequentTrackController.php
@@ -49,8 +49,7 @@ public function processRequest() {
return $this->newDialog()
->setTitle(pht('Not Tracking Time'))
->appendParagraph(
- pht(
- 'You are not currently tracking time on this object.'))
+ pht('You are not currently tracking time on this object.'))
->addCancelButton($done_uri);
}
break;
@@ -93,8 +92,7 @@ public function processRequest() {
if ($this->isStoppingTracking()) {
$min_time = $current_timer->getDateStarted();
if ($min_time > $timestamp->getEpoch()) {
- $errors[] = pht(
- 'Stop time must be after start time.');
+ $errors[] = pht('Stop time must be after start time.');
$e_date = pht('Invalid');
}
}
diff --git a/src/applications/phrequent/query/PhrequentUserTimeQuery.php b/src/applications/phrequent/query/PhrequentUserTimeQuery.php
index 61fa978165..d0d1160df0 100644
--- a/src/applications/phrequent/query/PhrequentUserTimeQuery.php
+++ b/src/applications/phrequent/query/PhrequentUserTimeQuery.php
@@ -111,7 +111,7 @@ protected function buildWhereClause(AphrontDatabaseConnection $conn) {
'dateEnded IS NULL');
break;
default:
- throw new Exception("Unknown ended '{$this->ended}'!");
+ throw new Exception(pht("Unknown ended '%s'!", $this->ended));
}
$where[] = $this->buildPagingClause($conn);
diff --git a/src/applications/phriction/conduit/PhrictionHistoryConduitAPIMethod.php b/src/applications/phriction/conduit/PhrictionHistoryConduitAPIMethod.php
index 9a4098b5bd..454af2934a 100644
--- a/src/applications/phriction/conduit/PhrictionHistoryConduitAPIMethod.php
+++ b/src/applications/phriction/conduit/PhrictionHistoryConduitAPIMethod.php
@@ -22,7 +22,7 @@ protected function defineReturnType() {
protected function defineErrorTypes() {
return array(
- 'ERR-BAD-DOCUMENT' => 'No such document exists.',
+ 'ERR-BAD-DOCUMENT' => pht('No such document exists.'),
);
}
diff --git a/src/applications/phriction/conduit/PhrictionInfoConduitAPIMethod.php b/src/applications/phriction/conduit/PhrictionInfoConduitAPIMethod.php
index 14e424e83c..60d9ece734 100644
--- a/src/applications/phriction/conduit/PhrictionInfoConduitAPIMethod.php
+++ b/src/applications/phriction/conduit/PhrictionInfoConduitAPIMethod.php
@@ -22,7 +22,7 @@ protected function defineReturnType() {
protected function defineErrorTypes() {
return array(
- 'ERR-BAD-DOCUMENT' => 'No such document exists.',
+ 'ERR-BAD-DOCUMENT' => pht('No such document exists.'),
);
}
diff --git a/src/applications/phriction/constants/PhrictionActionConstants.php b/src/applications/phriction/constants/PhrictionActionConstants.php
index 842962ca99..f39691181e 100644
--- a/src/applications/phriction/constants/PhrictionActionConstants.php
+++ b/src/applications/phriction/constants/PhrictionActionConstants.php
@@ -9,15 +9,15 @@ final class PhrictionActionConstants extends PhrictionConstants {
const ACTION_MOVE_HERE = 'move here';
public static function getActionPastTenseVerb($action) {
- static $map = array(
- self::ACTION_CREATE => 'created',
- self::ACTION_EDIT => 'edited',
- self::ACTION_DELETE => 'deleted',
- self::ACTION_MOVE_AWAY => 'moved',
- self::ACTION_MOVE_HERE => 'moved',
+ $map = array(
+ self::ACTION_CREATE => pht('created'),
+ self::ACTION_EDIT => pht('edited'),
+ self::ACTION_DELETE => pht('deleted'),
+ self::ACTION_MOVE_AWAY => pht('moved'),
+ self::ACTION_MOVE_HERE => pht('moved'),
);
- return idx($map, $action, "brazenly {$action}'d");
+ return idx($map, $action, pht("brazenly %s'd", $action));
}
}
diff --git a/src/applications/phriction/constants/PhrictionChangeType.php b/src/applications/phriction/constants/PhrictionChangeType.php
index 127c3e049f..1adf9ea6a4 100644
--- a/src/applications/phriction/constants/PhrictionChangeType.php
+++ b/src/applications/phriction/constants/PhrictionChangeType.php
@@ -9,15 +9,15 @@ final class PhrictionChangeType extends PhrictionConstants {
const CHANGE_STUB = 4;
public static function getChangeTypeLabel($const) {
- static $map = array(
- self::CHANGE_EDIT => 'Edit',
- self::CHANGE_DELETE => 'Delete',
- self::CHANGE_MOVE_HERE => 'Move Here',
- self::CHANGE_MOVE_AWAY => 'Move Away',
- self::CHANGE_STUB => 'Created through child',
+ $map = array(
+ self::CHANGE_EDIT => pht('Edit'),
+ self::CHANGE_DELETE => pht('Delete'),
+ self::CHANGE_MOVE_HERE => pht('Move Here'),
+ self::CHANGE_MOVE_AWAY => pht('Move Away'),
+ self::CHANGE_STUB => pht('Created through child'),
);
- return idx($map, $const, '???');
+ return idx($map, $const, pht('Unknown'));
}
}
diff --git a/src/applications/phriction/controller/PhrictionDocumentController.php b/src/applications/phriction/controller/PhrictionDocumentController.php
index 1031a2a059..c96cbc57f8 100644
--- a/src/applications/phriction/controller/PhrictionDocumentController.php
+++ b/src/applications/phriction/controller/PhrictionDocumentController.php
@@ -146,7 +146,7 @@ public function processRequest() {
$core_content = $notice->render();
} else {
- throw new Exception("Unknown document status '{$doc_status}'!");
+ throw new Exception(pht("Unknown document status '%s'!", $doc_status));
}
$move_notice = null;
diff --git a/src/applications/phriction/controller/PhrictionEditController.php b/src/applications/phriction/controller/PhrictionEditController.php
index d09afb9746..7ee98120b1 100644
--- a/src/applications/phriction/controller/PhrictionEditController.php
+++ b/src/applications/phriction/controller/PhrictionEditController.php
@@ -96,10 +96,13 @@ public function processRequest() {
$draft_note = new PHUIInfoView();
$draft_note->setSeverity(PHUIInfoView::SEVERITY_NOTICE);
- $draft_note->setTitle('Recovered Draft');
- $draft_note->appendChild(hsprintf(
- '
',
+ pht(
+ 'Showing a saved draft of your edits, you can %s.',
+ $discard)));
} else {
$content_text = $content->getContent();
$draft_note = null;
diff --git a/src/applications/phriction/controller/PhrictionHistoryController.php b/src/applications/phriction/controller/PhrictionHistoryController.php
index e9daa2be41..ef30382b76 100644
--- a/src/applications/phriction/controller/PhrictionHistoryController.php
+++ b/src/applications/phriction/controller/PhrictionHistoryController.php
@@ -87,7 +87,7 @@ public function processRequest() {
$color = 'green';
break;
default:
- throw new Exception('Unknown change type!');
+ throw new Exception(pht('Unknown change type!'));
break;
}
diff --git a/src/applications/phriction/mail/PhrictionReplyHandler.php b/src/applications/phriction/mail/PhrictionReplyHandler.php
index 0cb9e8f79c..7929349e6d 100644
--- a/src/applications/phriction/mail/PhrictionReplyHandler.php
+++ b/src/applications/phriction/mail/PhrictionReplyHandler.php
@@ -5,7 +5,8 @@ final class PhrictionReplyHandler
public function validateMailReceiver($mail_receiver) {
if (!($mail_receiver instanceof PhrictionDocument)) {
- throw new Exception('Mail receiver is not a PhrictionDocument!');
+ throw new Exception(
+ pht('Mail receiver is not a %s!', 'PhrictionDocument'));
}
}
diff --git a/src/applications/phriction/query/PhrictionDocumentQuery.php b/src/applications/phriction/query/PhrictionDocumentQuery.php
index b4e80af936..63d1764a9a 100644
--- a/src/applications/phriction/query/PhrictionDocumentQuery.php
+++ b/src/applications/phriction/query/PhrictionDocumentQuery.php
@@ -271,7 +271,7 @@ protected function buildWhereClause(AphrontDatabaseConnection $conn) {
case self::STATUS_ANY:
break;
default:
- throw new Exception("Unknown status '{$this->status}'!");
+ throw new Exception(pht("Unknown status '%s'!", $this->status));
}
$where[] = $this->buildPagingClause($conn);
diff --git a/src/applications/phriction/storage/PhrictionDocument.php b/src/applications/phriction/storage/PhrictionDocument.php
index 34b3bf6eca..f274d87ad4 100644
--- a/src/applications/phriction/storage/PhrictionDocument.php
+++ b/src/applications/phriction/storage/PhrictionDocument.php
@@ -101,7 +101,7 @@ public static function getSlugURI($slug, $type = 'document') {
);
if (empty($types[$type])) {
- throw new Exception("Unknown URI type '{$type}'!");
+ throw new Exception(pht("Unknown URI type '%s'!", $type));
}
$prefix = $types[$type];
diff --git a/src/applications/policy/__tests__/PhabricatorPolicyTestCase.php b/src/applications/policy/__tests__/PhabricatorPolicyTestCase.php
index dca7711566..327c8a2856 100644
--- a/src/applications/policy/__tests__/PhabricatorPolicyTestCase.php
+++ b/src/applications/policy/__tests__/PhabricatorPolicyTestCase.php
@@ -16,7 +16,7 @@ public function testPublicPolicyEnabled() {
'user' => true,
'admin' => true,
),
- 'Public Policy (Enabled in Config)');
+ pht('Public Policy (Enabled in Config)'));
}
@@ -35,7 +35,7 @@ public function testPublicPolicyDisabled() {
'user' => true,
'admin' => true,
),
- 'Public Policy (Disabled in Config)');
+ pht('Public Policy (Disabled in Config)'));
}
@@ -51,7 +51,7 @@ public function testUsersPolicy() {
'user' => true,
'admin' => true,
),
- 'User Policy');
+ pht('User Policy'));
}
@@ -66,7 +66,7 @@ public function testAdminPolicy() {
'user' => false,
'admin' => true,
),
- 'Admin Policy');
+ pht('Admin Policy'));
}
@@ -81,7 +81,7 @@ public function testNoOnePolicy() {
'user' => false,
'admin' => false,
),
- 'No One Policy');
+ pht('No One Policy'));
}
@@ -105,22 +105,22 @@ public function testOffsets() {
$this->assertEqual(
3,
count($query->setLimit(3)->setOffset(0)->execute()),
- 'Invisible objects are ignored.');
+ pht('Invisible objects are ignored.'));
$this->assertEqual(
0,
count($query->setLimit(3)->setOffset(3)->execute()),
- 'Offset pages through visible objects only.');
+ pht('Offset pages through visible objects only.'));
$this->assertEqual(
2,
count($query->setLimit(3)->setOffset(1)->execute()),
- 'Offsets work correctly.');
+ pht('Offsets work correctly.'));
$this->assertEqual(
2,
count($query->setLimit(0)->setOffset(1)->execute()),
- 'Offset with no limit works.');
+ pht('Offset with no limit works.'));
}
@@ -144,12 +144,12 @@ public function testLimits() {
$this->assertEqual(
3,
count($query->setLimit(3)->setOffset(0)->execute()),
- 'Limits work.');
+ pht('Limits work.'));
$this->assertEqual(
2,
count($query->setLimit(3)->setOffset(4)->execute()),
- 'Limit + offset work.');
+ pht('Limit + offset work.'));
}
@@ -185,7 +185,7 @@ public function testRejectInvalidPolicy() {
'user' => false,
'admin' => false,
),
- 'Invalid Policy');
+ pht('Invalid Policy'));
}
@@ -222,7 +222,10 @@ public function testAllQueriesBelongToActualApplications() {
}
$this->assertTrue(
(bool)PhabricatorApplication::getByClass($class),
- "Application class '{$class}' for query '{$qclass}'");
+ pht(
+ "Application class '%s' for query '%s'.",
+ $class,
+ $qclass));
}
}
@@ -281,11 +284,11 @@ private function expectVisibility(
$this->assertEqual(
$object,
$result,
- "{$description} with user {$spec} should succeed.");
+ pht('%s with user %s should succeed.', $description, $spec));
} else {
$this->assertTrue(
$caught instanceof PhabricatorPolicyException,
- "{$description} with user {$spec} should fail.");
+ pht('%s with user %s should fail.', $description, $spec));
}
}
}
@@ -326,7 +329,7 @@ private function buildUser($spec) {
$user->setIsAdmin(true);
break;
default:
- throw new Exception("Unknown user spec '{$spec}'.");
+ throw new Exception(pht("Unknown user spec '%s'.", $spec));
}
return $user;
diff --git a/src/applications/policy/capability/PhabricatorPolicyCapability.php b/src/applications/policy/capability/PhabricatorPolicyCapability.php
index 346a6fb4e1..a9af1fa00c 100644
--- a/src/applications/policy/capability/PhabricatorPolicyCapability.php
+++ b/src/applications/policy/capability/PhabricatorPolicyCapability.php
@@ -21,16 +21,20 @@ final public function getCapabilityKey() {
if ($const === false) {
throw new Exception(
pht(
- 'PolicyCapability class "%s" must define an CAPABILITY property.',
- get_class($this)));
+ '%s class "%s" must define a %s property.',
+ __CLASS__,
+ get_class($this),
+ 'CAPABILITY'));
}
if (!is_string($const)) {
throw new Exception(
pht(
- 'PolicyCapability class "%s" has an invalid CAPABILITY '.
- 'property. Capability constants must be a string.',
- get_class($this)));
+ '%s class "%s" has an invalid %s property. '.
+ 'Capability constants must be a string.',
+ __CLASS__,
+ get_class($this),
+ 'CAPABILITY'));
}
return $const;
diff --git a/src/applications/policy/config/PhabricatorPolicyConfigOptions.php b/src/applications/policy/config/PhabricatorPolicyConfigOptions.php
index 2b47ae8d80..1c3698c4cd 100644
--- a/src/applications/policy/config/PhabricatorPolicyConfigOptions.php
+++ b/src/applications/policy/config/PhabricatorPolicyConfigOptions.php
@@ -63,8 +63,9 @@ public function getOptions() {
'users can take certain actions, such as creating new users. '."\n\n".
'This setting allows for "locking" these policies such that no '.
'further edits can be made on a per-policy basis.'))
- ->addExample($policy_locked_example,
- pht('Lock Create User Policy To Admins')),
+ ->addExample(
+ $policy_locked_example,
+ pht('Lock Create User Policy To Admins')),
);
}
diff --git a/src/applications/policy/config/PolicyLockOptionType.php b/src/applications/policy/config/PolicyLockOptionType.php
index 3198a927c2..e9a51d706c 100644
--- a/src/applications/policy/config/PolicyLockOptionType.php
+++ b/src/applications/policy/config/PolicyLockOptionType.php
@@ -13,8 +13,10 @@ public function validateOption(PhabricatorConfigOption $option, $value) {
foreach ($value as $capability_key => $policy) {
$capability = idx($capabilities, $capability_key);
if (!$capability) {
- throw new Exception(pht(
- 'Capability "%s" does not exist.', $capability_key));
+ throw new Exception(
+ pht(
+ 'Capability "%s" does not exist.',
+ $capability_key));
}
if (phid_get_type($policy) !=
PhabricatorPHIDConstants::PHID_TYPE_UNKNOWN) {
@@ -25,18 +27,20 @@ public function validateOption(PhabricatorConfigOption $option, $value) {
// this exception is not helpful here as its about global policy;
// throw a better exception
} catch (Exception $ex) {
- throw new Exception(pht(
- 'Capability "%s" has invalid policy "%s".',
- $capability_key,
- $policy));
+ throw new Exception(
+ pht(
+ 'Capability "%s" has invalid policy "%s".',
+ $capability_key,
+ $policy));
}
}
if ($policy == PhabricatorPolicies::POLICY_PUBLIC) {
if (!$capability->shouldAllowPublicPolicySetting()) {
- throw new Exception(pht(
- 'Capability "%s" does not support public policy.',
- $capability_key));
+ throw new Exception(
+ pht(
+ 'Capability "%s" does not support public policy.',
+ $capability_key));
}
}
}
@@ -50,11 +54,12 @@ public function validateOption(PhabricatorConfigOption $option, $value) {
foreach ($value as $capability_key => $policy) {
$handle = $handles[$policy];
if (!$handle->isComplete()) {
- throw new Exception(pht(
- 'Capability "%s" has invalid policy "%s"; "%s" does not exist.',
- $capability_key,
- $policy,
- $policy));
+ throw new Exception(
+ pht(
+ 'Capability "%s" has invalid policy "%s"; "%s" does not exist.',
+ $capability_key,
+ $policy,
+ $policy));
}
}
}
diff --git a/src/applications/policy/controller/PhabricatorPolicyEditController.php b/src/applications/policy/controller/PhabricatorPolicyEditController.php
index 4c044a6dc7..80b04e4ea7 100644
--- a/src/applications/policy/controller/PhabricatorPolicyEditController.php
+++ b/src/applications/policy/controller/PhabricatorPolicyEditController.php
@@ -63,12 +63,12 @@ public function handleRequest(AphrontRequest $request) {
case 'deny':
break;
default:
- throw new Exception("Invalid action '{$action}'!");
+ throw new Exception(pht("Invalid action '%s'!", $action));
}
$rule_class = idx($rule, 'rule');
if (empty($rules[$rule_class])) {
- throw new Exception("Invalid rule class '{$rule_class}'!");
+ throw new Exception(pht("Invalid rule class '%s'!", $rule_class));
}
$rule_obj = $rules[$rule_class];
@@ -163,8 +163,7 @@ public function handleRequest(AphrontRequest $request) {
'mustcapture' => true,
),
pht('New Rule')))
- ->setDescription(
- pht('These rules are processed in order.'))
+ ->setDescription(pht('These rules are processed in order.'))
->setContent(javelin_tag(
'table',
array(
diff --git a/src/applications/policy/filter/PhabricatorPolicyFilter.php b/src/applications/policy/filter/PhabricatorPolicyFilter.php
index 7373991fd8..8d52ddc044 100644
--- a/src/applications/policy/filter/PhabricatorPolicyFilter.php
+++ b/src/applications/policy/filter/PhabricatorPolicyFilter.php
@@ -17,8 +17,10 @@ public static function mustRetainCapability(
if (!self::hasCapability($user, $object, $capability)) {
throw new Exception(
- "You can not make that edit, because it would remove your ability ".
- "to '{$capability}' the object.");
+ pht(
+ "You can not make that edit, because it would remove your ability ".
+ "to '%s' the object.",
+ $capability));
}
}
@@ -110,8 +112,7 @@ public function apply(array $objects) {
$capabilities = $this->capabilities;
if (!$viewer || !$capabilities) {
- throw new Exception(
- 'Call setViewer() and requireCapabilities() before apply()!');
+ throw new PhutilInvalidStateException('setViewer', 'requireCapabilities');
}
// If the viewer is omnipotent, short circuit all the checks and just
@@ -135,8 +136,10 @@ public function apply(array $objects) {
foreach ($capabilities as $capability) {
if (!in_array($capability, $object_capabilities)) {
throw new Exception(
- "Testing for capability '{$capability}' on an object which does ".
- "not have that capability!");
+ pht(
+ "Testing for capability '%s' on an object which does ".
+ "not have that capability!",
+ $capability));
}
$policy = $this->getObjectPolicy($object, $capability);
diff --git a/src/applications/policy/management/PhabricatorPolicyManagementShowWorkflow.php b/src/applications/policy/management/PhabricatorPolicyManagementShowWorkflow.php
index e6d2741bfa..1529d4904c 100644
--- a/src/applications/policy/management/PhabricatorPolicyManagementShowWorkflow.php
+++ b/src/applications/policy/management/PhabricatorPolicyManagementShowWorkflow.php
@@ -6,9 +6,8 @@ final class PhabricatorPolicyManagementShowWorkflow
protected function didConstruct() {
$this
->setName('show')
- ->setSynopsis('Show policy information about an object.')
- ->setExamples(
- '**show** D123')
+ ->setSynopsis(pht('Show policy information about an object.'))
+ ->setExamples('**show** D123')
->setArguments(
array(
array(
@@ -25,8 +24,7 @@ public function execute(PhutilArgumentParser $args) {
$obj_names = $args->getArg('objects');
if (!$obj_names) {
throw new PhutilArgumentUsageException(
- pht(
- 'Specify the name of an object to show policy information for.'));
+ pht('Specify the name of an object to show policy information for.'));
} else if (count($obj_names) > 1) {
throw new PhutilArgumentUsageException(
pht(
diff --git a/src/applications/policy/management/PhabricatorPolicyManagementUnlockWorkflow.php b/src/applications/policy/management/PhabricatorPolicyManagementUnlockWorkflow.php
index 22e4984528..33f7e209c2 100644
--- a/src/applications/policy/management/PhabricatorPolicyManagementUnlockWorkflow.php
+++ b/src/applications/policy/management/PhabricatorPolicyManagementUnlockWorkflow.php
@@ -7,10 +7,10 @@ protected function didConstruct() {
$this
->setName('unlock')
->setSynopsis(
- 'Unlock an object by setting its policies to allow anyone to view '.
- 'and edit it.')
- ->setExamples(
- '**unlock** D123')
+ pht(
+ 'Unlock an object by setting its policies to allow anyone to view '.
+ 'and edit it.'))
+ ->setExamples('**unlock** D123')
->setArguments(
array(
array(
@@ -27,12 +27,10 @@ public function execute(PhutilArgumentParser $args) {
$obj_names = $args->getArg('objects');
if (!$obj_names) {
throw new PhutilArgumentUsageException(
- pht(
- 'Specify the name of an object to unlock.'));
+ pht('Specify the name of an object to unlock.'));
} else if (count($obj_names) > 1) {
throw new PhutilArgumentUsageException(
- pht(
- 'Specify the name of exactly one object to unlock.'));
+ pht('Specify the name of exactly one object to unlock.'));
}
$object = id(new PhabricatorObjectQuery())
@@ -43,9 +41,7 @@ public function execute(PhutilArgumentParser $args) {
if (!$object) {
$name = head($obj_names);
throw new PhutilArgumentUsageException(
- pht(
- "No such object '%s'!",
- $name));
+ pht("No such object '%s'!", $name));
}
$handle = id(new PhabricatorHandleQuery())
diff --git a/src/applications/policy/query/PhabricatorPolicyQuery.php b/src/applications/policy/query/PhabricatorPolicyQuery.php
index 01e2e2beab..6a5c2219df 100644
--- a/src/applications/policy/query/PhabricatorPolicyQuery.php
+++ b/src/applications/policy/query/PhabricatorPolicyQuery.php
@@ -56,8 +56,10 @@ public static function renderPolicyDescriptions(
protected function loadPage() {
if ($this->object && $this->phids) {
throw new Exception(
- 'You can not issue a policy query with both setObject() and '.
- 'setPHIDs().');
+ pht(
+ 'You can not issue a policy query with both %s and %s.',
+ 'setObject()',
+ 'setPHIDs()'));
} else if ($this->object) {
$phids = $this->loadObjectPolicyPHIDs();
} else {
@@ -128,7 +130,7 @@ public static function isGlobalPolicy($policy) {
public static function getGlobalPolicy($policy) {
if (!self::isGlobalPolicy($policy)) {
- throw new Exception("Policy '{$policy}' is not a global policy!");
+ throw new Exception(pht("Policy '%s' is not a global policy!", $policy));
}
return idx(self::getGlobalPolicies(), $policy);
}
diff --git a/src/applications/policy/storage/PhabricatorPolicy.php b/src/applications/policy/storage/PhabricatorPolicy.php
index 7c8186124e..c83d09ab5d 100644
--- a/src/applications/policy/storage/PhabricatorPolicy.php
+++ b/src/applications/policy/storage/PhabricatorPolicy.php
@@ -56,17 +56,21 @@ public static function newFromPolicyAndHandle(
if (!$handle) {
throw new Exception(
- "Policy identifier is an object PHID ('{$policy_identifier}'), but no ".
- "object handle was provided. A handle must be provided for object ".
- "policies.");
+ pht(
+ "Policy identifier is an object PHID ('%s'), but no object handle ".
+ "was provided. A handle must be provided for object policies.",
+ $policy_identifier));
}
$handle_phid = $handle->getPHID();
if ($policy_identifier != $handle_phid) {
throw new Exception(
- "Policy identifier is an object PHID ('{$policy_identifier}'), but ".
- "the provided handle has a different PHID ('{$handle_phid}'). The ".
- "handle must correspond to the policy identifier.");
+ pht(
+ "Policy identifier is an object PHID ('%s'), but the provided ".
+ "handle has a different PHID ('%s'). The handle must correspond ".
+ "to the policy identifier.",
+ $policy_identifier,
+ $handle_phid));
}
$policy = id(new PhabricatorPolicy())
diff --git a/src/applications/ponder/application/PhabricatorPonderApplication.php b/src/applications/ponder/application/PhabricatorPonderApplication.php
index e21660301c..999580e90b 100644
--- a/src/applications/ponder/application/PhabricatorPonderApplication.php
+++ b/src/applications/ponder/application/PhabricatorPonderApplication.php
@@ -29,8 +29,8 @@ public function getTitleGlyph() {
}
public function loadStatus(PhabricatorUser $user) {
- // replace with "x new unanswered questions" or some such
- // make sure to use self::formatStatusCount and friends...!
+ // Replace with "x new unanswered questions" or some such
+ // make sure to use `self::formatStatusCount` and friends...!
$status = array();
return $status;
diff --git a/src/applications/ponder/constants/PonderQuestionStatus.php b/src/applications/ponder/constants/PonderQuestionStatus.php
index 8d2a878234..3877380b30 100644
--- a/src/applications/ponder/constants/PonderQuestionStatus.php
+++ b/src/applications/ponder/constants/PonderQuestionStatus.php
@@ -17,7 +17,7 @@ public static function getQuestionStatusFullName($status) {
self::STATUS_OPEN => pht('Open'),
self::STATUS_CLOSED => pht('Closed by author'),
);
- return idx($map, $status, '???');
+ return idx($map, $status, pht('Unknown'));
}
public static function getQuestionStatusTagColor($status) {
diff --git a/src/applications/ponder/controller/PonderAnswerSaveController.php b/src/applications/ponder/controller/PonderAnswerSaveController.php
index b720015ff0..53e9367edd 100644
--- a/src/applications/ponder/controller/PonderAnswerSaveController.php
+++ b/src/applications/ponder/controller/PonderAnswerSaveController.php
@@ -27,8 +27,7 @@ public function processRequest() {
->setUser($viewer)
->setTitle(pht('Empty Answer'))
->appendChild(
- phutil_tag('p', array(), pht(
- 'Your answer must not be empty.')))
+ phutil_tag('p', array(), pht('Your answer must not be empty.')))
->addCancelButton('/Q'.$question_id);
return id(new AphrontDialogResponse())->setDialog($dialog);
diff --git a/src/applications/ponder/editor/PonderVoteEditor.php b/src/applications/ponder/editor/PonderVoteEditor.php
index cc9f89d9fe..2edb186787 100644
--- a/src/applications/ponder/editor/PonderVoteEditor.php
+++ b/src/applications/ponder/editor/PonderVoteEditor.php
@@ -25,7 +25,7 @@ public function setVote($vote) {
public function saveVote() {
$actor = $this->requireActor();
if (!$this->votable) {
- throw new Exception('Must set votable before saving vote');
+ throw new Exception(pht('Must set votable before saving vote.'));
}
$votable = $this->votable;
@@ -58,7 +58,7 @@ public function saveVote() {
$curvote = PonderVote::VOTE_NONE;
}
- // adjust votable's score by this much
+ // Adjust votable's score by this much.
$delta = $newvote - $curvote;
queryfx($conn,
diff --git a/src/applications/ponder/mail/PonderQuestionReplyHandler.php b/src/applications/ponder/mail/PonderQuestionReplyHandler.php
index 699d7cd79d..5d39782209 100644
--- a/src/applications/ponder/mail/PonderQuestionReplyHandler.php
+++ b/src/applications/ponder/mail/PonderQuestionReplyHandler.php
@@ -5,7 +5,7 @@ final class PonderQuestionReplyHandler
public function validateMailReceiver($mail_receiver) {
if (!($mail_receiver instanceof PonderQuestion)) {
- throw new Exception('Mail receiver is not a PonderQuestion!');
+ throw new Exception(pht('Mail receiver is not a %s!', 'PonderQuestion'));
}
}
diff --git a/src/applications/ponder/phid/PonderAnswerPHIDType.php b/src/applications/ponder/phid/PonderAnswerPHIDType.php
index c292b10b87..0bb0596737 100644
--- a/src/applications/ponder/phid/PonderAnswerPHIDType.php
+++ b/src/applications/ponder/phid/PonderAnswerPHIDType.php
@@ -32,7 +32,7 @@ public function loadHandles(
$question = $answer->getQuestion();
$question_title = $question->getFullTitle();
- $handle->setName("{$question_title} (Answer {$id})");
+ $handle->setName(pht('%s (Answer %s)', $question_title, $id));
$handle->setURI($answer->getURI());
}
}
diff --git a/src/applications/ponder/query/PonderQuestionQuery.php b/src/applications/ponder/query/PonderQuestionQuery.php
index 51081b3203..b63ba60def 100644
--- a/src/applications/ponder/query/PonderQuestionQuery.php
+++ b/src/applications/ponder/query/PonderQuestionQuery.php
@@ -92,7 +92,7 @@ protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
PonderQuestionStatus::STATUS_CLOSED);
break;
default:
- throw new Exception("Unknown status query '{$this->status}'!");
+ throw new Exception(pht("Unknown status query '%s'!", $this->status));
}
}
diff --git a/src/applications/ponder/storage/PonderQuestion.php b/src/applications/ponder/storage/PonderQuestion.php
index 8c8dab3f44..1568c59245 100644
--- a/src/applications/ponder/storage/PonderQuestion.php
+++ b/src/applications/ponder/storage/PonderQuestion.php
@@ -251,8 +251,7 @@ public function hasAutomaticCapability($capability, PhabricatorUser $viewer) {
public function describeAutomaticCapability($capability) {
- return pht(
- 'The user who asked a question can always view and edit it.');
+ return pht('The user who asked a question can always view and edit it.');
}
diff --git a/src/applications/ponder/storage/PonderQuestionTransaction.php b/src/applications/ponder/storage/PonderQuestionTransaction.php
index 5fe3bc266a..0e4d07b150 100644
--- a/src/applications/ponder/storage/PonderQuestionTransaction.php
+++ b/src/applications/ponder/storage/PonderQuestionTransaction.php
@@ -295,7 +295,7 @@ private function getNewAnswerPHID() {
if (count($add) != 1) {
throw new Exception(
- 'There should be only one answer added at a time.');
+ pht('There should be only one answer added at a time.'));
}
return reset($add);
@@ -303,7 +303,7 @@ private function getNewAnswerPHID() {
/**
* Generally, the answer object is only available if the transaction
- * type is self::TYPE_ANSWERS.
+ * type is `self::TYPE_ANSWERS`.
*
* Some stories - notably ones made before D7027 - will be of the more
* generic @{class:PhabricatorApplicationTransactionFeedStory}. These
diff --git a/src/applications/project/conduit/ProjectQueryConduitAPIMethod.php b/src/applications/project/conduit/ProjectQueryConduitAPIMethod.php
index 1f2078ff67..f65578e349 100644
--- a/src/applications/project/conduit/ProjectQueryConduitAPIMethod.php
+++ b/src/applications/project/conduit/ProjectQueryConduitAPIMethod.php
@@ -7,7 +7,7 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return 'Execute searches for Projects.';
+ return pht('Execute searches for Projects.');
}
protected function defineParamTypes() {
diff --git a/src/applications/project/editor/__tests__/PhabricatorProjectEditorTestCase.php b/src/applications/project/editor/__tests__/PhabricatorProjectEditorTestCase.php
index 3af09a4547..876ed9d0d7 100644
--- a/src/applications/project/editor/__tests__/PhabricatorProjectEditorTestCase.php
+++ b/src/applications/project/editor/__tests__/PhabricatorProjectEditorTestCase.php
@@ -100,11 +100,13 @@ public function testJoinLeaveProject() {
$proj = $this->refreshProject($proj, $user, true);
$this->assertTrue(
(bool)$proj,
- 'Assumption that projects are default visible to any user when created.');
+ pht(
+ 'Assumption that projects are default visible '.
+ 'to any user when created.'));
$this->assertFalse(
$proj->isUserMember($user->getPHID()),
- 'Arbitrary user not member of project.');
+ pht('Arbitrary user not member of project.'));
// Join the project.
$this->joinProject($proj, $user);
@@ -114,7 +116,7 @@ public function testJoinLeaveProject() {
$this->assertTrue(
$proj->isUserMember($user->getPHID()),
- 'Join works.');
+ pht('Join works.'));
// Join the project again.
@@ -125,7 +127,7 @@ public function testJoinLeaveProject() {
$this->assertTrue(
$proj->isUserMember($user->getPHID()),
- 'Joining an already-joined project is a no-op.');
+ pht('Joining an already-joined project is a no-op.'));
// Leave the project.
@@ -136,7 +138,7 @@ public function testJoinLeaveProject() {
$this->assertFalse(
$proj->isUserMember($user->getPHID()),
- 'Leave works.');
+ pht('Leave works.'));
// Leave the project again.
@@ -147,7 +149,7 @@ public function testJoinLeaveProject() {
$this->assertFalse(
$proj->isUserMember($user->getPHID()),
- 'Leaving an already-left project is a no-op.');
+ pht('Leaving an already-left project is a no-op.'));
// If a user can't edit or join a project, joining fails.
@@ -175,7 +177,7 @@ public function testJoinLeaveProject() {
$proj = $this->refreshProject($proj, $user, true);
$this->assertTrue(
$proj->isUserMember($user->getPHID()),
- 'Join allowed with edit permission.');
+ pht('Join allowed with edit permission.'));
$this->leaveProject($proj, $user);
@@ -189,7 +191,7 @@ public function testJoinLeaveProject() {
$proj = $this->refreshProject($proj, $user, true);
$this->assertTrue(
$proj->isUserMember($user->getPHID()),
- 'Join allowed with join permission.');
+ pht('Join allowed with join permission.'));
// A user can leave a project even if they can't edit it or join.
@@ -202,7 +204,7 @@ public function testJoinLeaveProject() {
$proj = $this->refreshProject($proj, $user, true);
$this->assertFalse(
$proj->isUserMember($user->getPHID()),
- 'Leave allowed without any permission.');
+ pht('Leave allowed without any permission.'));
}
private function refreshProject(
diff --git a/src/applications/project/mail/ProjectReplyHandler.php b/src/applications/project/mail/ProjectReplyHandler.php
index ac2cf2b6eb..7358a36072 100644
--- a/src/applications/project/mail/ProjectReplyHandler.php
+++ b/src/applications/project/mail/ProjectReplyHandler.php
@@ -5,7 +5,8 @@ final class ProjectReplyHandler
public function validateMailReceiver($mail_receiver) {
if (!($mail_receiver instanceof PhabricatorProject)) {
- throw new Exception('Mail receiver is not a PhabricatorProject.');
+ throw new Exception(
+ pht('Mail receiver is not a %s.', 'PhabricatorProject'));
}
}
diff --git a/src/applications/project/query/PhabricatorProjectQuery.php b/src/applications/project/query/PhabricatorProjectQuery.php
index ff35837078..a393130221 100644
--- a/src/applications/project/query/PhabricatorProjectQuery.php
+++ b/src/applications/project/query/PhabricatorProjectQuery.php
@@ -259,7 +259,9 @@ protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
break;
default:
throw new Exception(
- "Unknown project status '{$this->status}'!");
+ pht(
+ "Unknown project status '%s'!",
+ $this->status));
}
$where[] = qsprintf(
$conn_r,
diff --git a/src/applications/project/remarkup/__tests__/ProjectRemarkupRuleTestCase.php b/src/applications/project/remarkup/__tests__/ProjectRemarkupRuleTestCase.php
index 437b025491..80e809aba9 100644
--- a/src/applications/project/remarkup/__tests__/ProjectRemarkupRuleTestCase.php
+++ b/src/applications/project/remarkup/__tests__/ProjectRemarkupRuleTestCase.php
@@ -101,7 +101,7 @@ public function testProjectObjectRemarkup() {
),
),
- 'This is \'#urgent\'.' => array(
+ "This is '#urgent'." => array(
'embed' => array(),
'ref' => array(
array(
diff --git a/src/applications/project/storage/PhabricatorProjectTransaction.php b/src/applications/project/storage/PhabricatorProjectTransaction.php
index 692c41d736..c8698dbe6b 100644
--- a/src/applications/project/storage/PhabricatorProjectTransaction.php
+++ b/src/applications/project/storage/PhabricatorProjectTransaction.php
@@ -129,16 +129,16 @@ public function getTitle() {
// TODO: Some day, it would be nice to show the images.
if (!$old) {
return pht(
- '%s set this project\'s image to %s.',
+ "%s set this project's image to %s.",
$author_handle,
$this->renderHandleLink($new));
} else if (!$new) {
return pht(
- '%s removed this project\'s image.',
+ "%s removed this project's image.",
$author_handle);
} else {
return pht(
- '%s updated this project\'s image from %s to %s.',
+ "%s updated this project's image from %s to %s.",
$author_handle,
$this->renderHandleLink($old),
$this->renderHandleLink($new));
@@ -147,14 +147,14 @@ public function getTitle() {
case self::TYPE_ICON:
return pht(
- '%s set this project\'s icon to %s.',
+ "%s set this project's icon to %s.",
$author_handle,
PhabricatorProjectIcon::getLabel($new));
break;
case self::TYPE_COLOR:
return pht(
- '%s set this project\'s color to %s.',
+ "%s set this project's color to %s.",
$author_handle,
PHUITagView::getShadeName($new));
break;
@@ -162,11 +162,11 @@ public function getTitle() {
case self::TYPE_LOCKED:
if ($new) {
return pht(
- '%s locked this project\'s membership.',
+ "%s locked this project's membership.",
$author_handle);
} else {
return pht(
- '%s unlocked this project\'s membership.',
+ "%s unlocked this project's membership.",
$author_handle);
}
break;
diff --git a/src/applications/project/typeahead/PhabricatorProjectLogicalUserDatasource.php b/src/applications/project/typeahead/PhabricatorProjectLogicalUserDatasource.php
index d2cb58a7ee..3b02195c25 100644
--- a/src/applications/project/typeahead/PhabricatorProjectLogicalUserDatasource.php
+++ b/src/applications/project/typeahead/PhabricatorProjectLogicalUserDatasource.php
@@ -28,13 +28,12 @@ public function getDatasourceFunctions() {
'arguments' => pht('username'),
'summary' => pht("Find results in any of a user's projects."),
'description' => pht(
- 'This function allows you to find results associated with any '.
- 'of the projects a specified user is a member of. For example, '.
- 'this will find results associated with all of the projects '.
- '`alincoln` is a member of:'.
- "\n\n".
- '> projects(alincoln)'.
- "\n\n"),
+ "This function allows you to find results associated with any ".
+ "of the projects a specified user is a member of. For example, ".
+ "this will find results associated with all of the projects ".
+ "`%s` is a member of:\n\n%s\n\n",
+ 'alincoln',
+ '> projects(alincoln)'),
),
);
}
diff --git a/src/applications/project/typeahead/PhabricatorProjectNoProjectsDatasource.php b/src/applications/project/typeahead/PhabricatorProjectNoProjectsDatasource.php
index 731f39efd0..156f04605f 100644
--- a/src/applications/project/typeahead/PhabricatorProjectNoProjectsDatasource.php
+++ b/src/applications/project/typeahead/PhabricatorProjectNoProjectsDatasource.php
@@ -21,12 +21,11 @@ public function getDatasourceFunctions() {
'name' => pht('Not In Any Projects'),
'summary' => pht('Find results which are not in any projects.'),
'description' => pht(
- 'This function matches results which are not associated with any '.
- 'projects. It is usually most often used to find objects which '.
- 'might have slipped through the cracks and not been organized '.
- 'properly.'.
- "\n\n".
- "> null()"),
+ "This function matches results which are not associated with any ".
+ "projects. It is usually most often used to find objects which ".
+ "might have slipped through the cracks and not been organized ".
+ "properly.\n\n%s",
+ '> null()'),
),
);
}
diff --git a/src/applications/releeph/commitfinder/ReleephCommitFinder.php b/src/applications/releeph/commitfinder/ReleephCommitFinder.php
index 7b017f0287..89fd84e196 100644
--- a/src/applications/releeph/commitfinder/ReleephCommitFinder.php
+++ b/src/applications/releeph/commitfinder/ReleephCommitFinder.php
@@ -37,13 +37,17 @@ public function fromPartial($partial_string) {
->executeOne();
if (!$diff_rev) {
throw new ReleephCommitFinderException(
- "{$partial_string} does not refer to an existing diff.");
+ pht(
+ '%s does not refer to an existing diff.',
+ $partial_string));
}
$commit_phids = $diff_rev->getCommitPHIDs();
if (!$commit_phids) {
throw new ReleephCommitFinderException(
- "{$partial_string} has no commits associated with it yet.");
+ pht(
+ '%s has no commits associated with it yet.',
+ $partial_string));
}
$this->objectPHID = $diff_rev->getPHID();
@@ -64,10 +68,11 @@ public function fromPartial($partial_string) {
$partial_string, $matches)) {
$callsign = $matches['callsign'];
if ($callsign != $repository->getCallsign()) {
- throw new ReleephCommitFinderException(sprintf(
- '%s is in a different repository to this Releeph project (%s).',
- $partial_string,
- $repository->getCallsign()));
+ throw new ReleephCommitFinderException(
+ pht(
+ '%s is in a different repository to this Releeph project (%s).',
+ $partial_string,
+ $repository->getCallsign()));
} else {
$dr_data = $matches;
}
@@ -82,7 +87,10 @@ public function fromPartial($partial_string) {
$dr_data['user'] = $this->getUser();
$dr = DiffusionRequest::newFromDictionary($dr_data);
} catch (Exception $ex) {
- $message = "No commit matches {$partial_string}: ".$ex->getMessage();
+ $message = pht(
+ 'No commit matches %s: %s',
+ $partial_string,
+ $ex->getMessage());
throw new ReleephCommitFinderException($message);
}
@@ -90,7 +98,9 @@ public function fromPartial($partial_string) {
if (!$phabricator_repository_commit) {
throw new ReleephCommitFinderException(
- "The commit {$partial_string} doesn't exist in this repository.");
+ pht(
+ "The commit %s doesn't exist in this repository.",
+ $partial_string));
}
// When requesting a single commit, if it has an associated review we
diff --git a/src/applications/releeph/conduit/ReleephGetBranchesConduitAPIMethod.php b/src/applications/releeph/conduit/ReleephGetBranchesConduitAPIMethod.php
index 59e8900108..6e225ec8e3 100644
--- a/src/applications/releeph/conduit/ReleephGetBranchesConduitAPIMethod.php
+++ b/src/applications/releeph/conduit/ReleephGetBranchesConduitAPIMethod.php
@@ -7,7 +7,7 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return 'Return information about all active Releeph branches.';
+ return pht('Return information about all active Releeph branches.');
}
protected function defineParamTypes() {
diff --git a/src/applications/releeph/conduit/ReleephProjectInfoConduitAPIMethod.php b/src/applications/releeph/conduit/ReleephProjectInfoConduitAPIMethod.php
deleted file mode 100644
index f30d1070c4..0000000000
--- a/src/applications/releeph/conduit/ReleephProjectInfoConduitAPIMethod.php
+++ /dev/null
@@ -1,98 +0,0 @@
- 'optional string',
- );
- }
-
- protected function defineReturnType() {
- return 'dict';
- }
-
- protected function defineErrorTypes() {
- return array(
- 'ERR_UNKNOWN_ARC' =>
- "The given Arcanist project name doesn't exist in the ".
- "installation of Phabricator you are accessing.",
- );
- }
-
- protected function execute(ConduitAPIRequest $request) {
- $arc_project_name = $request->getValue('arcProjectName');
- if ($arc_project_name) {
- $arc_project = id(new PhabricatorRepositoryArcanistProject())
- ->loadOneWhere('name = %s', $arc_project_name);
- if (!$arc_project) {
- throw id(new ConduitException('ERR_UNKNOWN_ARC'))
- ->setErrorDescription(
- "Unknown Arcanist project '{$arc_project_name}': ".
- "are you using the correct Conduit URI?");
- }
-
- $releeph_projects = id(new ReleephProject())
- ->loadAllWhere('arcanistProjectID = %d', $arc_project->getID());
- } else {
- $releeph_projects = id(new ReleephProject())->loadAll();
- }
-
- $releeph_projects = mfilter($releeph_projects, 'getIsActive');
-
- $result = array();
- foreach ($releeph_projects as $releeph_project) {
- $selector = $releeph_project->getReleephFieldSelector();
- $fields = $selector->getFieldSpecifications();
-
- $fields_info = array();
- foreach ($fields as $field) {
- $field->setReleephProject($releeph_project);
- if ($field->isEditable()) {
- $key = $field->getKeyForConduit();
- $fields_info[$key] = array(
- 'class' => get_class($field),
- 'name' => $field->getName(),
- 'key' => $key,
- 'arcHelp' => $field->renderHelpForArcanist(),
- );
- }
- }
-
- $releeph_branches = mfilter(
- id(new ReleephBranch())
- ->loadAllWhere('releephProjectID = %d', $releeph_project->getID()),
- 'getIsActive');
-
- $releeph_branches_struct = array();
- foreach ($releeph_branches as $branch) {
- $releeph_branches_struct[] = array(
- 'branchName' => $branch->getName(),
- 'projectName' => $releeph_project->getName(),
- 'projectPHID' => $releeph_project->getPHID(),
- 'branchPHID' => $branch->getPHID(),
- );
- }
-
- $result[] = array(
- 'projectName' => $releeph_project->getName(),
- 'projectPHID' => $releeph_project->getPHID(),
- 'branches' => $releeph_branches_struct,
- 'fields' => $fields_info,
- );
- }
-
- return $result;
- }
-
-}
diff --git a/src/applications/releeph/conduit/ReleephQueryRequestsConduitAPIMethod.php b/src/applications/releeph/conduit/ReleephQueryRequestsConduitAPIMethod.php
index 5ccc8a967d..5cd5032c2a 100644
--- a/src/applications/releeph/conduit/ReleephQueryRequestsConduitAPIMethod.php
+++ b/src/applications/releeph/conduit/ReleephQueryRequestsConduitAPIMethod.php
@@ -8,8 +8,8 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return
- 'Return information about all Releeph requests linked to the given ids.';
+ return pht(
+ 'Return information about all Releeph requests linked to the given ids.');
}
protected function defineParamTypes() {
diff --git a/src/applications/releeph/conduit/ReleephRequestConduitAPIMethod.php b/src/applications/releeph/conduit/ReleephRequestConduitAPIMethod.php
index f60e40894b..8473c0c7b5 100644
--- a/src/applications/releeph/conduit/ReleephRequestConduitAPIMethod.php
+++ b/src/applications/releeph/conduit/ReleephRequestConduitAPIMethod.php
@@ -7,7 +7,7 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return 'Request a commit or diff to be picked to a branch.';
+ return pht('Request a commit or diff to be picked to a branch.');
}
protected function defineParamTypes() {
@@ -24,8 +24,8 @@ protected function defineReturnType() {
protected function defineErrorTypes() {
return array(
- 'ERR_BRANCH' => 'Unknown Releeph branch.',
- 'ERR_FIELD_PARSE' => 'Unable to parse a Releeph field.',
+ 'ERR_BRANCH' => pht('Unknown Releeph branch.'),
+ 'ERR_FIELD_PARSE' => pht('Unable to parse a Releeph field.'),
);
}
@@ -45,7 +45,10 @@ protected function execute(ConduitAPIRequest $request) {
if (!$releeph_branch) {
throw id(new ConduitException('ERR_BRANCH'))->setErrorDescription(
- "No ReleephBranch found with PHID {$branch_phid}!");
+ pht(
+ 'No %s found with PHID %s!',
+ 'ReleephBranch',
+ $branch_phid));
}
$releeph_project = $releeph_branch->getProduct();
diff --git a/src/applications/releeph/conduit/work/ReleephWorkCanPushConduitAPIMethod.php b/src/applications/releeph/conduit/work/ReleephWorkCanPushConduitAPIMethod.php
index 339f0ac5eb..0086209575 100644
--- a/src/applications/releeph/conduit/work/ReleephWorkCanPushConduitAPIMethod.php
+++ b/src/applications/releeph/conduit/work/ReleephWorkCanPushConduitAPIMethod.php
@@ -11,7 +11,7 @@ public function getMethodStatus() {
}
public function getMethodDescription() {
- return 'Return whether the conduit user is allowed to push.';
+ return pht('Return whether the conduit user is allowed to push.');
}
protected function defineParamTypes() {
diff --git a/src/applications/releeph/conduit/work/ReleephWorkGetAuthorInfoConduitAPIMethod.php b/src/applications/releeph/conduit/work/ReleephWorkGetAuthorInfoConduitAPIMethod.php
index 08381befb7..6db9fd76ee 100644
--- a/src/applications/releeph/conduit/work/ReleephWorkGetAuthorInfoConduitAPIMethod.php
+++ b/src/applications/releeph/conduit/work/ReleephWorkGetAuthorInfoConduitAPIMethod.php
@@ -12,7 +12,7 @@ public function getMethodStatus() {
}
public function getMethodDescription() {
- return 'Return a string to use as the VCS author.';
+ return pht('Return a string to use as the VCS author.');
}
protected function defineParamTypes() {
diff --git a/src/applications/releeph/conduit/work/ReleephWorkGetBranchCommitMessageConduitAPIMethod.php b/src/applications/releeph/conduit/work/ReleephWorkGetBranchCommitMessageConduitAPIMethod.php
index 20d86a003a..43bdd04161 100644
--- a/src/applications/releeph/conduit/work/ReleephWorkGetBranchCommitMessageConduitAPIMethod.php
+++ b/src/applications/releeph/conduit/work/ReleephWorkGetBranchCommitMessageConduitAPIMethod.php
@@ -12,7 +12,7 @@ public function getMethodStatus() {
}
public function getMethodDescription() {
- return 'Get a commit message for committing a Releeph branch.';
+ return pht('Get a commit message for committing a Releeph branch.');
}
protected function defineParamTypes() {
@@ -60,19 +60,23 @@ protected function execute(ConduitAPIRequest $request) {
$commit_message[] = $h_branch->getFullName();
$commit_message[] = $h_branch->getURI();
- $commit_message[] = 'Cut Point: '.$handles[$cut_phid]->getName();
+ $commit_message[] = pht('Cut Point: %s', $handles[$cut_phid]->getName());
$cut_point_pr_commit = id(new PhabricatorRepositoryCommit())
->loadOneWhere('phid = %s', $cut_phid);
$cut_point_commit_date = strftime(
'%Y-%m-%d %H:%M:%S%z',
$cut_point_pr_commit->getEpoch());
- $commit_message[] = "Cut Point Date: {$cut_point_commit_date}";
+ $commit_message[] = pht('Cut Point Date: %s', $cut_point_commit_date);
- $commit_message[] = 'Created By: '.$handles[$creator_phid]->getName();
+ $commit_message[] = pht(
+ 'Created By: %s',
+ $handles[$creator_phid]->getName());
$project_uri = $project->getURI();
- $commit_message[] = 'Project: '.$h_project->getName().' '.$project_uri;
+ $commit_message[] = pht(
+ 'Project: %s',
+ $h_project->getName().' '.$project_uri);
/**
* Required for 090-limit_new_branch_creations.sh in
diff --git a/src/applications/releeph/conduit/work/ReleephWorkGetBranchConduitAPIMethod.php b/src/applications/releeph/conduit/work/ReleephWorkGetBranchConduitAPIMethod.php
index 5f6f82b17d..7941710528 100644
--- a/src/applications/releeph/conduit/work/ReleephWorkGetBranchConduitAPIMethod.php
+++ b/src/applications/releeph/conduit/work/ReleephWorkGetBranchConduitAPIMethod.php
@@ -12,7 +12,7 @@ public function getMethodStatus() {
}
public function getMethodDescription() {
- return 'Return information to help checkout / cut a Releeph branch.';
+ return pht('Return information to help checkout / cut a Releeph branch.');
}
protected function defineParamTypes() {
diff --git a/src/applications/releeph/conduit/work/ReleephWorkGetCommitMessageConduitAPIMethod.php b/src/applications/releeph/conduit/work/ReleephWorkGetCommitMessageConduitAPIMethod.php
index 398f37e7a0..7f645c4be8 100644
--- a/src/applications/releeph/conduit/work/ReleephWorkGetCommitMessageConduitAPIMethod.php
+++ b/src/applications/releeph/conduit/work/ReleephWorkGetCommitMessageConduitAPIMethod.php
@@ -12,9 +12,9 @@ public function getMethodStatus() {
}
public function getMethodDescription() {
- return
- 'Get commit message components for building '.
- 'a ReleephRequest commit message.';
+ return pht(
+ 'Get commit message components for building a %s commit message.',
+ 'ReleephRequest');
}
protected function defineParamTypes() {
diff --git a/src/applications/releeph/conduit/work/ReleephWorkNextRequestConduitAPIMethod.php b/src/applications/releeph/conduit/work/ReleephWorkNextRequestConduitAPIMethod.php
index e161faf082..fb8a8ad0dc 100644
--- a/src/applications/releeph/conduit/work/ReleephWorkNextRequestConduitAPIMethod.php
+++ b/src/applications/releeph/conduit/work/ReleephWorkNextRequestConduitAPIMethod.php
@@ -15,9 +15,9 @@ public function getMethodStatus() {
}
public function getMethodDescription() {
- return
- 'Return info required to cut a branch, '.
- 'and pick and revert ReleephRequests';
+ return pht(
+ 'Return info required to cut a branch, and pick and revert %s.',
+ 'ReleephRequests');
}
protected function defineParamTypes() {
@@ -33,8 +33,8 @@ protected function defineReturnType() {
protected function defineErrorTypes() {
return array(
- 'ERR-NOT-PUSHER' =>
- 'You are not listed as a pusher for thie Releeph project!',
+ 'ERR-NOT-PUSHER' => pht(
+ 'You are not listed as a pusher for the Releeph project!'),
);
}
diff --git a/src/applications/releeph/conduit/work/ReleephWorkRecordConduitAPIMethod.php b/src/applications/releeph/conduit/work/ReleephWorkRecordConduitAPIMethod.php
index 43e26f2f4d..d32249fe65 100644
--- a/src/applications/releeph/conduit/work/ReleephWorkRecordConduitAPIMethod.php
+++ b/src/applications/releeph/conduit/work/ReleephWorkRecordConduitAPIMethod.php
@@ -25,8 +25,9 @@ public function getMethodStatus() {
* reverted.
*/
public function getMethodDescription() {
- return 'Record whether we committed a pick or revert '.
- 'to the upstream repository.';
+ return pht(
+ 'Record whether we committed a pick or revert '.
+ 'to the upstream repository.');
}
protected function defineParamTypes() {
diff --git a/src/applications/releeph/conduit/work/ReleephWorkRecordPickStatusConduitAPIMethod.php b/src/applications/releeph/conduit/work/ReleephWorkRecordPickStatusConduitAPIMethod.php
index f9434ab48c..ead3d9dd2a 100644
--- a/src/applications/releeph/conduit/work/ReleephWorkRecordPickStatusConduitAPIMethod.php
+++ b/src/applications/releeph/conduit/work/ReleephWorkRecordPickStatusConduitAPIMethod.php
@@ -12,7 +12,7 @@ public function getMethodStatus() {
}
public function getMethodDescription() {
- return 'Record whether a pick or revert was successful or not.';
+ return pht('Record whether a pick or revert was successful or not.');
}
protected function defineParamTypes() {
@@ -55,7 +55,7 @@ protected function execute(ConduitAPIRequest $request) {
break;
default:
- throw new Exception("Unknown action {$action}!");
+ throw new Exception(pht('Unknown action %s!', $action));
}
$releeph_request = id(new ReleephRequest())
diff --git a/src/applications/releeph/controller/branch/ReleephBranchCreateController.php b/src/applications/releeph/controller/branch/ReleephBranchCreateController.php
index 11b2e746aa..851724c6d9 100644
--- a/src/applications/releeph/controller/branch/ReleephBranchCreateController.php
+++ b/src/applications/releeph/controller/branch/ReleephBranchCreateController.php
@@ -94,17 +94,16 @@ public function processRequest() {
->setLabel(pht('Symbolic Name'))
->setName('symbolicName')
->setValue($symbolic_name)
- ->setCaption(pht('Mutable alternate name, for easy reference, '.
- '(e.g. "LATEST")')))
+ ->setCaption(pht(
+ 'Mutable alternate name, for easy reference, (e.g. "LATEST")')))
->appendChild(
id(new AphrontFormTextControl())
->setLabel(pht('Cut point'))
->setName('cutPoint')
->setValue($cut_point)
->setError($e_cut)
- ->setCaption(
- pht('A commit ID for your repo type, or a '.
- 'Diffusion ID like "rE123"')))
+ ->setCaption(pht(
+ 'A commit ID for your repo type, or a Diffusion ID like "rE123"')))
->appendChild($branch_date_control)
->appendChild(
id(new AphrontFormSubmitControl())
diff --git a/src/applications/releeph/controller/branch/ReleephBranchEditController.php b/src/applications/releeph/controller/branch/ReleephBranchEditController.php
index 2e1e4ccda8..000e9535bf 100644
--- a/src/applications/releeph/controller/branch/ReleephBranchEditController.php
+++ b/src/applications/releeph/controller/branch/ReleephBranchEditController.php
@@ -85,8 +85,8 @@ public function processRequest() {
->setLabel(pht('Symbolic Name'))
->setName('symbolicName')
->setValue($symbolic_name)
- ->setCaption(pht('Mutable alternate name, for easy reference, '.
- '(e.g. "LATEST")')))
+ ->setCaption(pht(
+ 'Mutable alternate name, for easy reference, (e.g. "LATEST")')))
->appendChild(
id(new AphrontFormSubmitControl())
->addCancelButton($this->getBranchViewURI($branch))
diff --git a/src/applications/releeph/controller/branch/ReleephBranchNamePreviewController.php b/src/applications/releeph/controller/branch/ReleephBranchNamePreviewController.php
index 6eefc0dc83..bf429f9034 100644
--- a/src/applications/releeph/controller/branch/ReleephBranchNamePreviewController.php
+++ b/src/applications/releeph/controller/branch/ReleephBranchNamePreviewController.php
@@ -13,10 +13,10 @@ public function processRequest() {
$template = ReleephBranchTemplate::getDefaultTemplate();
}
- $arc_project_id = $request->getInt('arcProjectID');
+ $repository_phid = $request->getInt('repositoryPHID');
$fake_commit_handle =
ReleephBranchTemplate::getFakeCommitHandleFor(
- $arc_project_id,
+ $repository_phid,
$request->getUser());
list($name, $errors) = id(new ReleephBranchTemplate())
diff --git a/src/applications/releeph/controller/product/ReleephProductCreateController.php b/src/applications/releeph/controller/product/ReleephProductCreateController.php
index 801ec7fe48..6d5f29ff37 100644
--- a/src/applications/releeph/controller/product/ReleephProductCreateController.php
+++ b/src/applications/releeph/controller/product/ReleephProductCreateController.php
@@ -6,9 +6,7 @@ public function processRequest() {
$request = $this->getRequest();
$name = trim($request->getStr('name'));
$trunk_branch = trim($request->getStr('trunkBranch'));
- $arc_pr_id = $request->getInt('arcPrID');
-
- $arc_projects = $this->loadArcProjects();
+ $repository_phid = $request->getStr('repositoryPHID');
$e_name = true;
$e_trunk_branch = true;
@@ -27,14 +25,10 @@ public function processRequest() {
'You must specify which branch you will be picking from.');
}
- $arc_project = $arc_projects[$arc_pr_id];
- $pr_repository = null;
- if ($arc_project->getRepositoryID()) {
- $pr_repository = id(new PhabricatorRepositoryQuery())
- ->setViewer($request->getUser())
- ->withIDs(array($arc_project->getRepositoryID()))
- ->executeOne();
- }
+ $pr_repository = id(new PhabricatorRepositoryQuery())
+ ->setViewer($request->getUser())
+ ->withPHIDs(array($repository_phid))
+ ->executeOne();
if (!$errors) {
@@ -42,7 +36,6 @@ public function processRequest() {
->setName($name)
->setTrunkBranch($trunk_branch)
->setRepositoryPHID($pr_repository->getPHID())
- ->setArcanistProjectID($arc_project->getID())
->setCreatedByUserPHID($request->getUser()->getPHID())
->setIsActive(1);
@@ -58,7 +51,7 @@ public function processRequest() {
}
}
- $arc_project_options = $this->getArcProjectSelectOptions($arc_projects);
+ $repo_options = $this->getRepositorySelectOptions();
$product_name_input = id(new AphrontFormTextControl())
->setLabel(pht('Name'))
@@ -68,40 +61,31 @@ public function processRequest() {
->setError($e_name)
->setCaption(pht('A name like "Thrift" but not "Thrift releases".'));
- $arc_project_input = id(new AphrontFormSelectControl())
- ->setLabel(pht('Arc Project'))
- ->setName('arcPrID')
- ->setValue($arc_pr_id)
- ->setCaption(pht(
- 'If your Arc project isn\'t listed, associate it with a repository %s',
- phutil_tag(
- 'a',
- array(
- 'href' => '/repository/',
- 'target' => '_blank',
- ),
- 'here')))
- ->setOptions($arc_project_options);
+ $repository_input = id(new AphrontFormSelectControl())
+ ->setLabel(pht('Repository'))
+ ->setName('repositoryPHID')
+ ->setValue($repository_phid)
+ ->setOptions($repo_options);
$branch_name_preview = id(new ReleephBranchPreviewView())
->setLabel(pht('Example Branch'))
->addControl('projectName', $product_name_input)
- ->addControl('arcProjectID', $arc_project_input)
+ ->addControl('repositoryPHID', $repository_input)
->addStatic('template', '')
->addStatic('isSymbolic', false);
$form = id(new AphrontFormView())
->setUser($request->getUser())
->appendChild($product_name_input)
- ->appendChild($arc_project_input)
+ ->appendChild($repository_input)
->appendChild(
id(new AphrontFormTextControl())
->setLabel(pht('Trunk'))
->setName('trunkBranch')
->setValue($trunk_branch)
->setError($e_trunk_branch)
- ->setCaption(pht('The development branch, '.
- 'from which requests will be picked.')))
+ ->setCaption(pht(
+ 'The development branch, from which requests will be picked.')))
->appendChild($branch_name_preview)
->appendChild(
id(new AphrontFormSubmitControl())
@@ -126,43 +110,23 @@ public function processRequest() {
));
}
- private function loadArcProjects() {
- $viewer = $this->getRequest()->getUser();
-
- $projects = id(new PhabricatorRepositoryArcanistProjectQuery())
- ->setViewer($viewer)
- ->needRepositories(true)
+ private function getRepositorySelectOptions() {
+ $repos = id(new PhabricatorRepositoryQuery())
+ ->setViewer($this->getRequest()->getUser())
->execute();
- $projects = mfilter($projects, 'getRepository');
- $projects = msort($projects, 'getName');
-
- return $projects;
- }
-
- private function getArcProjectSelectOptions(array $arc_projects) {
- assert_instances_of($arc_projects, 'PhabricatorRepositoryArcanistProject');
-
- $repos = mpull($arc_projects, 'getRepository');
+ $repos = msort($repos, 'getName');
$repos = mpull($repos, null, 'getID');
- $groups = array();
- foreach ($arc_projects as $arc_project) {
- $id = $arc_project->getID();
- $repo_id = $arc_project->getRepository()->getID();
- $groups[$repo_id][$id] = $arc_project->getName();
- }
-
$choices = array();
- foreach ($groups as $repo_id => $group) {
- $repo_name = $repos[$repo_id]->getName();
- $callsign = $repos[$repo_id]->getCallsign();
- $name = "r{$callsign} ({$repo_name})";
- $choices[$name] = $group;
+
+ foreach ($repos as $repo_id => $repo) {
+ $repo_name = $repo->getName();
+ $callsign = $repo->getCallsign();
+ $choices[$repo->getPHID()] = "r{$callsign} ({$repo_name})";
}
ksort($choices);
-
return $choices;
}
diff --git a/src/applications/releeph/controller/product/ReleephProductEditController.php b/src/applications/releeph/controller/product/ReleephProductEditController.php
index 926f813db0..d0769c7b28 100644
--- a/src/applications/releeph/controller/product/ReleephProductEditController.php
+++ b/src/applications/releeph/controller/product/ReleephProductEditController.php
@@ -15,7 +15,6 @@ public function processRequest() {
$product = id(new ReleephProductQuery())
->setViewer($viewer)
->withIDs(array($this->productID))
- ->needArcanistProjects(true)
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_VIEW,
@@ -48,7 +47,7 @@ public function processRequest() {
$test_paths = $product->getDetail('testPaths', array());
}
- $arc_project_id = $product->getArcanistProjectID();
+ $repository_phid = $product->getRepositoryPHID();
if ($request->isFormPost()) {
$pusher_phids = $request->getArr('pushers');
@@ -92,8 +91,9 @@ public function processRequest() {
->setDetail('branchTemplate', $branch_template)
->setDetail('testPaths', $test_paths);
- $fake_commit_handle =
- ReleephBranchTemplate::getFakeCommitHandleFor($arc_project_id, $viewer);
+ $fake_commit_handle = ReleephBranchTemplate::getFakeCommitHandleFor(
+ $repository_phid,
+ $viewer);
if ($branch_template) {
list($branch_name, $template_errors) = id(new ReleephBranchTemplate())
@@ -104,7 +104,7 @@ public function processRequest() {
if ($template_errors) {
$e_branch_template = pht('Whoopsies!');
foreach ($template_errors as $template_error) {
- $errors[] = "Template error: {$template_error}";
+ $errors[] = pht('Template error: %s', $template_error);
}
}
}
@@ -136,9 +136,9 @@ public function processRequest() {
$product->getRepository()->getName()))
->appendChild(
id(new AphrontFormStaticControl())
- ->setLabel(pht('Arc Project'))
+ ->setLabel(pht('Repository'))
->setValue(
- $product->getArcanistProject()->getName()))
+ $product->getRepository()->getName()))
->appendChild(
id(new AphrontFormStaticControl())
->setLabel(pht('Releeph Project PHID'))
@@ -171,7 +171,7 @@ public function processRequest() {
$branch_template_input = id(new AphrontFormTextControl())
->setName('branchTemplate')
->setValue($branch_template)
- ->setLabel('Branch Template')
+ ->setLabel(pht('Branch Template'))
->setError($e_branch_template)
->setCaption(
pht("Leave this blank to use your installation's default."));
@@ -179,7 +179,7 @@ public function processRequest() {
$branch_template_preview = id(new ReleephBranchPreviewView())
->setLabel(pht('Preview'))
->addControl('template', $branch_template_input)
- ->addStatic('arcProjectID', $arc_project_id)
+ ->addStatic('repositoryPHID', $repository_phid)
->addStatic('isSymbolic', false)
->addStatic('projectName', $product->getName());
diff --git a/src/applications/releeph/controller/request/ReleephRequestActionController.php b/src/applications/releeph/controller/request/ReleephRequestActionController.php
index 64125db5ff..bbcc1df2bb 100644
--- a/src/applications/releeph/controller/request/ReleephRequestActionController.php
+++ b/src/applications/releeph/controller/request/ReleephRequestActionController.php
@@ -64,8 +64,9 @@ public function processRequest() {
// We're all good!
} else {
throw new Exception(
- "Bug! Only pushers or the requestor can manually change a ".
- "request's in-branch status!");
+ pht(
+ "Bug! Only pushers or the requestor can manually change a ".
+ "request's in-branch status!"));
}
if ($action === 'mark-manually-picked') {
@@ -89,7 +90,8 @@ public function processRequest() {
break;
default:
- throw new Exception("unknown or unimplemented action {$action}");
+ throw new Exception(
+ pht('Unknown or unimplemented action %s.', $action));
}
$editor->applyTransactions($pull, $xactions);
diff --git a/src/applications/releeph/controller/request/ReleephRequestDifferentialCreateController.php b/src/applications/releeph/controller/request/ReleephRequestDifferentialCreateController.php
index 8d27ef028d..3c2dc3d735 100644
--- a/src/applications/releeph/controller/request/ReleephRequestDifferentialCreateController.php
+++ b/src/applications/releeph/controller/request/ReleephRequestDifferentialCreateController.php
@@ -25,28 +25,28 @@ public function processRequest() {
}
$this->revision = $diff_rev;
- $arc_project = id(new PhabricatorRepositoryArcanistProject())
- ->loadOneWhere('phid = %s', $this->revision->getArcanistProjectPHID());
+ $repository = $this->revision->getRepository();
$projects = id(new ReleephProject())->loadAllWhere(
- 'arcanistProjectID = %d AND isActive = 1',
- $arc_project->getID());
+ 'repositoryPHID = %s AND isActive = 1',
+ $repository->getPHID());
if (!$projects) {
- throw new Exception(sprintf(
- "D%d belongs to the '%s' Arcanist project, ".
- "which is not part of any Releeph project!",
- $this->revision->getID(),
- $arc_project->getName()));
+ throw new Exception(
+ pht(
+ "%s belongs to the '%s' repository, ".
+ "which is not part of any Releeph project!",
+ 'D'.$this->revision->getID(),
+ $repository->getMonogram()));
}
$branches = id(new ReleephBranch())->loadAllWhere(
'releephProjectID IN (%Ld) AND isActive = 1',
mpull($projects, 'getID'));
if (!$branches) {
- throw new Exception(sprintf(
- 'D%d could be in the Releeph project(s) %s, '.
+ throw new Exception(pht(
+ '%s could be in the Releeph project(s) %s, '.
'but this project / none of these projects have open branches.',
- $this->revision->getID(),
+ 'D'.$this->revision->getID(),
implode(', ', mpull($projects, 'getName'))));
}
@@ -69,9 +69,10 @@ public function processRequest() {
->addCancelButton('/D'.$request->getStr('D'));
$dialog->appendChild(
- pht('This differential revision changes code that is associated '.
- 'with multiple Releeph branches. '.
- 'Please select the branch where you would like this code to be picked.'));
+ pht(
+ 'This differential revision changes code that is associated '.
+ 'with multiple Releeph branches. Please select the branch '.
+ 'where you would like this code to be picked.'));
foreach ($branch_groups as $project_id => $branches) {
$project = idx($projects, $project_id);
diff --git a/src/applications/releeph/controller/request/ReleephRequestEditController.php b/src/applications/releeph/controller/request/ReleephRequestEditController.php
index 3c5a80bd99..8888a01070 100644
--- a/src/applications/releeph/controller/request/ReleephRequestEditController.php
+++ b/src/applications/releeph/controller/request/ReleephRequestEditController.php
@@ -93,8 +93,8 @@ public function processRequest() {
if ($request_identifier ===
ReleephRequestTypeaheadControl::PLACEHOLDER) {
- $errors[] = 'No commit ID was provided.';
- $e_request_identifier = 'Required';
+ $errors[] = pht('No commit ID was provided.');
+ $e_request_identifier = pht('Required');
} else {
$pr_commit = null;
$finder = id(new ReleephCommitFinder())
@@ -103,9 +103,10 @@ public function processRequest() {
try {
$pr_commit = $finder->fromPartial($request_identifier);
} catch (Exception $e) {
- $e_request_identifier = 'Invalid';
- $errors[] =
- "Request {$request_identifier} is probably not a valid commit";
+ $e_request_identifier = pht('Invalid');
+ $errors[] = pht(
+ 'Request %s is probably not a valid commit.',
+ $request_identifier);
$errors[] = $e->getMessage();
}
@@ -126,7 +127,7 @@ public function processRequest() {
if ($existing) {
return id(new AphrontRedirectResponse())
->setURI('/releeph/request/edit/'.$existing->getID().
- '?existing=1');
+ '?existing=1');
}
$xactions[] = id(new ReleephRequestTransaction())
@@ -204,8 +205,8 @@ public function processRequest() {
$notice_view = null;
if ($request->getInt('existing')) {
$notice_messages = array(
- 'You are editing an existing pick request!',
- hsprintf(
+ pht('You are editing an existing pick request!'),
+ pht(
'Requested %s by %s',
$age_string,
$handles[$pull->getRequestUserPHID()]->renderLink()),
@@ -222,12 +223,12 @@ public function processRequest() {
$form
->appendChild(
id(new AphrontFormMarkupControl())
- ->setLabel('Original Commit')
+ ->setLabel(pht('Original Commit'))
->setValue(
$handles[$pull->getRequestCommitPHID()]->renderLink()))
->appendChild(
id(new AphrontFormMarkupControl())
- ->setLabel('Requestor')
+ ->setLabel(pht('Requestor'))
->setValue(hsprintf(
'%s %s',
$handles[$pull->getRequestUserPHID()]->renderLink(),
@@ -261,14 +262,15 @@ public function processRequest() {
$form->appendChild(
id(new ReleephRequestTypeaheadControl())
->setName('requestIdentifierRaw')
- ->setLabel('Commit ID')
+ ->setLabel(pht('Commit ID'))
->setRepo($repo)
->setValue($request_identifier)
->setError($e_request_identifier)
->setStartTime($branch_cut_point->getEpoch())
->setCaption(
- 'Start typing to autocomplete on commit title, '.
- 'or give a Phabricator commit identifier like rFOO1234'));
+ pht(
+ 'Start typing to autocomplete on commit title, '.
+ 'or give a Phabricator commit identifier like rFOO1234.')));
}
}
@@ -291,7 +293,7 @@ public function processRequest() {
$form->appendChild(
id(new AphrontFormSubmitControl())
- ->addCancelButton($cancel_uri, 'Cancel')
+ ->addCancelButton($cancel_uri, pht('Cancel'))
->setValue($submit_name));
$box = id(new PHUIObjectBoxView())
diff --git a/src/applications/releeph/differential/DifferentialReleephRequestFieldSpecification.php b/src/applications/releeph/differential/DifferentialReleephRequestFieldSpecification.php
index 6e635ee4b3..33ae0acc96 100644
--- a/src/applications/releeph/differential/DifferentialReleephRequestFieldSpecification.php
+++ b/src/applications/releeph/differential/DifferentialReleephRequestFieldSpecification.php
@@ -59,16 +59,20 @@ public function getRequiredHandlePHIDs() {
}
public function renderValueForRevisionView() {
- static $tense = array(
- self::ACTION_PICKS => array(
- 'future' => 'Will pick',
- 'past' => 'Picked',
- ),
- self::ACTION_REVERTS => array(
- 'future' => 'Will revert',
- 'past' => 'Reverted',
- ),
- );
+ static $tense;
+
+ if ($tense === null) {
+ $tense = array(
+ self::ACTION_PICKS => array(
+ 'future' => pht('Will pick'),
+ 'past' => pht('Picked'),
+ ),
+ self::ACTION_REVERTS => array(
+ 'future' => pht('Will revert'),
+ 'past' => pht('Reverted'),
+ ),
+ );
+ }
$releeph_requests = $this->loadReleephRequests();
if (!$releeph_requests) {
@@ -166,7 +170,9 @@ public function parseValueFromCommitMessage($value) {
default:
throw new DifferentialFieldParseException(
- "Commit message contains unknown Releeph action '{$raw_action}'!");
+ pht(
+ "Commit message contains unknown Releeph action '%s'!",
+ $raw_action));
break;
}
@@ -176,8 +182,10 @@ public function parseValueFromCommitMessage($value) {
if (!preg_match('/^(?:RQ)?(\d+)$/i', $token, $match)) {
$label = $this->renderLabelForCommitMessage();
throw new DifferentialFieldParseException(
- "Commit message contains unparseable ".
- "Releeph request token '{$token}'!");
+ pht(
+ "Commit message contains unparseable ".
+ "Releeph request token '%s'!",
+ $token));
}
$id = (int)$match[1];
@@ -185,7 +193,9 @@ public function parseValueFromCommitMessage($value) {
if (!$releeph_request) {
throw new DifferentialFieldParseException(
- "Commit message references non existent releeph request: {$value}!");
+ pht(
+ 'Commit message references non existent Releeph request: %s!',
+ $value));
}
$releeph_requests[] = $releeph_request;
@@ -201,7 +211,9 @@ public function parseValueFromCommitMessage($value) {
if (idx($rqs_seen, $rq_id)) {
throw new DifferentialFieldParseException(
- "Commit message refers to {$rq_id} multiple times!");
+ pht(
+ 'Commit message refers to %s multiple times!',
+ $rq_id));
}
$rqs_seen[$rq_id] = true;
@@ -217,9 +229,10 @@ public function parseValueFromCommitMessage($value) {
$lists[] = implode(', ', $rq_ids).' in '.$branch_name;
}
throw new DifferentialFieldParseException(
- 'Commit message references multiple Releeph requests, '.
- 'but the requests are in different branches: '.
- implode('; ', $lists));
+ pht(
+ 'Commit message references multiple Releeph requests, '.
+ 'but the requests are in different branches: %s',
+ implode('; ', $lists)));
}
}
@@ -240,9 +253,10 @@ public function shouldAppearOnCommitMessageTemplate() {
return false;
}
- public function didParseCommit(PhabricatorRepository $repo,
- PhabricatorRepositoryCommit $commit,
- PhabricatorRepositoryCommitData $data) {
+ public function didParseCommit(
+ PhabricatorRepository $repo,
+ PhabricatorRepositoryCommit $commit,
+ PhabricatorRepositoryCommitData $data) {
// NOTE: This is currently dead code. See T2222.
@@ -305,9 +319,10 @@ private function loadReleephRequests() {
->execute();
}
- private function isCommitOnBranch(PhabricatorRepository $repo,
- PhabricatorRepositoryCommit $commit,
- ReleephBranch $releeph_branch) {
+ private function isCommitOnBranch(
+ PhabricatorRepository $repo,
+ PhabricatorRepositoryCommit $commit,
+ ReleephBranch $releeph_branch) {
switch ($repo->getVersionControlSystem()) {
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
@@ -352,7 +367,7 @@ private function isCommitOnBranch(PhabricatorRepository $repo,
}
if ($in_branch && $ex_branch) {
- $error = sprintf(
+ $error = pht(
'CONFUSION: commit %s in %s contains %d path change(s) that were '.
'part of a Releeph branch, but also has %d path change(s) not '.
'part of a Releeph branch!',
diff --git a/src/applications/releeph/editor/ReleephBranchEditor.php b/src/applications/releeph/editor/ReleephBranchEditor.php
index e2cb81ce7e..0bc084223b 100644
--- a/src/applications/releeph/editor/ReleephBranchEditor.php
+++ b/src/applications/releeph/editor/ReleephBranchEditor.php
@@ -15,9 +15,10 @@ public function setReleephBranch(ReleephBranch $branch) {
return $this;
}
- public function newBranchFromCommit(PhabricatorRepositoryCommit $cut_point,
- $branch_date,
- $symbolic_name = null) {
+ public function newBranchFromCommit(
+ PhabricatorRepositoryCommit $cut_point,
+ $branch_date,
+ $symbolic_name = null) {
$template = $this->releephProject->getDetail('branchTemplate');
if (!$template) {
diff --git a/src/applications/releeph/editor/ReleephRequestTransactionalEditor.php b/src/applications/releeph/editor/ReleephRequestTransactionalEditor.php
index 993079c506..8f6805e661 100644
--- a/src/applications/releeph/editor/ReleephRequestTransactionalEditor.php
+++ b/src/applications/releeph/editor/ReleephRequestTransactionalEditor.php
@@ -299,10 +299,13 @@ private function setInBranchFromAction(
$type = $xaction->getTransactionType();
$new = $xaction->getNewValue();
phlog(
- "Unknown discovery action '{$action}' ".
- "for xaction of type {$type} ".
- "with new value {$new} ".
- "mentioning RQ{$id}!");
+ pht(
+ "Unknown discovery action '%s' for xaction of type %s ".
+ "with new value %s mentioning %s!",
+ $action,
+ $type,
+ $new,
+ 'RQ'.$id));
break;
}
}
diff --git a/src/applications/releeph/field/selector/ReleephFieldSelector.php b/src/applications/releeph/field/selector/ReleephFieldSelector.php
index 68a9f4d74d..95f22d0fe1 100644
--- a/src/applications/releeph/field/selector/ReleephFieldSelector.php
+++ b/src/applications/releeph/field/selector/ReleephFieldSelector.php
@@ -26,14 +26,17 @@ protected static function selectFields(array $fields, array $classes) {
$field = idx($map, $class);
if (!$field) {
throw new Exception(
- "Tried to select a in instance of '{$class}' but that field ".
- "is not configured for this project!");
+ pht(
+ "Tried to select a in instance of '%s' but that field ".
+ "is not configured for this project!",
+ $class));
}
if (idx($result, $class)) {
throw new Exception(
- "You have asked to select the field '{$class}' ".
- "more than once!");
+ pht(
+ "You have asked to select the field '%s' more than once!",
+ $class));
}
$result[$class] = $field;
diff --git a/src/applications/releeph/field/specification/ReleephDependsOnFieldSpecification.php b/src/applications/releeph/field/specification/ReleephDependsOnFieldSpecification.php
index 8321203688..acb5d7d11d 100644
--- a/src/applications/releeph/field/specification/ReleephDependsOnFieldSpecification.php
+++ b/src/applications/releeph/field/specification/ReleephDependsOnFieldSpecification.php
@@ -2,6 +2,7 @@
final class ReleephDependsOnFieldSpecification
extends ReleephFieldSpecification {
+
public function getFieldKey() {
return 'dependsOn';
}
diff --git a/src/applications/releeph/field/specification/ReleephDiffChurnFieldSpecification.php b/src/applications/releeph/field/specification/ReleephDiffChurnFieldSpecification.php
index 026392a1bc..18c3c78c87 100644
--- a/src/applications/releeph/field/specification/ReleephDiffChurnFieldSpecification.php
+++ b/src/applications/releeph/field/specification/ReleephDiffChurnFieldSpecification.php
@@ -13,7 +13,7 @@ public function getFieldKey() {
}
public function getName() {
- return 'Churn';
+ return pht('Churn');
}
public function renderPropertyViewValue(array $handles) {
@@ -56,7 +56,7 @@ public function renderPropertyViewValue(array $handles) {
if ($points === 0) {
$points = 0.15 * self::MAX_POINTS;
- $blurb = 'Silent diff';
+ $blurb = pht('Silent diff');
} else {
$parts = array();
if ($rejections) {
@@ -75,7 +75,7 @@ public function renderPropertyViewValue(array $handles) {
$blurb = head($parts);
} else {
$last = array_pop($parts);
- $blurb = implode(', ', $parts).' and '.$last;
+ $blurb = pht('%s and %s', implode(', ', $parts), $last);
}
}
diff --git a/src/applications/releeph/field/specification/ReleephDiffSizeFieldSpecification.php b/src/applications/releeph/field/specification/ReleephDiffSizeFieldSpecification.php
index 671511deb0..fe1a39277c 100644
--- a/src/applications/releeph/field/specification/ReleephDiffSizeFieldSpecification.php
+++ b/src/applications/releeph/field/specification/ReleephDiffSizeFieldSpecification.php
@@ -12,7 +12,7 @@ public function getFieldKey() {
}
public function getName() {
- return 'Size';
+ return pht('Size');
}
public function renderPropertyViewValue(array $handles) {
@@ -50,10 +50,10 @@ public function renderPropertyViewValue(array $handles) {
Javelin::initBehavior('phabricator-tooltips');
require_celerity_resource('aphront-tooltip-css');
- $test_blurb =
- pht('%d line(s)', $mr_changes['tests']['lines']).' and '.
- pht('%d path(s)', count($mr_changes['tests']['paths'])).
- " contain changes to test code:\n";
+ $test_blurb = pht(
+ "%d line(s) and %d path(s) contain changes to test code:\n",
+ $mr_changes['tests']['lines'],
+ count($mr_changes['tests']['paths']));
foreach ($mr_changes['tests']['paths'] as $mr_test_path) {
$test_blurb .= pht("%s\n", $mr_test_path);
}
@@ -73,9 +73,11 @@ public function renderPropertyViewValue(array $handles) {
}
$blurb = hsprintf('%s%s.',
- pht('%d line(s)', $mr_changes['code']['lines']).' and '.
- pht('%d path(s)', count($mr_changes['code']['paths'])).' over '.
- pht('%d diff(s)', count($diffs)),
+ pht(
+ '%d line(s) and %d path(s) over %d diff(s)',
+ $mr_changes['code']['lines'],
+ $mr_changes['code']['paths'],
+ count($diffs)),
$test_tag);
return id(new AphrontProgressBarView())
diff --git a/src/applications/releeph/field/specification/ReleephFieldSpecification.php b/src/applications/releeph/field/specification/ReleephFieldSpecification.php
index b0017f1b40..c0cb64b05d 100644
--- a/src/applications/releeph/field/specification/ReleephFieldSpecification.php
+++ b/src/applications/releeph/field/specification/ReleephFieldSpecification.php
@@ -48,8 +48,7 @@ public function getRequiredStorageKey() {
* Storage keys are reused for form controls, and periods in form control
* names break HTML forms.
*/
- throw new Exception(
- "You can't use '.' in storage keys!");
+ throw new Exception(pht("You can't use '%s' in storage keys!", '.'));
}
return $key;
}
diff --git a/src/applications/releeph/field/specification/ReleephIntentFieldSpecification.php b/src/applications/releeph/field/specification/ReleephIntentFieldSpecification.php
index bae7da14c2..4d199f26cc 100644
--- a/src/applications/releeph/field/specification/ReleephIntentFieldSpecification.php
+++ b/src/applications/releeph/field/specification/ReleephIntentFieldSpecification.php
@@ -83,11 +83,11 @@ public function shouldAppearOnRevertMessage() {
}
public function renderLabelForCommitMessage() {
- return 'Approved By';
+ return pht('Approved By');
}
public function renderLabelForRevertMessage() {
- return 'Rejected By';
+ return pht('Rejected By');
}
public function renderValueForCommitMessage() {
@@ -120,13 +120,13 @@ private function renderIntentsForCommitMessage($print_intent) {
if ($is_pusher) {
if ($is_requestor) {
- $token = "{$name} (pusher and requestor)";
+ $token = pht('%s (pusher and requestor)', $name);
} else {
$token = "{$name} (pusher)";
}
} else {
if ($is_requestor) {
- $token = "{$name} (requestor)";
+ $token = pht('%s (requestor)', $name);
} else {
$token = $name;
}
diff --git a/src/applications/releeph/field/specification/ReleephLevelFieldSpecification.php b/src/applications/releeph/field/specification/ReleephLevelFieldSpecification.php
index 70ae446f95..a686eb15c4 100644
--- a/src/applications/releeph/field/specification/ReleephLevelFieldSpecification.php
+++ b/src/applications/releeph/field/specification/ReleephLevelFieldSpecification.php
@@ -79,7 +79,7 @@ public function validate($value) {
$label = $this->getName();
throw new ReleephFieldParseException(
$this,
- "You must provide a {$label} level");
+ pht('You must provide a %s level.', $label));
}
$levels = $this->getLevels();
@@ -87,7 +87,10 @@ public function validate($value) {
$label = $this->getName();
throw new ReleephFieldParseException(
$this,
- "Level '{$value}' is not a valid {$label} level in this project.");
+ pht(
+ "Level '%s' is not a valid %s level in this project.",
+ $value,
+ $label));
}
}
@@ -101,8 +104,9 @@ public function setValueFromConduitAPIRequest(ConduitAPIRequest $request) {
if (!$level) {
throw new ReleephFieldParseException(
$this,
- "No value given for {$label}, ".
- "and no default is given for this level!");
+ pht(
+ 'No value given for %s, and no default is given for this level!',
+ $label));
}
} else {
$level = $this->getLevelByName($name);
@@ -111,7 +115,7 @@ public function setValueFromConduitAPIRequest(ConduitAPIRequest $request) {
if (!$level) {
throw new ReleephFieldParseException(
$this,
- "Unknown {$label} level name '{$name}'");
+ pht("Unknown %s level name '%s'", $label, $name));
}
$this->setValue($level);
}
diff --git a/src/applications/releeph/field/specification/ReleephReasonFieldSpecification.php b/src/applications/releeph/field/specification/ReleephReasonFieldSpecification.php
index d8312283ce..831e1d60a3 100644
--- a/src/applications/releeph/field/specification/ReleephReasonFieldSpecification.php
+++ b/src/applications/releeph/field/specification/ReleephReasonFieldSpecification.php
@@ -8,7 +8,7 @@ public function getFieldKey() {
}
public function getName() {
- return 'Reason';
+ return pht('Reason');
}
public function getStorageKey() {
@@ -36,7 +36,7 @@ public function renderPropertyViewValue(array $handles) {
public function renderEditControl(array $handles) {
return id(new AphrontFormTextAreaControl())
- ->setLabel('Reason')
+ ->setLabel(pht('Reason'))
->setName('reason')
->setError($this->error)
->setValue($this->getValue());
@@ -47,14 +47,14 @@ public function validate($reason) {
$this->error = 'Required';
throw new ReleephFieldParseException(
$this,
- 'You must give a reason for your request.');
+ pht('You must give a reason for your request.'));
}
}
public function renderHelpForArcanist() {
- $text =
+ $text = pht(
"Fully explain why you are requesting this code be included ".
- "in the next release.\n";
+ "in the next release.\n");
return phutil_console_wrap($text, 8);
}
@@ -63,7 +63,7 @@ public function shouldAppearOnCommitMessage() {
}
public function renderLabelForCommitMessage() {
- return 'Request Reason';
+ return pht('Request Reason');
}
public function renderValueForCommitMessage() {
diff --git a/src/applications/releeph/field/specification/ReleephRequestorFieldSpecification.php b/src/applications/releeph/field/specification/ReleephRequestorFieldSpecification.php
index 03fb88e955..d479bb8020 100644
--- a/src/applications/releeph/field/specification/ReleephRequestorFieldSpecification.php
+++ b/src/applications/releeph/field/specification/ReleephRequestorFieldSpecification.php
@@ -8,7 +8,7 @@ public function getFieldKey() {
}
public function getName() {
- return 'Requestor';
+ return pht('Requestor');
}
public function getRequiredHandlePHIDsForPropertyView() {
@@ -35,7 +35,7 @@ public function shouldAppearOnRevertMessage() {
}
public function renderLabelForCommitMessage() {
- return 'Requested By';
+ return pht('Requested By');
}
public function renderValueForCommitMessage() {
diff --git a/src/applications/releeph/field/specification/ReleephRevisionFieldSpecification.php b/src/applications/releeph/field/specification/ReleephRevisionFieldSpecification.php
index f9aa6fd2a1..45f6bdd7e1 100644
--- a/src/applications/releeph/field/specification/ReleephRevisionFieldSpecification.php
+++ b/src/applications/releeph/field/specification/ReleephRevisionFieldSpecification.php
@@ -8,7 +8,7 @@ public function getFieldKey() {
}
public function getName() {
- return 'Revision';
+ return pht('Revision');
}
public function getRequiredHandlePHIDsForPropertyView() {
diff --git a/src/applications/releeph/field/specification/ReleephSeverityFieldSpecification.php b/src/applications/releeph/field/specification/ReleephSeverityFieldSpecification.php
index 07fa55de65..18beb35a10 100644
--- a/src/applications/releeph/field/specification/ReleephSeverityFieldSpecification.php
+++ b/src/applications/releeph/field/specification/ReleephSeverityFieldSpecification.php
@@ -38,12 +38,15 @@ public function getNameForLevel($level) {
}
public function getDescriptionForLevel($level) {
- static $descriptions = array(
- self::HOTFIX =>
- 'Needs merging and fixing right now.',
- self::RELEASE =>
- 'Required for the currently rolling release.',
- );
+ static $descriptions;
+
+ if ($descriptions === null) {
+ $descriptions = array(
+ self::HOTFIX => pht('Needs merging and fixing right now.'),
+ self::RELEASE => pht('Required for the currently rolling release.'),
+ );
+ }
+
return idx($descriptions, $level);
}
diff --git a/src/applications/releeph/field/specification/ReleephSummaryFieldSpecification.php b/src/applications/releeph/field/specification/ReleephSummaryFieldSpecification.php
index a4f1e1bdd3..84767bcf6b 100644
--- a/src/applications/releeph/field/specification/ReleephSummaryFieldSpecification.php
+++ b/src/applications/releeph/field/specification/ReleephSummaryFieldSpecification.php
@@ -29,22 +29,22 @@ public function renderEditControl(array $handles) {
->setName('summary')
->setError($this->error)
->setValue($this->getValue())
- ->setCaption(
- 'Leave this blank to use the original commit title');
+ ->setCaption(pht('Leave this blank to use the original commit title'));
}
public function renderHelpForArcanist() {
- $text =
+ $text = pht(
"A one-line title summarizing this request. ".
- "Leave blank to use the original commit title.\n";
+ 'Leave blank to use the original commit title.')."\n";
return phutil_console_wrap($text, 8);
}
public function validate($summary) {
if ($summary && strlen($summary) > self::MAX_SUMMARY_LENGTH) {
- $this->error = 'Too long!';
+ $this->error = pht('Too long!');
throw new ReleephFieldParseException(
- $this, sprintf(
+ $this,
+ pht(
'Please keep your summary to under %d characters.',
self::MAX_SUMMARY_LENGTH));
}
diff --git a/src/applications/releeph/mail/ReleephRequestReplyHandler.php b/src/applications/releeph/mail/ReleephRequestReplyHandler.php
index a0a049379d..9648941941 100644
--- a/src/applications/releeph/mail/ReleephRequestReplyHandler.php
+++ b/src/applications/releeph/mail/ReleephRequestReplyHandler.php
@@ -5,7 +5,7 @@ final class ReleephRequestReplyHandler
public function validateMailReceiver($mail_receiver) {
if (!($mail_receiver instanceof ReleephRequest)) {
- throw new Exception('Mail receiver is not a ReleephRequest!');
+ throw new Exception(pht('Mail receiver is not a %s!', 'ReleephRequest'));
}
}
diff --git a/src/applications/releeph/query/ReleephBranchQuery.php b/src/applications/releeph/query/ReleephBranchQuery.php
index 201c2653d0..9d7c884012 100644
--- a/src/applications/releeph/query/ReleephBranchQuery.php
+++ b/src/applications/releeph/query/ReleephBranchQuery.php
@@ -137,7 +137,7 @@ protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
'isActive = 1');
break;
default:
- throw new Exception("Unknown status constant '{$status}'!");
+ throw new Exception(pht("Unknown status constant '%s'!", $status));
}
$where[] = $this->buildPagingClause($conn_r);
diff --git a/src/applications/releeph/query/ReleephProductQuery.php b/src/applications/releeph/query/ReleephProductQuery.php
index 6fe2b90db3..acfc39c1c2 100644
--- a/src/applications/releeph/query/ReleephProductQuery.php
+++ b/src/applications/releeph/query/ReleephProductQuery.php
@@ -8,8 +8,6 @@ final class ReleephProductQuery
private $phids;
private $repositoryPHIDs;
- private $needArcanistProjects;
-
const ORDER_ID = 'order-id';
const ORDER_NAME = 'order-name';
@@ -47,11 +45,6 @@ public function withRepositoryPHIDs(array $repository_phids) {
return $this;
}
- public function needArcanistProjects($need) {
- $this->needArcanistProjects = $need;
- return $this;
- }
-
protected function loadPage() {
$table = new ReleephProject();
$conn_r = $table->establishConnection('r');
@@ -90,27 +83,6 @@ protected function willFilterPage(array $projects) {
return $projects;
}
- protected function didFilterPage(array $products) {
- if ($this->needArcanistProjects) {
- $project_ids = array_filter(mpull($products, 'getArcanistProjectID'));
- if ($project_ids) {
- $projects = id(new PhabricatorRepositoryArcanistProject())
- ->loadAllWhere('id IN (%Ld)', $project_ids);
- $projects = mpull($projects, null, 'getID');
- } else {
- $projects = array();
- }
-
- foreach ($products as $product) {
- $project_id = $product->getArcanistProjectID();
- $project = idx($projects, $project_id);
- $product->attachArcanistProject($project);
- }
- }
-
- return $products;
- }
-
protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
$where = array();
diff --git a/src/applications/releeph/query/ReleephProductSearchEngine.php b/src/applications/releeph/query/ReleephProductSearchEngine.php
index 37aecea858..d105568bd3 100644
--- a/src/applications/releeph/query/ReleephProductSearchEngine.php
+++ b/src/applications/releeph/query/ReleephProductSearchEngine.php
@@ -21,8 +21,7 @@ public function buildSavedQueryFromRequest(AphrontRequest $request) {
public function buildQueryFromSavedQuery(PhabricatorSavedQuery $saved) {
$query = id(new ReleephProductQuery())
- ->setOrder(ReleephProductQuery::ORDER_NAME)
- ->needArcanistProjects(true);
+ ->setOrder(ReleephProductQuery::ORDER_NAME);
$active = $saved->getParameter('active');
$value = idx($this->getActiveValues(), $active);
@@ -119,11 +118,6 @@ protected function renderResultList(
),
'r'.$repo->getCallsign()));
- $arc = $product->getArcanistProject();
- if ($arc) {
- $item->addAttribute($arc->getName());
- }
-
$list->addItem($item);
}
diff --git a/src/applications/releeph/query/ReleephRequestQuery.php b/src/applications/releeph/query/ReleephRequestQuery.php
index 1a5965ad43..363a3b05d6 100644
--- a/src/applications/releeph/query/ReleephRequestQuery.php
+++ b/src/applications/releeph/query/ReleephRequestQuery.php
@@ -236,7 +236,7 @@ private function getKeepStatusConstants() {
ReleephRequestStatus::REVERTED,
);
default:
- throw new Exception("Unknown status '{$this->status}'!");
+ throw new Exception(pht("Unknown status '%s'!", $this->status));
}
}
diff --git a/src/applications/releeph/storage/ReleephProject.php b/src/applications/releeph/storage/ReleephProject.php
index ae34894658..4dd91b38ab 100644
--- a/src/applications/releeph/storage/ReleephProject.php
+++ b/src/applications/releeph/storage/ReleephProject.php
@@ -35,6 +35,7 @@ protected function getConfiguration() {
'name' => 'text128',
'trunkBranch' => 'text255',
'isActive' => 'bool',
+ 'arcanistProjectID' => 'id?',
),
self::CONFIG_KEY_SCHEMA => array(
'projectName' => array(
diff --git a/src/applications/releeph/storage/ReleephRequest.php b/src/applications/releeph/storage/ReleephRequest.php
index f2b51b6d89..c071600ec7 100644
--- a/src/applications/releeph/storage/ReleephRequest.php
+++ b/src/applications/releeph/storage/ReleephRequest.php
@@ -290,7 +290,7 @@ protected function didReadData() {
}
public function setStatus($value) {
- throw new Exception('`status` is now deprecated!');
+ throw new Exception(pht('`%s` is now deprecated!', 'status'));
}
/* -( PhabricatorApplicationTransactionInterface )------------------------- */
diff --git a/src/applications/releeph/view/branch/ReleephBranchPreviewView.php b/src/applications/releeph/view/branch/ReleephBranchPreviewView.php
index d81f1f5d01..462ed73db3 100644
--- a/src/applications/releeph/view/branch/ReleephBranchPreviewView.php
+++ b/src/applications/releeph/view/branch/ReleephBranchPreviewView.php
@@ -24,7 +24,7 @@ protected function getCustomControlClass() {
protected function renderInput() {
static $required_params = array(
- 'arcProjectID',
+ 'repositoryPHID',
'projectName',
'isSymbolic',
'template',
@@ -34,16 +34,18 @@ protected function renderInput() {
foreach ($required_params as $param_name) {
if (idx($all_params, $param_name) === null) {
throw new Exception(
- "'{$param_name}' is not set as either a static or dynamic!");
+ pht(
+ "'%s' is not set as either a static or dynamic!",
+ $param_name));
}
}
$output_id = celerity_generate_unique_node_id();
Javelin::initBehavior('releeph-preview-branch', array(
- 'uri' => '/releeph/branch/preview/',
- 'outputID' => $output_id,
- 'params' => array(
+ 'uri' => '/releeph/branch/preview/',
+ 'outputID' => $output_id,
+ 'params' => array(
'static' => $this->statics,
'dynamic' => $this->dynamics,
),
diff --git a/src/applications/releeph/view/branch/ReleephBranchTemplate.php b/src/applications/releeph/view/branch/ReleephBranchTemplate.php
index 030c70f8e9..7efaaad9fb 100644
--- a/src/applications/releeph/view/branch/ReleephBranchTemplate.php
+++ b/src/applications/releeph/view/branch/ReleephBranchTemplate.php
@@ -11,7 +11,7 @@ public static function getDefaultTemplate() {
public static function getRequiredDefaultTemplate() {
$template = self::getDefaultTemplate();
if (!$template) {
- throw new Exception(sprintf(
+ throw new Exception(pht(
"Config setting '%s' must be set, ".
"or you must provide a branch-template for each project!",
self::KEY));
@@ -20,23 +20,14 @@ public static function getRequiredDefaultTemplate() {
}
public static function getFakeCommitHandleFor(
- $arc_project_id,
+ $repository_phid,
PhabricatorUser $viewer) {
- $arc_project = id(new PhabricatorRepositoryArcanistProject())
- ->load($arc_project_id);
- if (!$arc_project) {
- throw new Exception(
- "No Arc project found with id '{$arc_project_id}'!");
- }
+ $repository = id(new PhabricatorRepositoryQuery())
+ ->setViewer($viewer)
+ ->withPHIDs(array($repository_phid))
+ ->executeOne();
- $repository = null;
- if ($arc_project->getRepositoryID()) {
- $repository = id(new PhabricatorRepositoryQuery())
- ->setViewer($viewer)
- ->withIDs(array($arc_project->getRepositoryID()))
- ->executeOne();
- }
$fake_handle = 'SOFAKE';
if ($repository) {
$fake_handle = id(new PhabricatorObjectHandle())
@@ -165,7 +156,7 @@ private function interpolateInner($template, $is_symbolic) {
}
if (!$is_symbolic && !$variable_interpolations) {
- $errors[] = "Include additional interpolations that aren't static!";
+ $errors[] = pht("Include additional interpolations that aren't static!");
}
return array($name, $errors);
@@ -175,24 +166,27 @@ private function validateAsBranchName($name) {
$errors = array();
if (preg_match('{^/}', $name) || preg_match('{/$}', $name)) {
- $errors[] = "Branches cannot begin or end with '/'";
+ $errors[] = pht("Branches cannot begin or end with '%s'", '/');
}
if (preg_match('{//+}', $name)) {
- $errors[] = "Branches cannot contain multiple consective '/'";
+ $errors[] = pht("Branches cannot contain multiple consecutive '%s'", '/');
}
$parts = array_filter(explode('/', $name));
foreach ($parts as $index => $part) {
$part_error = null;
if (preg_match('{^\.}', $part) || preg_match('{\.$}', $part)) {
- $errors[] = "Path components cannot begin or end with '.'";
+ $errors[] = pht("Path components cannot begin or end with '%s'", '.');
} else if (preg_match('{^(?!\w)}', $part)) {
- $errors[] = 'Path components must begin with an alphanumeric';
+ $errors[] = pht('Path components must begin with an alphanumeric.');
} else if (!preg_match('{^\w ([\w-_%\.]* [\w-_%])?$}x', $part)) {
- $errors[] =
+ $errors[] = pht(
"Path components may only contain alphanumerics ".
- "or '-', '_', or '.'";
+ "or '%s', '%s' or '%s'.",
+ '-',
+ '_',
+ '.');
}
}
diff --git a/src/applications/remarkup/conduit/RemarkupProcessConduitAPIMethod.php b/src/applications/remarkup/conduit/RemarkupProcessConduitAPIMethod.php
index d6c0554234..f9169cd08c 100644
--- a/src/applications/remarkup/conduit/RemarkupProcessConduitAPIMethod.php
+++ b/src/applications/remarkup/conduit/RemarkupProcessConduitAPIMethod.php
@@ -11,7 +11,7 @@ public function getMethodStatus() {
}
public function getMethodDescription() {
- return 'Process text through remarkup in phabricator context.';
+ return pht('Process text through remarkup in Phabricator context.');
}
protected function defineReturnType() {
@@ -20,8 +20,8 @@ protected function defineReturnType() {
protected function defineErrorTypes() {
return array(
- 'ERR-NO-CONTENT' => 'Content may not be empty.',
- 'ERR-INVALID-ENGINE' => 'Invalid markup engine.',
+ 'ERR-NO-CONTENT' => pht('Content may not be empty.'),
+ 'ERR-INVALID-ENGINE' => pht('Invalid markup engine.'),
);
}
diff --git a/src/applications/repository/application/PhabricatorRepositoriesApplication.php b/src/applications/repository/application/PhabricatorRepositoriesApplication.php
index 534db063e7..f740d05dcd 100644
--- a/src/applications/repository/application/PhabricatorRepositoriesApplication.php
+++ b/src/applications/repository/application/PhabricatorRepositoriesApplication.php
@@ -30,10 +30,6 @@ public function getRoutes() {
return array(
'/repository/' => array(
'' => 'PhabricatorRepositoryListController',
- 'project/edit/(?P[1-9]\d*)/'
- => 'PhabricatorRepositoryArcanistProjectEditController',
- 'project/delete/(?P[1-9]\d*)/'
- => 'PhabricatorRepositoryArcanistProjectDeleteController',
),
);
}
diff --git a/src/applications/repository/conduit/RepositoryCreateConduitAPIMethod.php b/src/applications/repository/conduit/RepositoryCreateConduitAPIMethod.php
index 42df1b6d46..ad4b62104e 100644
--- a/src/applications/repository/conduit/RepositoryCreateConduitAPIMethod.php
+++ b/src/applications/repository/conduit/RepositoryCreateConduitAPIMethod.php
@@ -12,7 +12,7 @@ public function getMethodStatus() {
}
public function getMethodStatusDescription() {
- return 'Repository methods are new and subject to change.';
+ return pht('Repository methods are new and subject to change.');
}
public function getMethodDescription() {
@@ -48,12 +48,10 @@ protected function defineReturnType() {
protected function defineErrorTypes() {
return array(
- 'ERR-DUPLICATE' =>
- 'Duplicate repository callsign.',
- 'ERR-BAD-CALLSIGN' =>
- 'Callsign is required and must be ALL UPPERCASE LETTERS.',
- 'ERR-UNKNOWN-REPOSITORY-VCS' =>
- 'Unknown repository VCS type.',
+ 'ERR-DUPLICATE' => pht('Duplicate repository callsign.'),
+ 'ERR-BAD-CALLSIGN' => pht(
+ 'Callsign is required and must be ALL UPPERCASE LETTERS.'),
+ 'ERR-UNKNOWN-REPOSITORY-VCS' => pht('Unknown repository VCS type.'),
);
}
diff --git a/src/applications/repository/controller/PhabricatorRepositoryArcanistProjectDeleteController.php b/src/applications/repository/controller/PhabricatorRepositoryArcanistProjectDeleteController.php
deleted file mode 100644
index 4be5e1bfe4..0000000000
--- a/src/applications/repository/controller/PhabricatorRepositoryArcanistProjectDeleteController.php
+++ /dev/null
@@ -1,41 +0,0 @@
-id = $data['id'];
- }
-
- public function processRequest() {
-
- $arc_project =
- id(new PhabricatorRepositoryArcanistProject())->load($this->id);
- if (!$arc_project) {
- return new Aphront404Response();
- }
-
- $request = $this->getRequest();
-
- if ($request->isDialogFormPost()) {
- $arc_project->delete();
- return id(new AphrontRedirectResponse())->setURI('/repository/');
- }
-
- $dialog = new AphrontDialogView();
- $dialog
- ->setUser($request->getUser())
- ->setTitle(pht('Really delete this arcanist project?'))
- ->appendChild(pht(
- 'Really delete the "%s" arcanist project? '.
- 'This operation can not be undone.',
- $arc_project->getName()))
- ->setSubmitURI('/repository/project/delete/'.$this->id.'/')
- ->addSubmitButton(pht('Delete Arcanist Project'))
- ->addCancelButton('/repository/');
-
- return id(new AphrontDialogResponse())->setDialog($dialog);
- }
-}
diff --git a/src/applications/repository/controller/PhabricatorRepositoryArcanistProjectEditController.php b/src/applications/repository/controller/PhabricatorRepositoryArcanistProjectEditController.php
deleted file mode 100644
index a439179034..0000000000
--- a/src/applications/repository/controller/PhabricatorRepositoryArcanistProjectEditController.php
+++ /dev/null
@@ -1,85 +0,0 @@
-id = $data['id'];
- }
-
- public function processRequest() {
-
- $request = $this->getRequest();
- $user = $request->getUser();
-
- $project = id(new PhabricatorRepositoryArcanistProject())->load($this->id);
- if (!$project) {
- return new Aphront404Response();
- }
-
- $repositories = id(new PhabricatorRepositoryQuery())
- ->setViewer($user)
- ->execute();
- $repos = array(
- 0 => 'None',
- );
- foreach ($repositories as $repository) {
- $callsign = $repository->getCallsign();
- $name = $repository->getname();
- $repos[$repository->getID()] = "r{$callsign} ({$name})";
- }
- // note "None" will still be first thanks to 'r' prefix
- asort($repos);
-
- if ($request->isFormPost()) {
- $repo_id = $request->getInt('repository', 0);
- if (isset($repos[$repo_id])) {
- $project->setRepositoryID($repo_id);
- $project->save();
-
- return id(new AphrontRedirectResponse())
- ->setURI('/repository/');
- }
- }
-
- $form = id(new AphrontFormView())
- ->setUser($user)
- ->appendChild(
- id(new AphrontFormStaticControl())
- ->setLabel(pht('Name'))
- ->setValue($project->getName()))
- ->appendChild(
- id(new AphrontFormStaticControl())
- ->setLabel('PHID')
- ->setValue($project->getPHID()))
- ->appendChild(
- id(new AphrontFormSelectControl())
- ->setLabel(pht('Repository'))
- ->setOptions($repos)
- ->setName('repository')
- ->setValue($project->getRepositoryID()))
- ->appendChild(
- id(new AphrontFormSubmitControl())
- ->addCancelButton('/repository/')
- ->setValue('Save'));
-
- $panel = new PHUIObjectBoxView();
- $panel->setHeaderText(pht('Edit Arcanist Project'));
- $panel->setForm($form);
-
- $crumbs = $this->buildApplicationCrumbs();
- $crumbs->addTextCrumb(pht('Edit Project'));
-
- return $this->buildApplicationPage(
- array(
- $crumbs,
- $panel,
- ),
- array(
- 'title' => pht('Edit Project'),
- ));
- }
-
-}
diff --git a/src/applications/repository/controller/PhabricatorRepositoryListController.php b/src/applications/repository/controller/PhabricatorRepositoryListController.php
index 56e8dc37d8..202dd5977f 100644
--- a/src/applications/repository/controller/PhabricatorRepositoryListController.php
+++ b/src/applications/repository/controller/PhabricatorRepositoryListController.php
@@ -25,7 +25,7 @@ public function processRequest() {
),
pht('View in Diffusion'));
} else {
- $diffusion_link = phutil_tag('em', array(), 'Not Tracked');
+ $diffusion_link = phutil_tag('em', array(), pht('Not Tracked'));
}
$rows[] = array(
@@ -85,68 +85,6 @@ public function processRequest() {
$panel->setHeader($header);
$panel->appendChild($table);
- $projects = id(new PhabricatorRepositoryArcanistProject())->loadAll();
-
- $rows = array();
- foreach ($projects as $project) {
- $repo = idx($repos, $project->getRepositoryID());
- if ($repo) {
- $repo_name = $repo->getName();
- } else {
- $repo_name = '-';
- }
-
- $rows[] = array(
- $project->getName(),
- $repo_name,
- phutil_tag(
- 'a',
- array(
- 'href' => '/repository/project/edit/'.$project->getID().'/',
- 'class' => 'button grey small',
- ),
- pht('Edit')),
- javelin_tag(
- 'a',
- array(
- 'href' => '/repository/project/delete/'.$project->getID().'/',
- 'class' => 'button grey small',
- 'sigil' => 'workflow',
- ),
- pht('Delete')),
- );
-
- }
-
- $project_table = new AphrontTableView($rows);
- $project_table->setNoDataString(pht('No Arcanist Projects'));
- $project_table->setHeaders(
- array(
- pht('Project ID'),
- pht('Repository'),
- '',
- '',
- ));
- $project_table->setColumnClasses(
- array(
- '',
- 'wide',
- 'action',
- 'action',
- ));
-
- $project_table->setColumnVisibility(
- array(
- true,
- true,
- $is_admin,
- $is_admin,
- ));
-
- $project_panel = new PHUIObjectBoxView();
- $project_panel->setHeaderText(pht('Arcanist Projects'));
- $project_panel->appendChild($project_table);
-
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Repository List'));
@@ -154,7 +92,6 @@ public function processRequest() {
array(
$crumbs,
$panel,
- $project_panel,
),
array(
'title' => pht('Repository List'),
diff --git a/src/applications/repository/customfield/PhabricatorCommitBranchesField.php b/src/applications/repository/customfield/PhabricatorCommitBranchesField.php
index ed07a8fb29..0d430f36a6 100644
--- a/src/applications/repository/customfield/PhabricatorCommitBranchesField.php
+++ b/src/applications/repository/customfield/PhabricatorCommitBranchesField.php
@@ -7,13 +7,22 @@ public function getFieldKey() {
return 'diffusion:branches';
}
- public function shouldAppearInApplicationTransactions() {
+ public function getFieldName() {
+ return pht('Branches');
+ }
+
+ public function getFieldDescription() {
+ return pht('Shows branches a commit appears on in email.');
+ }
+
+ public function shouldAppearInTransactionMail() {
return true;
}
- public function buildApplicationTransactionMailBody(
- PhabricatorApplicationTransaction $xaction,
- PhabricatorMetaMTAMailBody $body) {
+ public function updateTransactionMailBody(
+ PhabricatorMetaMTAMailBody $body,
+ PhabricatorApplicationTransactionEditor $editor,
+ array $xactions) {
$params = array(
'contains' => $this->getObject()->getCommitIdentifier(),
diff --git a/src/applications/repository/customfield/PhabricatorCommitMergedCommitsField.php b/src/applications/repository/customfield/PhabricatorCommitMergedCommitsField.php
new file mode 100644
index 0000000000..267b440dce
--- /dev/null
+++ b/src/applications/repository/customfield/PhabricatorCommitMergedCommitsField.php
@@ -0,0 +1,74 @@
+getObject();
+
+ try {
+ $merges = DiffusionPathChange::newFromConduit(
+ id(new ConduitCall('diffusion.mergedcommitsquery', array(
+ 'commit' => $commit->getCommitIdentifier(),
+ 'limit' => $limit + 1,
+ 'callsign' => $commit->getRepository()->getCallsign(),
+ )))
+ ->setUser($this->getViewer())
+ ->execute());
+
+ if (count($merges) > $limit) {
+ $merges = array_slice($merges, 0, $limit);
+ $merges_caption =
+ pht("This commit merges more than %d changes. Only the first ".
+ "%d are shown.\n", $limit, $limit);
+ }
+
+ if ($merges) {
+ $merge_commits = array();
+ foreach ($merges as $merge) {
+ $merge_commits[] = $merge->getAuthorName().
+ ': '.
+ $merge->getSummary();
+ }
+ $body->addTextSection(
+ pht('MERGED COMMITS'),
+ $merges_caption.implode("\n", $merge_commits));
+ }
+ } catch (ConduitException $ex) {
+ // Log the exception into the email body
+ $body->addTextSection(
+ pht('MERGED COMMITS'),
+ pht('Error generating merged commits: ').$ex->getMessage());
+ }
+
+ }
+
+}
diff --git a/src/applications/repository/customfield/PhabricatorCommitRepositoryField.php b/src/applications/repository/customfield/PhabricatorCommitRepositoryField.php
new file mode 100644
index 0000000000..c600a8cb6c
--- /dev/null
+++ b/src/applications/repository/customfield/PhabricatorCommitRepositoryField.php
@@ -0,0 +1,38 @@
+getObject()->getRepository();
+
+ $body->addTextSection(
+ pht('REPOSITORY'),
+ $repository->getMonogram().' '.$repository->getName());
+ }
+
+}
diff --git a/src/applications/repository/customfield/PhabricatorCommitTagsField.php b/src/applications/repository/customfield/PhabricatorCommitTagsField.php
index 25b2a4ee4e..b69d246d85 100644
--- a/src/applications/repository/customfield/PhabricatorCommitTagsField.php
+++ b/src/applications/repository/customfield/PhabricatorCommitTagsField.php
@@ -7,13 +7,22 @@ public function getFieldKey() {
return 'diffusion:tags';
}
- public function shouldAppearInApplicationTransactions() {
+ public function getFieldName() {
+ return pht('Tags');
+ }
+
+ public function getFieldDescription() {
+ return pht('Shows commit tags in email.');
+ }
+
+ public function shouldAppearInTransactionMail() {
return true;
}
- public function buildApplicationTransactionMailBody(
- PhabricatorApplicationTransaction $xaction,
- PhabricatorMetaMTAMailBody $body) {
+ public function updateTransactionMailBody(
+ PhabricatorMetaMTAMailBody $body,
+ PhabricatorApplicationTransactionEditor $editor,
+ array $xactions) {
$params = array(
'commit' => $this->getObject()->getCommitIdentifier(),
diff --git a/src/applications/repository/daemon/PhabricatorGitGraphStream.php b/src/applications/repository/daemon/PhabricatorGitGraphStream.php
index 911e30cb52..334213048e 100644
--- a/src/applications/repository/daemon/PhabricatorGitGraphStream.php
+++ b/src/applications/repository/daemon/PhabricatorGitGraphStream.php
@@ -76,7 +76,10 @@ private function parseUntil($commit) {
}
}
- throw new Exception("No such commit '{$commit}' in repository!");
+ throw new Exception(
+ pht(
+ "No such commit '%s' in repository!",
+ $commit));
}
private function isParsed($commit) {
diff --git a/src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php b/src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php
index ff96dced3c..e2895972dd 100644
--- a/src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php
+++ b/src/applications/repository/daemon/PhabricatorRepositoryPullLocalDaemon.php
@@ -43,18 +43,18 @@ protected function run() {
array(
array(
'name' => 'no-discovery',
- 'help' => 'Pull only, without discovering commits.',
+ 'help' => pht('Pull only, without discovering commits.'),
),
array(
'name' => 'not',
'param' => 'repository',
'repeat' => true,
- 'help' => 'Do not pull __repository__.',
+ 'help' => pht('Do not pull __repository__.'),
),
array(
'name' => 'repositories',
'wildcard' => true,
- 'help' => 'Pull specific __repositories__ instead of all.',
+ 'help' => pht('Pull specific __repositories__ instead of all.'),
),
));
@@ -312,7 +312,9 @@ private function loadPullableRepositories(array $include, array $exclude) {
foreach ($include as $name) {
if (empty($by_callsign[$name])) {
throw new Exception(
- "No repository exists with callsign '{$name}'!");
+ pht(
+ "No repository exists with callsign '%s'!",
+ $name));
}
}
}
diff --git a/src/applications/repository/editor/PhabricatorRepositoryEditor.php b/src/applications/repository/editor/PhabricatorRepositoryEditor.php
index 69012bdcd2..2e769975ab 100644
--- a/src/applications/repository/editor/PhabricatorRepositoryEditor.php
+++ b/src/applications/repository/editor/PhabricatorRepositoryEditor.php
@@ -43,6 +43,7 @@ public function getTransactionTypes() {
$types[] = PhabricatorRepositoryTransaction::TYPE_SERVICE;
$types[] = PhabricatorRepositoryTransaction::TYPE_SYMBOLS_LANGUAGE;
$types[] = PhabricatorRepositoryTransaction::TYPE_SYMBOLS_SOURCES;
+ $types[] = PhabricatorRepositoryTransaction::TYPE_STAGING_URI;
$types[] = PhabricatorTransactions::TYPE_EDGE;
$types[] = PhabricatorTransactions::TYPE_VIEW_POLICY;
@@ -104,6 +105,8 @@ protected function getCustomTransactionOldValue(
return $object->getSymbolLanguages();
case PhabricatorRepositoryTransaction::TYPE_SYMBOLS_SOURCES:
return $object->getSymbolSources();
+ case PhabricatorRepositoryTransaction::TYPE_STAGING_URI:
+ return $object->getDetail('staging-uri');
}
}
@@ -139,6 +142,7 @@ protected function getCustomTransactionNewValue(
case PhabricatorRepositoryTransaction::TYPE_SERVICE:
case PhabricatorRepositoryTransaction::TYPE_SYMBOLS_LANGUAGE:
case PhabricatorRepositoryTransaction::TYPE_SYMBOLS_SOURCES:
+ case PhabricatorRepositoryTransaction::TYPE_STAGING_URI:
return $xaction->getNewValue();
case PhabricatorRepositoryTransaction::TYPE_NOTIFY:
case PhabricatorRepositoryTransaction::TYPE_AUTOCLOSE:
@@ -219,6 +223,9 @@ protected function applyCustomInternalTransaction(
case PhabricatorRepositoryTransaction::TYPE_SYMBOLS_SOURCES:
$object->setDetail('symbol-sources', $xaction->getNewValue());
return;
+ case PhabricatorRepositoryTransaction::TYPE_STAGING_URI:
+ $object->setDetail('staging-uri', $xaction->getNewValue());
+ return;
case PhabricatorRepositoryTransaction::TYPE_ENCODING:
// Make sure the encoding is valid by converting to UTF-8. This tests
// that the user has mbstring installed, and also that they didn't type
@@ -330,6 +337,7 @@ protected function requireCapabilities(
case PhabricatorRepositoryTransaction::TYPE_SERVICE:
case PhabricatorRepositoryTransaction::TYPE_SYMBOLS_SOURCES:
case PhabricatorRepositoryTransaction::TYPE_SYMBOLS_LANGUAGE:
+ case PhabricatorRepositoryTransaction::TYPE_STAGING_URI:
PhabricatorPolicyFilter::requireCapability(
$this->requireActor(),
$object,
diff --git a/src/applications/repository/engine/PhabricatorRepositoryDiscoveryEngine.php b/src/applications/repository/engine/PhabricatorRepositoryDiscoveryEngine.php
index f404f9c8a4..407940e474 100644
--- a/src/applications/repository/engine/PhabricatorRepositoryDiscoveryEngine.php
+++ b/src/applications/repository/engine/PhabricatorRepositoryDiscoveryEngine.php
@@ -49,7 +49,7 @@ public function discoverCommits() {
$refs = $this->discoverGitCommits();
break;
default:
- throw new Exception("Unknown VCS '{$vcs}'!");
+ throw new Exception(pht("Unknown VCS '%s'!", $vcs));
}
// Clear the working set cache.
@@ -571,7 +571,7 @@ private function insertTask(
$class = 'PhabricatorRepositoryMercurialCommitMessageParserWorker';
break;
default:
- throw new Exception("Unknown repository type '{$vcs}'!");
+ throw new Exception(pht("Unknown repository type '%s'!", $vcs));
}
$data['commitID'] = $commit->getID();
diff --git a/src/applications/repository/engine/PhabricatorRepositoryEngine.php b/src/applications/repository/engine/PhabricatorRepositoryEngine.php
index 300fde13e0..8d858a3d89 100644
--- a/src/applications/repository/engine/PhabricatorRepositoryEngine.php
+++ b/src/applications/repository/engine/PhabricatorRepositoryEngine.php
@@ -23,7 +23,7 @@ public function setRepository(PhabricatorRepository $repository) {
*/
protected function getRepository() {
if ($this->repository === null) {
- throw new Exception('Call setRepository() to provide a repository!');
+ throw new PhutilInvalidStateException('setRepository');
}
return $this->repository;
diff --git a/src/applications/repository/engine/PhabricatorRepositoryPullEngine.php b/src/applications/repository/engine/PhabricatorRepositoryPullEngine.php
index ffbbc7034b..d725148771 100644
--- a/src/applications/repository/engine/PhabricatorRepositoryPullEngine.php
+++ b/src/applications/repository/engine/PhabricatorRepositoryPullEngine.php
@@ -245,26 +245,31 @@ private function executeGitUpdate() {
if (is_dir($path)) {
$files = Filesystem::listDirectory($path, $include_hidden = true);
if (!$files) {
- $message =
- "Expected to find a git repository at '{$path}', but there ".
+ $message = pht(
+ "Expected to find a git repository at '%s', but there ".
"is an empty directory there. Remove the directory: the daemon ".
- "will run 'git clone' for you.";
+ "will run '%s' for you.",
+ $path,
+ 'git clone');
} else {
- $message =
- "Expected to find a git repository at '{$path}', but there is ".
+ $message = pht(
+ "Expected to find a git repository at '%s', but there is ".
"a non-repository directory (with other stuff in it) there. Move ".
"or remove this directory (or reconfigure the repository to use a ".
"different directory), and then either clone a repository ".
- "yourself or let the daemon do it.";
+ "yourself or let the daemon do it.",
+ $path);
}
} else if (is_file($path)) {
- $message =
- "Expected to find a git repository at '{$path}', but there is a ".
+ $message = pht(
+ "Expected to find a git repository at '%s', but there is a ".
"file there instead. Remove it and let the daemon clone a ".
- "repository for you.";
+ "repository for you.",
+ $path);
} else {
- $message =
- "Expected to find a git repository at '{$path}', but did not.";
+ $message = pht(
+ "Expected to find a git repository at '%s', but did not.",
+ $path);
}
} else {
$repo_path = rtrim($stdout, "\n");
@@ -277,18 +282,24 @@ private function executeGitUpdate() {
// we're OK.
} else if (!Filesystem::pathsAreEquivalent($repo_path, $path)) {
$err = true;
- $message =
- "Expected to find repo at '{$path}', but the actual ".
- "git repository root for this directory is '{$repo_path}'. ".
- "Something is misconfigured. The repository's 'Local Path' should ".
- "be set to some place where the daemon can check out a working ".
- "copy, and should not be inside another git repository.";
+ $message = pht(
+ "Expected to find repo at '%s', but the actual git repository root ".
+ "for this directory is '%s'. Something is misconfigured. ".
+ "The repository's 'Local Path' should be set to some place where ".
+ "the daemon can check out a working copy, ".
+ "and should not be inside another git repository.",
+ $path,
+ $repo_path);
}
}
if ($err && $repository->canDestroyWorkingCopy()) {
- phlog("Repository working copy at '{$path}' failed sanity check; ".
- "destroying and re-cloning. {$message}");
+ phlog(
+ pht(
+ "Repository working copy at '%s' failed sanity check; ".
+ "destroying and re-cloning. %s",
+ $path,
+ $message));
Filesystem::remove($path);
$this->executeGitCreate();
} else if ($err) {
@@ -324,9 +335,11 @@ private function executeGitUpdate() {
}
} else if ($err) {
throw new Exception(
- "git fetch failed with error #{$err}:\n".
- "stdout:{$stdout}\n\n".
- "stderr:{$stderr}\n");
+ pht(
+ "git fetch failed with error #%d:\nstdout:%s\n\nstderr:%s\n",
+ $err,
+ $stdout,
+ $stderr));
} else {
$retry = false;
}
diff --git a/src/applications/repository/engine/PhabricatorRepositoryRefEngine.php b/src/applications/repository/engine/PhabricatorRepositoryRefEngine.php
index a393a6be69..0eab00b5c9 100644
--- a/src/applications/repository/engine/PhabricatorRepositoryRefEngine.php
+++ b/src/applications/repository/engine/PhabricatorRepositoryRefEngine.php
@@ -397,7 +397,7 @@ private function setCloseFlagOnCommits(array $identifiers) {
$class = 'PhabricatorRepositoryMercurialCommitMessageParserWorker';
break;
default:
- throw new Exception("Unknown repository type '{$vcs}'!");
+ throw new Exception(pht("Unknown repository type '%s'!", $vcs));
}
$all_commits = queryfx_all(
diff --git a/src/applications/repository/engine/__tests__/PhabricatorWorkingCopyDiscoveryTestCase.php b/src/applications/repository/engine/__tests__/PhabricatorWorkingCopyDiscoveryTestCase.php
index 1e9c83da26..f912a551c5 100644
--- a/src/applications/repository/engine/__tests__/PhabricatorWorkingCopyDiscoveryTestCase.php
+++ b/src/applications/repository/engine/__tests__/PhabricatorWorkingCopyDiscoveryTestCase.php
@@ -11,7 +11,7 @@ public function testSubversionCommitDiscovery() {
1368319448,
),
mpull($refs, 'getEpoch'),
- 'Commit Epochs');
+ pht('Commit Epochs'));
}
public function testMercurialCommitDiscovery() {
diff --git a/src/applications/repository/engine/__tests__/PhabricatorWorkingCopyTestCase.php b/src/applications/repository/engine/__tests__/PhabricatorWorkingCopyTestCase.php
index 40412e45d0..5a9be99212 100644
--- a/src/applications/repository/engine/__tests__/PhabricatorWorkingCopyTestCase.php
+++ b/src/applications/repository/engine/__tests__/PhabricatorWorkingCopyTestCase.php
@@ -37,14 +37,21 @@ protected function buildBareRepository($callsign) {
if (!$hits) {
throw new Exception(
- "No test data for callsign '{$callsign}'. Expected an archive ".
- "like '{$callsign}.git.tgz' in '{$data_dir}'.");
+ pht(
+ "No test data for callsign '%s'. Expected an archive ".
+ "like '%s' in '%s'.",
+ $callsign,
+ "{$callsign}.git.tgz",
+ $data_dir));
}
if (count($hits) > 1) {
throw new Exception(
- "Expected exactly one archive matching callsign '{$callsign}', ".
- "found too many: ".implode(', ', $hits));
+ pht(
+ "Expected exactly one archive matching callsign '%s', ".
+ "found too many: %s",
+ $callsign,
+ implode(', ', $hits)));
}
$path = head($hits);
diff --git a/src/applications/repository/graphcache/PhabricatorRepositoryGraphCache.php b/src/applications/repository/graphcache/PhabricatorRepositoryGraphCache.php
index f1e5aff4ef..5c3081a7b7 100644
--- a/src/applications/repository/graphcache/PhabricatorRepositoryGraphCache.php
+++ b/src/applications/repository/graphcache/PhabricatorRepositoryGraphCache.php
@@ -106,7 +106,7 @@ public function loadLastModifiedCommitID($commit_id, $path_id, $time = 0.5) {
// Sanity check so we can survive and recover from bad data.
if (isset($seen[$commit_id])) {
- phlog(pht('Unexpected infinite loop in RepositoryGraphCache!'));
+ phlog(pht('Unexpected infinite loop in %s!', __CLASS__));
return false;
} else {
$seen[$commit_id] = true;
diff --git a/src/applications/repository/management/PhabricatorRepositoryManagementCacheWorkflow.php b/src/applications/repository/management/PhabricatorRepositoryManagementCacheWorkflow.php
index b34e430ff4..a78dff1a73 100644
--- a/src/applications/repository/management/PhabricatorRepositoryManagementCacheWorkflow.php
+++ b/src/applications/repository/management/PhabricatorRepositoryManagementCacheWorkflow.php
@@ -29,14 +29,18 @@ public function execute(PhutilArgumentParser $args) {
$commit_name = $args->getArg('commit');
if ($commit_name === null) {
throw new PhutilArgumentUsageException(
- pht('Specify a commit to look up with `--commit`.'));
+ pht(
+ 'Specify a commit to look up with `%s`.',
+ '--commit'));
}
$commit = $this->loadNamedCommit($commit_name);
$path_name = $args->getArg('path');
if ($path_name === null) {
throw new PhutilArgumentUsageException(
- pht('Specify a path to look up with `--path`.'));
+ pht(
+ 'Specify a path to look up with `%s`.',
+ '--path'));
}
$path_map = id(new DiffusionPathIDQuery(array($path_name)))
@@ -62,9 +66,7 @@ public function execute(PhutilArgumentParser $args) {
pht('Query took %s ms.', new PhutilNumber(1000 * ($t_end - $t_start))));
if ($cache_result === false) {
- $console->writeOut(
- "%s\n",
- pht('Not found in graph cache.'));
+ $console->writeOut("%s\n", pht('Not found in graph cache.'));
} else if ($cache_result === null) {
$console->writeOut(
"%s\n",
diff --git a/src/applications/repository/management/PhabricatorRepositoryManagementDiscoverWorkflow.php b/src/applications/repository/management/PhabricatorRepositoryManagementDiscoverWorkflow.php
index 66d9a22fec..526348d150 100644
--- a/src/applications/repository/management/PhabricatorRepositoryManagementDiscoverWorkflow.php
+++ b/src/applications/repository/management/PhabricatorRepositoryManagementDiscoverWorkflow.php
@@ -7,17 +7,17 @@ protected function didConstruct() {
$this
->setName('discover')
->setExamples('**discover** [__options__] __repository__ ...')
- ->setSynopsis('Discover __repository__, named by callsign.')
+ ->setSynopsis(pht('Discover __repository__, named by callsign.'))
->setArguments(
array(
array(
'name' => 'verbose',
- 'help' => 'Show additional debugging information.',
+ 'help' => pht('Show additional debugging information.'),
),
array(
'name' => 'repair',
- 'help' => 'Repair a repository with gaps in commit '.
- 'history.',
+ 'help' => pht(
+ 'Repair a repository with gaps in commit history.'),
),
array(
'name' => 'repos',
@@ -31,12 +31,14 @@ public function execute(PhutilArgumentParser $args) {
if (!$repos) {
throw new PhutilArgumentUsageException(
- 'Specify one or more repositories to discover, by callsign.');
+ pht('Specify one or more repositories to discover, by callsign.'));
}
$console = PhutilConsole::getConsole();
foreach ($repos as $repo) {
- $console->writeOut("Discovering '%s'...\n", $repo->getCallsign());
+ $console->writeOut(
+ "%s\n",
+ pht("Discovering '%s'...", $repo->getCallsign()));
id(new PhabricatorRepositoryDiscoveryEngine())
->setRepository($repo)
@@ -45,7 +47,7 @@ public function execute(PhutilArgumentParser $args) {
->discoverCommits();
}
- $console->writeOut("Done.\n");
+ $console->writeOut("%s\n", pht('Done.'));
return 0;
}
diff --git a/src/applications/repository/management/PhabricatorRepositoryManagementEditWorkflow.php b/src/applications/repository/management/PhabricatorRepositoryManagementEditWorkflow.php
index ac7a7c6b07..d42ecf9526 100644
--- a/src/applications/repository/management/PhabricatorRepositoryManagementEditWorkflow.php
+++ b/src/applications/repository/management/PhabricatorRepositoryManagementEditWorkflow.php
@@ -7,7 +7,7 @@ protected function didConstruct() {
$this
->setName('edit')
->setExamples('**edit** --as __username__ __repository__ ...')
- ->setSynopsis('Edit __repository__, named by callsign.')
+ ->setSynopsis(pht('Edit __repository__, named by callsign.'))
->setArguments(
array(
array(
@@ -17,12 +17,12 @@ protected function didConstruct() {
array(
'name' => 'as',
'param' => 'user',
- 'help' => 'Edit as user.',
+ 'help' => pht('Edit as user.'),
),
array(
'name' => 'local-path',
'param' => 'path',
- 'help' => 'Edit the local path.',
+ 'help' => pht('Edit the local path.'),
),
));
}
@@ -32,7 +32,7 @@ public function execute(PhutilArgumentParser $args) {
if (!$repos) {
throw new PhutilArgumentUsageException(
- 'Specify one or more repositories to edit, by callsign.');
+ pht('Specify one or more repositories to edit, by callsign.'));
}
$console = PhutilConsole::getConsole();
@@ -47,7 +47,9 @@ public function execute(PhutilArgumentParser $args) {
$username = $args->getArg('as');
if (!$username) {
throw new PhutilArgumentUsageException(
- pht('Specify a user to edit as with --as .'));
+ pht(
+ 'Specify a user to edit as with %s.',
+ '--as '));
}
$actor = id(new PhabricatorPeopleQuery())
@@ -61,7 +63,7 @@ public function execute(PhutilArgumentParser $args) {
}
foreach ($repos as $repo) {
- $console->writeOut("Editing '%s'...\n", $repo->getCallsign());
+ $console->writeOut("%s\n", pht("Editing '%s'...", $repo->getCallsign()));
$xactions = array();
@@ -88,7 +90,7 @@ public function execute(PhutilArgumentParser $args) {
->applyTransactions($repo, $xactions);
}
- $console->writeOut("Done.\n");
+ $console->writeOut("%s\n", pht('Done.'));
return 0;
}
diff --git a/src/applications/repository/management/PhabricatorRepositoryManagementImportingWorkflow.php b/src/applications/repository/management/PhabricatorRepositoryManagementImportingWorkflow.php
index d895b07ae6..7fabffe7bd 100644
--- a/src/applications/repository/management/PhabricatorRepositoryManagementImportingWorkflow.php
+++ b/src/applications/repository/management/PhabricatorRepositoryManagementImportingWorkflow.php
@@ -8,13 +8,14 @@ protected function didConstruct() {
->setName('importing')
->setExamples('**importing** __repository__ ...')
->setSynopsis(
- 'Show commits in __repository__, named by callsign, which are still '.
- 'importing.')
+ pht(
+ 'Show commits in __repository__, named by callsign, which are '.
+ 'still importing.'))
->setArguments(
array(
array(
'name' => 'simple',
- 'help' => 'Show simpler output.',
+ 'help' => pht('Show simpler output.'),
),
array(
'name' => 'repos',
@@ -28,8 +29,9 @@ public function execute(PhutilArgumentParser $args) {
if (!$repos) {
throw new PhutilArgumentUsageException(
- 'Specify one or more repositories to find importing commits for, '.
- 'by callsign.');
+ pht(
+ 'Specify one or more repositories to find importing commits for, '.
+ 'by callsign.'));
}
$repos = mpull($repos, null, 'getID');
diff --git a/src/applications/repository/management/PhabricatorRepositoryManagementListWorkflow.php b/src/applications/repository/management/PhabricatorRepositoryManagementListWorkflow.php
index 9d584af738..a663142987 100644
--- a/src/applications/repository/management/PhabricatorRepositoryManagementListWorkflow.php
+++ b/src/applications/repository/management/PhabricatorRepositoryManagementListWorkflow.php
@@ -6,7 +6,7 @@ final class PhabricatorRepositoryManagementListWorkflow
protected function didConstruct() {
$this
->setName('list')
- ->setSynopsis('Show a list of repositories.')
+ ->setSynopsis(pht('Show a list of repositories.'))
->setArguments(array());
}
@@ -21,7 +21,7 @@ public function execute(PhutilArgumentParser $args) {
$console->writeOut("%s\n", $repo->getCallsign());
}
} else {
- $console->writeErr("%s\n", 'There are no repositories.');
+ $console->writeErr("%s\n", pht('There are no repositories.'));
}
return 0;
diff --git a/src/applications/repository/management/PhabricatorRepositoryManagementLookupUsersWorkflow.php b/src/applications/repository/management/PhabricatorRepositoryManagementLookupUsersWorkflow.php
index e4f03a4d1b..949fd96141 100644
--- a/src/applications/repository/management/PhabricatorRepositoryManagementLookupUsersWorkflow.php
+++ b/src/applications/repository/management/PhabricatorRepositoryManagementLookupUsersWorkflow.php
@@ -7,7 +7,8 @@ protected function didConstruct() {
$this
->setName('lookup-users')
->setExamples('**lookup-users** __commit__ ...')
- ->setSynopsis('Resolve user accounts for users attached to __commit__.')
+ ->setSynopsis(
+ pht('Resolve user accounts for users attached to __commit__.'))
->setArguments(
array(
array(
@@ -21,7 +22,7 @@ public function execute(PhutilArgumentParser $args) {
$commits = $this->loadCommits($args, 'commits');
if (!$commits) {
throw new PhutilArgumentUsageException(
- 'Specify one or more commits to resolve users for.');
+ pht('Specify one or more commits to resolve users for.'));
}
$console = PhutilConsole::getConsole();
diff --git a/src/applications/repository/management/PhabricatorRepositoryManagementMarkImportedWorkflow.php b/src/applications/repository/management/PhabricatorRepositoryManagementMarkImportedWorkflow.php
index 411a3e10c1..fb14261df0 100644
--- a/src/applications/repository/management/PhabricatorRepositoryManagementMarkImportedWorkflow.php
+++ b/src/applications/repository/management/PhabricatorRepositoryManagementMarkImportedWorkflow.php
@@ -7,12 +7,12 @@ protected function didConstruct() {
$this
->setName('mark-imported')
->setExamples('**mark-imported** __repository__ ...')
- ->setSynopsis('Mark __repository__, named by callsign, as imported.')
+ ->setSynopsis(pht('Mark __repository__, named by callsign, as imported.'))
->setArguments(
array(
array(
'name' => 'mark-not-imported',
- 'help' => 'Instead, mark repositories as NOT imported.',
+ 'help' => pht('Instead, mark repositories as NOT imported.'),
),
array(
'name' => 'repos',
@@ -26,7 +26,7 @@ public function execute(PhutilArgumentParser $args) {
if (!$repos) {
throw new PhutilArgumentUsageException(
- 'Specify one or more repositories to mark imported, by callsign.');
+ pht('Specify one or more repositories to mark imported, by callsign.'));
}
$new_importing_value = (bool)$args->getArg('mark-not-imported');
@@ -59,7 +59,7 @@ public function execute(PhutilArgumentParser $args) {
}
}
- $console->writeOut("Done.\n");
+ $console->writeOut("%s\n", pht('Done.'));
return 0;
}
diff --git a/src/applications/repository/management/PhabricatorRepositoryManagementMirrorWorkflow.php b/src/applications/repository/management/PhabricatorRepositoryManagementMirrorWorkflow.php
index 243ae640a8..4a4c732558 100644
--- a/src/applications/repository/management/PhabricatorRepositoryManagementMirrorWorkflow.php
+++ b/src/applications/repository/management/PhabricatorRepositoryManagementMirrorWorkflow.php
@@ -28,8 +28,7 @@ public function execute(PhutilArgumentParser $args) {
if (!$repos) {
throw new PhutilArgumentUsageException(
pht(
- 'Specify one or more repositories to push to mirrors, by '.
- 'callsign.'));
+ 'Specify one or more repositories to push to mirrors, by callsign.'));
}
$console = PhutilConsole::getConsole();
@@ -44,7 +43,7 @@ public function execute(PhutilArgumentParser $args) {
->pushToMirrors();
}
- $console->writeOut("Done.\n");
+ $console->writeOut('%s\b', pht('Done.'));
return 0;
}
diff --git a/src/applications/repository/management/PhabricatorRepositoryManagementPullWorkflow.php b/src/applications/repository/management/PhabricatorRepositoryManagementPullWorkflow.php
index 4cc7605610..b58c56d46b 100644
--- a/src/applications/repository/management/PhabricatorRepositoryManagementPullWorkflow.php
+++ b/src/applications/repository/management/PhabricatorRepositoryManagementPullWorkflow.php
@@ -7,16 +7,16 @@ protected function didConstruct() {
$this
->setName('pull')
->setExamples('**pull** __repository__ ...')
- ->setSynopsis('Pull __repository__, named by callsign.')
+ ->setSynopsis(pht('Pull __repository__, named by callsign.'))
->setArguments(
array(
array(
- 'name' => 'verbose',
- 'help' => 'Show additional debugging information.',
+ 'name' => 'verbose',
+ 'help' => pht('Show additional debugging information.'),
),
array(
- 'name' => 'repos',
- 'wildcard' => true,
+ 'name' => 'repos',
+ 'wildcard' => true,
),
));
}
@@ -26,12 +26,12 @@ public function execute(PhutilArgumentParser $args) {
if (!$repos) {
throw new PhutilArgumentUsageException(
- 'Specify one or more repositories to pull, by callsign.');
+ pht('Specify one or more repositories to pull, by callsign.'));
}
$console = PhutilConsole::getConsole();
foreach ($repos as $repo) {
- $console->writeOut("Pulling '%s'...\n", $repo->getCallsign());
+ $console->writeOut("%s\n", pht("Pulling '%s'...", $repo->getCallsign()));
id(new PhabricatorRepositoryPullEngine())
->setRepository($repo)
@@ -39,7 +39,7 @@ public function execute(PhutilArgumentParser $args) {
->pullRepository();
}
- $console->writeOut("Done.\n");
+ $console->writeOut("%s\n", pht('Done.'));
return 0;
}
diff --git a/src/applications/repository/management/PhabricatorRepositoryManagementRefsWorkflow.php b/src/applications/repository/management/PhabricatorRepositoryManagementRefsWorkflow.php
index 77eb9608f2..5d5dd169e8 100644
--- a/src/applications/repository/management/PhabricatorRepositoryManagementRefsWorkflow.php
+++ b/src/applications/repository/management/PhabricatorRepositoryManagementRefsWorkflow.php
@@ -7,12 +7,12 @@ protected function didConstruct() {
$this
->setName('refs')
->setExamples('**refs** [__options__] __repository__ ...')
- ->setSynopsis('Update refs in __repository__, named by callsign.')
+ ->setSynopsis(pht('Update refs in __repository__, named by callsign.'))
->setArguments(
array(
array(
'name' => 'verbose',
- 'help' => 'Show additional debugging information.',
+ 'help' => pht('Show additional debugging information.'),
),
array(
'name' => 'repos',
@@ -33,7 +33,9 @@ public function execute(PhutilArgumentParser $args) {
$console = PhutilConsole::getConsole();
foreach ($repos as $repo) {
- $console->writeOut("Updating refs in '%s'...\n", $repo->getCallsign());
+ $console->writeOut(
+ "%s\n",
+ pht("Updating refs in '%s'...", $repo->getCallsign()));
$engine = id(new PhabricatorRepositoryRefEngine())
->setRepository($repo)
@@ -41,7 +43,7 @@ public function execute(PhutilArgumentParser $args) {
->updateRefs();
}
- $console->writeOut("Done.\n");
+ $console->writeOut("%s\n", pht('Done.'));
return 0;
}
diff --git a/src/applications/repository/management/PhabricatorRepositoryManagementReparseWorkflow.php b/src/applications/repository/management/PhabricatorRepositoryManagementReparseWorkflow.php
index 9f3aa2715c..e06c6ca089 100644
--- a/src/applications/repository/management/PhabricatorRepositoryManagementReparseWorkflow.php
+++ b/src/applications/repository/management/PhabricatorRepositoryManagementReparseWorkflow.php
@@ -7,18 +7,19 @@ protected function didConstruct() {
$this
->setName('reparse')
->setExamples('**reparse** [options] __repository__')
- ->setSynopsis(pht(
- '**reparse** __what__ __which_parts__ [--trace] [--force]'."\n\n".
- 'Rerun the Diffusion parser on specific commits and repositories. '.
- 'Mostly useful for debugging changes to Diffusion.'."\n\n".
- 'e.g. enqueue reparse owners in the TEST repo for all commits:'."\n".
- 'repository reparse --all TEST --owners'."\n\n".
- 'e.g. do same but exclude before yesterday (local time):'."\n".
- 'repository reparse --all TEST --owners --min-date yesterday'."\n".
- 'repository reparse --all TEST --owners --min-date "today -1 day".'.
- "\n\n".
- 'e.g. do same but exclude before 03/31/2013 (local time):'."\n".
- 'repository reparse --all TEST --owners --min-date "03/31/2013"'))
+ ->setSynopsis(
+ pht(
+ '**reparse** __what__ __which_parts__ [--trace] [--force]'."\n\n".
+ 'Rerun the Diffusion parser on specific commits and repositories. '.
+ 'Mostly useful for debugging changes to Diffusion.'."\n\n".
+ 'e.g. enqueue reparse owners in the TEST repo for all commits:'."\n".
+ 'repository reparse --all TEST --owners'."\n\n".
+ 'e.g. do same but exclude before yesterday (local time):'."\n".
+ 'repository reparse --all TEST --owners --min-date yesterday'."\n".
+ 'repository reparse --all TEST --owners --min-date "today -1 day".'.
+ "\n\n".
+ 'e.g. do same but exclude before 03/31/2013 (local time):'."\n".
+ 'repository reparse --all TEST --owners --min-date "03/31/2013"'))
->setArguments(
array(
array(
@@ -31,22 +32,24 @@ protected function didConstruct() {
'help' => pht(
'Reparse all commits in the specified repository. This mode '.
'queues parsers into the task queue; you must run taskmasters '.
- 'to actually do the parses. Use with __--force-local__ to run '.
- 'the tasks locally instead of with taskmasters.'),
+ 'to actually do the parses. Use with __%s__ to run '.
+ 'the tasks locally instead of with taskmasters.',
+ '--force-local'),
),
array(
'name' => 'min-date',
'param' => 'date',
'help' => pht(
- 'Must be used with __--all__, this will exclude commits which '.
- 'are earlier than __date__.'."\n".
+ "Must be used with __%s__, this will exclude commits which ".
+ "are earlier than __date__.\n".
"Valid examples:\n".
" 'today', 'today 2pm', '-1 hour', '-2 hours', '-24 hours',\n".
" 'yesterday', 'today -1 day', 'yesterday 2pm', '2pm -1 day',\n".
" 'last Monday', 'last Monday 14:00', 'last Monday 2pm',\n".
" '31 March 2013', '31 Mar', '03/31', '03/31/2013',\n".
- 'See __http://www.php.net/manual/en/datetime.formats.php__ for '.
- 'more.'),
+ "See __%s__ for more.",
+ '--all',
+ 'http://www.php.net/manual/en/datetime.formats.php'),
),
array(
'name' => 'message',
@@ -76,14 +79,16 @@ protected function didConstruct() {
array(
'name' => 'force-local',
'help' => pht(
- 'Only used with __--all__, use this to run the tasks locally '.
- 'instead of deferring them to taskmaster daemons.'),
+ 'Only used with __%s__, use this to run the tasks locally '.
+ 'instead of deferring them to taskmaster daemons.',
+ '--all'),
),
array(
'name' => 'force-autoclose',
'help' => pht(
- 'Only used with __--message__, use this to make sure any '.
- 'pertinent diffs are closed regardless of configuration.'),
+ 'Only used with __%s, use this to make sure any '.
+ 'pertinent diffs are closed regardless of configuration.',
+ '--message__'),
),
));
@@ -121,8 +126,12 @@ public function execute(PhutilArgumentParser $args) {
if (!$reparse_message && !$reparse_change && !$reparse_herald &&
!$reparse_owners) {
throw new PhutilArgumentUsageException(
- pht('Specify what information to reparse with --message, --change, '.
- '--herald, and/or --owners'));
+ pht(
+ 'Specify what information to reparse with %s, %s, %s, and/or %s.',
+ '--message',
+ '--change',
+ '--herald',
+ '--owners'));
}
$min_timestamp = false;
@@ -148,12 +157,14 @@ public function execute(PhutilArgumentParser $args) {
}
if ($reparse_owners && !$force) {
- $console->writeOut("%s\n", pht(
- 'You are about to recreate the relationship entries between the '.
- 'commits and the packages they touch. This might delete some existing '.
- 'relationship entries for some old commits.'));
+ $console->writeOut(
+ "%s\n",
+ pht(
+ 'You are about to recreate the relationship entries between the '.
+ 'commits and the packages they touch. This might delete some '.
+ 'existing relationship entries for some old commits.'));
- if (!phutil_console_confirm('Are you ready to continue?')) {
+ if (!phutil_console_confirm(pht('Are you ready to continue?'))) {
throw new PhutilArgumentUsageException(pht('Cancelled.'));
}
}
@@ -230,8 +241,8 @@ public function execute(PhutilArgumentParser $args) {
'**NOTE**: This script will queue tasks to reparse the data. Once the '.
'tasks have been queued, you need to run Taskmaster daemons to '.
'execute them.'."\n\n".
- "QUEUEING TASKS (%d Commits):",
- number_format(count($commits))));
+ "QUEUEING TASKS (%s Commits):",
+ new PhutilNumber(count($commits))));
}
$progress = new PhutilConsoleProgressBar();
diff --git a/src/applications/repository/management/PhabricatorRepositoryManagementUpdateWorkflow.php b/src/applications/repository/management/PhabricatorRepositoryManagementUpdateWorkflow.php
index afe8b9e5d5..99b4a3adc6 100644
--- a/src/applications/repository/management/PhabricatorRepositoryManagementUpdateWorkflow.php
+++ b/src/applications/repository/management/PhabricatorRepositoryManagementUpdateWorkflow.php
@@ -27,11 +27,11 @@ protected function didConstruct() {
array(
array(
'name' => 'verbose',
- 'help' => 'Show additional debugging information.',
+ 'help' => pht('Show additional debugging information.'),
),
array(
'name' => 'no-discovery',
- 'help' => 'Do not perform discovery.',
+ 'help' => pht('Do not perform discovery.'),
),
array(
'name' => 'repos',
diff --git a/src/applications/repository/management/PhabricatorRepositoryManagementWorkflow.php b/src/applications/repository/management/PhabricatorRepositoryManagementWorkflow.php
index 504772dcb2..26ab7c315e 100644
--- a/src/applications/repository/management/PhabricatorRepositoryManagementWorkflow.php
+++ b/src/applications/repository/management/PhabricatorRepositoryManagementWorkflow.php
@@ -19,7 +19,7 @@ protected function loadRepositories(PhutilArgumentParser $args, $param) {
foreach ($callsigns as $callsign) {
if (empty($repos[$callsign])) {
throw new PhutilArgumentUsageException(
- "No repository with callsign '{$callsign}' exists!");
+ pht("No repository with callsign '%s' exists!", $callsign));
}
}
diff --git a/src/applications/repository/query/PhabricatorRepositoryQuery.php b/src/applications/repository/query/PhabricatorRepositoryQuery.php
index eea20780bc..9a056b202a 100644
--- a/src/applications/repository/query/PhabricatorRepositoryQuery.php
+++ b/src/applications/repository/query/PhabricatorRepositoryQuery.php
@@ -141,8 +141,7 @@ public function getBuiltinOrders() {
public function getIdentifierMap() {
if ($this->identifierMap === null) {
- throw new Exception(
- 'You must execute() the query before accessing the identifier map.');
+ throw new PhutilInvalidStateException('execute');
}
return $this->identifierMap;
}
@@ -239,7 +238,7 @@ protected function willFilterPage(array $repositories) {
case self::HOSTED_ALL:
break;
default:
- throw new Exception("Uknown hosted failed '${hosted}'!");
+ throw new Exception(pht("Unknown hosted failed '%s'!", $hosted));
}
}
diff --git a/src/applications/repository/search/PhabricatorRepositoryCommitSearchIndexer.php b/src/applications/repository/search/PhabricatorRepositoryCommitSearchIndexer.php
index 1c17e39af9..9565bf7638 100644
--- a/src/applications/repository/search/PhabricatorRepositoryCommitSearchIndexer.php
+++ b/src/applications/repository/search/PhabricatorRepositoryCommitSearchIndexer.php
@@ -22,7 +22,7 @@ protected function buildAbstractDocumentByPHID($phid) {
->withIDs(array($commit->getRepositoryID()))
->executeOne();
if (!$repository) {
- throw new Exception('No such repository!');
+ throw new Exception(pht('No such repository!'));
}
$title = 'r'.$repository->getCallsign().$commit->getCommitIdentifier().
diff --git a/src/applications/repository/storage/PhabricatorRepository.php b/src/applications/repository/storage/PhabricatorRepository.php
index 8108051282..13dd10a878 100644
--- a/src/applications/repository/storage/PhabricatorRepository.php
+++ b/src/applications/repository/storage/PhabricatorRepository.php
@@ -135,6 +135,12 @@ public function toDictionary() {
'isActive' => $this->isTracked(),
'isHosted' => $this->isHosted(),
'isImporting' => $this->isImporting(),
+ 'encoding' => $this->getDetail('encoding'),
+ 'staging' => array(
+ 'supported' => $this->supportsStaging(),
+ 'prefix' => 'phabricator',
+ 'uri' => $this->getStagingURI(),
+ ),
);
}
@@ -220,7 +226,7 @@ public function getSubversionBaseURI($commit = null) {
public function getSubversionPathURI($path = null, $commit = null) {
$vcs = $this->getVersionControlSystem();
if ($vcs != PhabricatorRepositoryType::REPOSITORY_TYPE_SVN) {
- throw new Exception('Not a subversion repository!');
+ throw new Exception(pht('Not a subversion repository!'));
}
if ($this->isHosted()) {
@@ -416,7 +422,7 @@ private function getCommonCommandEnvironment() {
$env['HGPLAIN'] = 1;
break;
default:
- throw new Exception('Unrecognized version control system.');
+ throw new Exception(pht('Unrecognized version control system.'));
}
return $env;
@@ -447,7 +453,7 @@ private function getRemoteCommandEnvironment() {
// command-line flag instead of an environmental variable.
break;
default:
- throw new Exception('Unrecognized version control system.');
+ throw new Exception(pht('Unrecognized version control system.'));
}
}
@@ -501,7 +507,7 @@ private function formatRemoteCommand(array $args) {
}
break;
default:
- throw new Exception('Unrecognized version control system.');
+ throw new Exception(pht('Unrecognized version control system.'));
}
array_unshift($args, $pattern);
@@ -524,7 +530,7 @@ private function formatLocalCommand(array $args) {
$pattern = "hg {$pattern}";
break;
default:
- throw new Exception('Unrecognized version control system.');
+ throw new Exception(pht('Unrecognized version control system.'));
}
array_unshift($args, $pattern);
@@ -592,7 +598,7 @@ public function getNormalizedPath() {
$uri);
break;
default:
- throw new Exception('Unrecognized version control system.');
+ throw new Exception(pht('Unrecognized version control system.'));
}
return $normalized_uri->getNormalizedPath();
@@ -799,7 +805,7 @@ public function shouldSkipAutocloseCommit(
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
break;
default:
- throw new Exception('Unrecognized version control system.');
+ throw new Exception(pht('Unrecognized version control system.'));
}
$closeable_flag = PhabricatorRepositoryCommit::IMPORTED_CLOSEABLE;
@@ -955,7 +961,7 @@ public function getRemoteURIObject() {
return $uri;
}
- throw new Exception("Remote URI '{$raw_uri}' could not be parsed!");
+ throw new Exception(pht("Remote URI '%s' could not be parsed!", $raw_uri));
}
@@ -1457,8 +1463,7 @@ public static function getRemoteURIProtocol($raw_uri) {
public static function assertValidRemoteURI($uri) {
if (trim($uri) != $uri) {
throw new Exception(
- pht(
- 'The remote URI has leading or trailing whitespace.'));
+ pht('The remote URI has leading or trailing whitespace.'));
}
$protocol = self::getRemoteURIProtocol($uri);
@@ -1472,8 +1477,10 @@ public static function assertValidRemoteURI($uri) {
pht(
"The remote URI is not formatted correctly. Remote URIs ".
"with an explicit protocol should be in the form ".
- "'proto://domain/path', not 'proto://domain:/path'. ".
- "The ':/path' syntax is only valid in SCP-style URIs."));
+ "'%s', not '%s'. The '%s' syntax is only valid in SCP-style URIs.",
+ 'proto://domain/path',
+ 'proto://domain:/path',
+ ':/path'));
}
}
@@ -1493,8 +1500,14 @@ public static function assertValidRemoteURI($uri) {
throw new Exception(
pht(
"The URI protocol is unrecognized. It should begin ".
- "'ssh://', 'http://', 'https://', 'git://', 'svn://', ".
- "'svn+ssh://', or be in the form 'git@domain.com:path'."));
+ "'%s', '%s', '%s', '%s', '%s', '%s', or be in the form '%s'.",
+ 'ssh://',
+ 'http://',
+ 'https://',
+ 'git://',
+ 'svn://',
+ 'svn+ssh://',
+ 'git@domain.com:path'));
}
return true;
@@ -1595,7 +1608,7 @@ public function getAlmanacServiceURI(
if (!$service) {
throw new Exception(
pht(
- 'The Alamnac service for this repository is invalid or could not '.
+ 'The Almanac service for this repository is invalid or could not '.
'be loaded.'));
}
@@ -1603,7 +1616,7 @@ public function getAlmanacServiceURI(
if (!($service_type instanceof AlmanacClusterRepositoryServiceType)) {
throw new Exception(
pht(
- 'The Alamnac service for this repository does not have the correct '.
+ 'The Almanac service for this repository does not have the correct '.
'service type.'));
}
@@ -1611,7 +1624,7 @@ public function getAlmanacServiceURI(
if (!$bindings) {
throw new Exception(
pht(
- 'The Alamanc service for this repository is not bound to any '.
+ 'The Almanac service for this repository is not bound to any '.
'interfaces.'));
}
@@ -1742,8 +1755,8 @@ public function newConduitClient(
pht(
'Unable to read device public key while attempting to make '.
'authenticated method call within the Phabricator cluster. '.
- 'Use `bin/almanac register` to register keys for this device. '.
- 'Exception: %s',
+ 'Use `%s` to register keys for this device. Exception: %s',
+ 'bin/almanac register',
$ex->getMessage()),
array($ex));
}
@@ -1757,8 +1770,8 @@ public function newConduitClient(
pht(
'Unable to read device private key while attempting to make '.
'authenticated method call within the Phabricator cluster. '.
- 'Use `bin/almanac register` to register keys for this device. '.
- 'Exception: %s',
+ 'Use `%s` to register keys for this device. Exception: %s',
+ 'bin/almanac register',
$ex->getMessage()),
array($ex));
}
@@ -1781,11 +1794,27 @@ public function newConduitClient(
/* -( Symbols )-------------------------------------------------------------*/
public function getSymbolSources() {
- return $this->getDetail('symbol-sources');
+ return $this->getDetail('symbol-sources', array());
}
public function getSymbolLanguages() {
- return $this->getDetail('symbol-languages');
+ return $this->getDetail('symbol-languages', array());
+ }
+
+
+/* -( Staging )-------------------------------------------------------------*/
+
+
+ public function supportsStaging() {
+ return $this->isGit();
+ }
+
+
+ public function getStagingURI() {
+ if (!$this->supportsStaging()) {
+ return null;
+ }
+ return $this->getDetail('staging-uri', null);
}
diff --git a/src/applications/repository/storage/PhabricatorRepositoryCommit.php b/src/applications/repository/storage/PhabricatorRepositoryCommit.php
index a3b4bf0609..18328758ba 100644
--- a/src/applications/repository/storage/PhabricatorRepositoryCommit.php
+++ b/src/applications/repository/storage/PhabricatorRepositoryCommit.php
@@ -349,9 +349,7 @@ public function getAvailableBuildVariables() {
public function getCustomFieldSpecificationForRole($role) {
- // TODO: We could make this configurable eventually, but just use the
- // defaults for now.
- return array();
+ return PhabricatorEnv::getEnvConfig('diffusion.fields');
}
public function getCustomFieldBaseClass() {
diff --git a/src/applications/repository/storage/PhabricatorRepositoryTransaction.php b/src/applications/repository/storage/PhabricatorRepositoryTransaction.php
index 9907cb0a01..de1310f320 100644
--- a/src/applications/repository/storage/PhabricatorRepositoryTransaction.php
+++ b/src/applications/repository/storage/PhabricatorRepositoryTransaction.php
@@ -27,6 +27,7 @@ final class PhabricatorRepositoryTransaction
const TYPE_SERVICE = 'repo:service';
const TYPE_SYMBOLS_SOURCES = 'repo:symbol-source';
const TYPE_SYMBOLS_LANGUAGE = 'repo:symbol-language';
+ const TYPE_STAGING_URI = 'repo:staging-uri';
// TODO: Clean up these legacy transaction types.
const TYPE_SSH_LOGIN = 'repo:ssh-login';
@@ -412,9 +413,29 @@ public function getTitle() {
case self::TYPE_SYMBOLS_LANGUAGE:
return pht('%s changed indexed languages from %s to %s.',
+ $this->renderHandleLink($author_phid),
+ $old ? implode(', ', $old) : pht('Any'),
+ $new ? implode(', ', $new) : pht('Any'));
+
+ case self::TYPE_STAGING_URI:
+ if (!$old) {
+ return pht(
+ '%s set "%s" as the staging area for this repository.',
$this->renderHandleLink($author_phid),
- $old ? implode(', ', $old) : pht('Any'),
- $new ? implode(', ', $new) : pht('Any'));
+ $new);
+ } else if (!$new) {
+ return pht(
+ '%s removed "%s" as the staging area for this repository.',
+ $this->renderHandleLink($author_phid),
+ $old);
+ } else {
+ return pht(
+ '%s changed the staging area for this repository from '.
+ '"%s" to "%s".',
+ $this->renderHandleLink($author_phid),
+ $old,
+ $new);
+ }
}
return parent::getTitle();
diff --git a/src/applications/repository/storage/PhabricatorRepositoryVCSPassword.php b/src/applications/repository/storage/PhabricatorRepositoryVCSPassword.php
index f9cbb69a03..2f5c20cf7e 100644
--- a/src/applications/repository/storage/PhabricatorRepositoryVCSPassword.php
+++ b/src/applications/repository/storage/PhabricatorRepositoryVCSPassword.php
@@ -40,7 +40,7 @@ private function getPasswordHashInput(
PhutilOpaqueEnvelope $password,
PhabricatorUser $user) {
if ($user->getPHID() != $this->getUserPHID()) {
- throw new Exception('User does not match password user PHID!');
+ throw new Exception(pht('User does not match password user PHID!'));
}
$raw_input = PhabricatorHash::digestPassword($password, $user->getPHID());
diff --git a/src/applications/repository/storage/__tests__/PhabricatorRepositoryTestCase.php b/src/applications/repository/storage/__tests__/PhabricatorRepositoryTestCase.php
index 8e308ed602..7e71efe755 100644
--- a/src/applications/repository/storage/__tests__/PhabricatorRepositoryTestCase.php
+++ b/src/applications/repository/storage/__tests__/PhabricatorRepositoryTestCase.php
@@ -23,7 +23,7 @@ public function testRepositoryURIProtocols() {
$this->assertEqual(
$expect,
$repository->getRemoteProtocol(),
- "Protocol for '{$uri}'.");
+ pht("Protocol for '%s'.", $uri));
}
}
@@ -35,7 +35,7 @@ public function testBranchFilter() {
$this->assertTrue(
$repo->shouldTrackBranch('imaginary'),
- 'Track all branches by default.');
+ pht('Track all branches by default.'));
$repo->setDetail(
'branch-filter',
@@ -45,11 +45,11 @@ public function testBranchFilter() {
$this->assertTrue(
$repo->shouldTrackBranch('master'),
- 'Track listed branches.');
+ pht('Track listed branches.'));
$this->assertFalse(
$repo->shouldTrackBranch('imaginary'),
- 'Do not track unlisted branches.');
+ pht('Do not track unlisted branches.'));
}
public function testSubversionPathInfo() {
diff --git a/src/applications/repository/worker/PhabricatorRepositoryCommitOwnersWorker.php b/src/applications/repository/worker/PhabricatorRepositoryCommitOwnersWorker.php
index 9866273886..5756c4e880 100644
--- a/src/applications/repository/worker/PhabricatorRepositoryCommitOwnersWorker.php
+++ b/src/applications/repository/worker/PhabricatorRepositoryCommitOwnersWorker.php
@@ -92,12 +92,12 @@ private function checkAuditReasons(
$reasons = array();
if ($data->getCommitDetail('vsDiff')) {
- $reasons[] = 'Changed After Revision Was Accepted';
+ $reasons[] = pht('Changed After Revision Was Accepted');
}
$commit_author_phid = $data->getCommitDetail('authorPHID');
if (!$commit_author_phid) {
- $reasons[] = 'Commit Author Not Recognized';
+ $reasons[] = pht('Commit Author Not Recognized');
}
$revision_id = $data->getCommitDetail('differential.revisionID');
@@ -114,14 +114,14 @@ private function checkAuditReasons(
$revision_author_phid = $revision->getAuthorPHID();
$commit_reviewedby_phid = $data->getCommitDetail('reviewerPHID');
if ($revision_author_phid !== $commit_author_phid) {
- $reasons[] = 'Author Not Matching with Revision';
+ $reasons[] = pht('Author Not Matching with Revision');
}
} else {
- $reasons[] = 'Revision Not Found';
+ $reasons[] = pht('Revision Not Found');
}
} else {
- $reasons[] = 'No Revision Specified';
+ $reasons[] = pht('No Revision Specified');
}
$owners_phids = PhabricatorOwnersOwner::loadAffiliatedUserPHIDs(
@@ -130,7 +130,7 @@ private function checkAuditReasons(
if (!($commit_author_phid && in_array($commit_author_phid, $owners_phids) ||
$commit_reviewedby_phid && in_array($commit_reviewedby_phid,
$owners_phids))) {
- $reasons[] = 'Owners Not Involved';
+ $reasons[] = pht('Owners Not Involved');
}
return $reasons;
diff --git a/src/applications/repository/worker/__tests__/PhabricatorChangeParserTestCase.php b/src/applications/repository/worker/__tests__/PhabricatorChangeParserTestCase.php
index 7efc3a4a18..4925c9dbea 100644
--- a/src/applications/repository/worker/__tests__/PhabricatorChangeParserTestCase.php
+++ b/src/applications/repository/worker/__tests__/PhabricatorChangeParserTestCase.php
@@ -1138,7 +1138,7 @@ public function testSubversionForeignStubsParser() {
$this->assertTrue(
isset($commits['2']),
- 'Expect rCHE2 to exist as a foreign stub.');
+ pht('Expect %s to exist as a foreign stub.', 'rCHE2'));
// The foreign stub should be marked imported.
diff --git a/src/applications/repository/worker/commitchangeparser/PhabricatorOwnersPackagePathValidator.php b/src/applications/repository/worker/commitchangeparser/PhabricatorOwnersPackagePathValidator.php
deleted file mode 100644
index 55b34e7fef..0000000000
--- a/src/applications/repository/worker/commitchangeparser/PhabricatorOwnersPackagePathValidator.php
+++ /dev/null
@@ -1,108 +0,0 @@
-setViewer($actor)
- ->withIDs(array($commit->getRepositoryID()))
- ->executeOne();
- if (!$repository) {
- return;
- }
- $changes = self::loadDiffusionChangesForCommit(
- $repository,
- $commit,
- $actor);
-
- if (!$changes) {
- return;
- }
-
- $move_map = array();
- foreach ($changes as $change) {
- if ($change->getChangeType() == DifferentialChangeType::TYPE_MOVE_HERE) {
- $from_path = '/'.$change->getTargetPath();
- $to_path = '/'.$change->getPath();
- if ($change->getFileType() == DifferentialChangeType::FILE_DIRECTORY) {
- $to_path = $to_path.'/';
- $from_path = $from_path.'/';
- }
- $move_map[$from_path] = $to_path;
- }
- }
-
- if ($move_map) {
- self::updateAffectedPackages($repository, $move_map);
- }
- }
-
- private static function updateAffectedPackages($repository, array $move_map) {
- $paths = array_keys($move_map);
- if ($paths) {
- $packages = PhabricatorOwnersPackage::loadAffectedPackages($repository,
- $paths);
- foreach ($packages as $package) {
- self::updatePackagePaths($package, $move_map);
- }
- }
- }
-
- private static function updatePackagePaths($package, array $move_map) {
- $paths = array_keys($move_map);
- $pkg_paths = $package->loadPaths();
- $new_paths = array();
- foreach ($pkg_paths as $pkg_path) {
- $path_changed = false;
-
- foreach ($paths as $old_path) {
- if (strncmp($pkg_path->getPath(), $old_path, strlen($old_path)) === 0) {
- $new_paths[] = array (
- 'packageID' => $package->getID(),
- 'repositoryPHID' => $pkg_path->getRepositoryPHID(),
- 'path' => str_replace($pkg_path->getPath(), $old_path,
- $move_map[$old_path]),
- );
- $path_changed = true;
- }
- }
-
- if (!$path_changed) {
- $new_paths[] = array (
- 'packageID' => $package->getID(),
- 'repositoryPHID' => $pkg_path->getRepositoryPHID(),
- 'path' => $pkg_path->getPath(),
- );
- }
- }
-
- if ($new_paths) {
- $package->attachOldPrimaryOwnerPHID($package->getPrimaryOwnerPHID());
- $package->attachUnsavedPaths($new_paths);
- $package->save(); // save the changes and notify the owners.
- }
- }
-
- private static function loadDiffusionChangesForCommit(
- PhabricatorRepository $repository,
- PhabricatorRepositoryCommit $commit,
- PhabricatorUser $actor) {
- $data = array(
- 'user' => $actor,
- 'repository' => $repository,
- 'commit' => $commit->getCommitIdentifier(),
- );
- $drequest = DiffusionRequest::newFromDictionary($data);
- $change_query =
- DiffusionPathChangeQuery::newFromDiffusionRequest($drequest);
- return $change_query->loadChanges();
- }
-}
diff --git a/src/applications/repository/worker/commitchangeparser/PhabricatorRepositoryCommitChangeParserWorker.php b/src/applications/repository/worker/commitchangeparser/PhabricatorRepositoryCommitChangeParserWorker.php
index ffcb78435e..9fcaeb7254 100644
--- a/src/applications/repository/worker/commitchangeparser/PhabricatorRepositoryCommitChangeParserWorker.php
+++ b/src/applications/repository/worker/commitchangeparser/PhabricatorRepositoryCommitChangeParserWorker.php
@@ -21,9 +21,9 @@ protected function parseCommit(
$callsign = $repository->getCallsign();
$full_name = 'r'.$callsign.$identifier;
- $this->log("Parsing %s...\n", $full_name);
+ $this->log("%s\n", pht('Parsing %s...', $full_name));
if ($this->isBadCommit($full_name)) {
- $this->log('This commit is marked bad!');
+ $this->log(pht('This commit is marked bad!'));
return;
}
@@ -96,9 +96,6 @@ protected function finishParse() {
id(new PhabricatorSearchIndexer())
->queueDocumentForIndexing($commit->getPHID());
- PhabricatorOwnersPackagePathValidator::updateOwnersPackagePaths(
- $commit,
- PhabricatorUser::getOmnipotentUser());
if ($this->shouldQueueFollowupTasks()) {
$this->queueTask(
'PhabricatorRepositoryCommitOwnersWorker',
diff --git a/src/applications/repository/worker/commitchangeparser/PhabricatorRepositoryGitCommitChangeParserWorker.php b/src/applications/repository/worker/commitchangeparser/PhabricatorRepositoryGitCommitChangeParserWorker.php
index fb191631b9..4ab6f03f32 100644
--- a/src/applications/repository/worker/commitchangeparser/PhabricatorRepositoryGitCommitChangeParserWorker.php
+++ b/src/applications/repository/worker/commitchangeparser/PhabricatorRepositoryGitCommitChangeParserWorker.php
@@ -127,7 +127,7 @@ protected function parseCommitChanges(
// NOTE: "U" (unmerged) and "X" (unknown) statuses are also possible
// in theory but shouldn't appear here.
default:
- throw new Exception("Failed to parse line '{$line}'.");
+ throw new Exception(pht("Failed to parse line '%s'.", $line));
}
$changes[$change_path] = array(
diff --git a/src/applications/repository/worker/commitchangeparser/PhabricatorRepositorySvnCommitChangeParserWorker.php b/src/applications/repository/worker/commitchangeparser/PhabricatorRepositorySvnCommitChangeParserWorker.php
index e65905b986..6725ddb1d1 100644
--- a/src/applications/repository/worker/commitchangeparser/PhabricatorRepositorySvnCommitChangeParserWorker.php
+++ b/src/applications/repository/worker/commitchangeparser/PhabricatorRepositorySvnCommitChangeParserWorker.php
@@ -201,7 +201,7 @@ protected function parseCommitChanges(
if ($source_file_type == DifferentialChangeType::FILE_DELETED) {
throw new Exception(
- 'Something is wrong; source of a copy must exist.');
+ pht('Something is wrong; source of a copy must exist.'));
}
if ($source_file_type != DifferentialChangeType::FILE_DIRECTORY) {
@@ -504,10 +504,11 @@ private function lookupSvnCommits(
if ($need) {
$subpath = $repository->getDetail('svn-subpath');
if (!$subpath) {
- $commits = implode(', ', $need);
throw new Exception(
- "Missing commits ({$need}) in a SVN repository which is not ".
- "configured for subdirectory-only parsing!");
+ pht(
+ 'Missing commits (%s) in a SVN repository which is not '.
+ 'configured for subdirectory-only parsing!',
+ implode(', ', $need)));
}
foreach ($need as $foreign_commit) {
@@ -631,7 +632,7 @@ private function getFileTypeFromSVNKind($kind) {
case 'dir': return DifferentialChangeType::FILE_DIRECTORY;
case 'file': return DifferentialChangeType::FILE_NORMAL;
default:
- throw new Exception("Unknown SVN file kind '{$kind}'.");
+ throw new Exception(pht("Unknown SVN file kind '%s'.", $kind));
}
}
@@ -687,7 +688,7 @@ private function parseRecursiveListFileData($file_path) {
'((.*?))?@';
$matches = null;
if (!preg_match($pattern, $entry, $matches)) {
- throw new Exception('Unable to parse entry!');
+ throw new Exception(pht('Unable to parse entry!'));
}
$map[html_entity_decode($matches[2])] =
$this->getFileTypeFromSVNKind($matches[1]);
@@ -704,40 +705,61 @@ private function parseRecursiveListFileData($file_path) {
$mode = 'entry';
$entry = array();
} else {
- throw new Exception("Expected or ',
+ '/';
if (!preg_match($expect, $line)) {
- throw new Exception("Expected '{$expect}', got {$line}.");
+ throw new Exception(
+ pht(
+ "Expected '%s', got %s.",
+ $expect,
+ $line));
}
$mode = 'list';
break;
case 'list':
$expect = '';
if ($line !== $expect) {
- throw new Exception("Expected '{$expect}', got {$line}.");
+ throw new Exception(
+ pht(
+ "Expected '%s', got %s.",
+ $expect,
+ $line));
}
$mode = 'list1';
break;
case 'list1':
$expect = 'setUnitStatus(DifferentialUnitStatus::UNIT_AUTO_SKIP)
->setDateCreated($this->commit->getEpoch())
->setDescription(
- 'Commit r'.
- $this->repository->getCallsign().
- $this->commit->getCommitIdentifier());
+ pht(
+ 'Commit %s',
+ 'r'.$this->repository->getCallsign().
+ $this->commit->getCommitIdentifier()));
$parents = DiffusionQuery::callConduitWithDiffusionRequest(
$viewer,
diff --git a/src/applications/search/controller/PhabricatorSearchAttachController.php b/src/applications/search/controller/PhabricatorSearchAttachController.php
index b2e0a92b9d..2d00ac8bda 100644
--- a/src/applications/search/controller/PhabricatorSearchAttachController.php
+++ b/src/applications/search/controller/PhabricatorSearchAttachController.php
@@ -200,43 +200,43 @@ private function performMerge(
private function getStrings($attach_type, $action) {
switch ($attach_type) {
case DifferentialRevisionPHIDType::TYPECONST:
- $noun = 'Revisions';
- $selected = 'created';
+ $noun = pht('Revisions');
+ $selected = pht('created');
break;
case ManiphestTaskPHIDType::TYPECONST:
- $noun = 'Tasks';
- $selected = 'assigned';
+ $noun = pht('Tasks');
+ $selected = pht('assigned');
break;
case PhabricatorRepositoryCommitPHIDType::TYPECONST:
- $noun = 'Commits';
- $selected = 'created';
+ $noun = pht('Commits');
+ $selected = pht('created');
break;
case PholioMockPHIDType::TYPECONST:
- $noun = 'Mocks';
- $selected = 'created';
+ $noun = pht('Mocks');
+ $selected = pht('created');
break;
}
switch ($action) {
case self::ACTION_EDGE:
case self::ACTION_ATTACH:
- $dialog_title = "Manage Attached {$noun}";
- $header_text = "Currently Attached {$noun}";
- $button_text = "Save {$noun}";
+ $dialog_title = pht('Manage Attached %s', $noun);
+ $header_text = pht('Currently Attached %s', $noun);
+ $button_text = pht('Save %s', $noun);
$instructions = null;
break;
case self::ACTION_MERGE:
- $dialog_title = 'Merge Duplicate Tasks';
- $header_text = 'Tasks To Merge';
- $button_text = "Merge {$noun}";
- $instructions =
+ $dialog_title = pht('Merge Duplicate Tasks');
+ $header_text = pht('Tasks To Merge');
+ $button_text = pht('Merge %s', $noun);
+ $instructions = pht(
'These tasks will be merged into the current task and then closed. '.
- 'The current task will grow stronger.';
+ 'The current task will grow stronger.');
break;
case self::ACTION_DEPENDENCIES:
- $dialog_title = 'Edit Dependencies';
- $header_text = 'Current Dependencies';
- $button_text = 'Save Dependencies';
+ $dialog_title = pht('Edit Dependencies');
+ $header_text = pht('Current Dependencies');
+ $button_text = pht('Save Dependencies');
$instructions = null;
break;
case self::ACTION_BLOCKS:
@@ -260,15 +260,15 @@ private function getStrings($attach_type, $action) {
private function getFilters(array $strings, $attach_type) {
if ($attach_type == PholioMockPHIDType::TYPECONST) {
$filters = array(
- 'created' => 'Created By Me',
- 'all' => 'All '.$strings['target_plural_noun'],
+ 'created' => pht('Created By Me'),
+ 'all' => pht('All %s', $strings['target_plural_noun']),
);
} else {
$filters = array(
- 'assigned' => 'Assigned to Me',
- 'created' => 'Created By Me',
- 'open' => 'All Open '.$strings['target_plural_noun'],
- 'all' => 'All '.$strings['target_plural_noun'],
+ 'assigned' => pht('Assigned to Me'),
+ 'created' => pht('Created By Me'),
+ 'open' => pht('All Open %s', $strings['target_plural_noun']),
+ 'all' => pht('All %s', $strings['target_plural_noun']),
);
}
@@ -315,10 +315,11 @@ private function raiseGraphCycleException(PhabricatorEdgeCycleException $ex) {
foreach ($cycle as $cycle_phid) {
$names[] = $handles[$cycle_phid]->getFullName();
}
- $names = implode(" \xE2\x86\x92 ", $names);
throw new Exception(
- "You can not create that dependency, because it would create a ".
- "circular dependency: {$names}.");
+ pht(
+ 'You can not create that dependency, because it would create a '.
+ 'circular dependency: %s.',
+ implode(" \xE2\x86\x92 ", $names)));
}
}
diff --git a/src/applications/search/engine/PhabricatorApplicationSearchEngine.php b/src/applications/search/engine/PhabricatorApplicationSearchEngine.php
index cd0a9655fa..e89e82afd3 100644
--- a/src/applications/search/engine/PhabricatorApplicationSearchEngine.php
+++ b/src/applications/search/engine/PhabricatorApplicationSearchEngine.php
@@ -328,7 +328,7 @@ public function getBuiltinQueries() {
*/
public function getBuiltinQuery($query_key) {
if (!$this->isBuiltinQuery($query_key)) {
- throw new Exception("'{$query_key}' is not a builtin!");
+ throw new Exception(pht("'%s' is not a builtin!", $query_key));
}
return idx($this->getBuiltinQueries(), $query_key);
}
@@ -355,7 +355,7 @@ public function isBuiltinQuery($query_key) {
* @task builtin
*/
public function buildSavedQueryFromBuiltin($query_key) {
- throw new Exception("Builtin '{$query_key}' is not supported!");
+ throw new Exception(pht("Builtin '%s' is not supported!", $query_key));
}
diff --git a/src/applications/search/engine/PhabricatorElasticSearchEngine.php b/src/applications/search/engine/PhabricatorElasticSearchEngine.php
index f6efc17044..fa09e64a9c 100644
--- a/src/applications/search/engine/PhabricatorElasticSearchEngine.php
+++ b/src/applications/search/engine/PhabricatorElasticSearchEngine.php
@@ -6,6 +6,11 @@ final class PhabricatorElasticSearchEngine extends PhabricatorSearchEngine {
private $index;
private $timeout;
+ public function __construct() {
+ $this->uri = PhabricatorEnv::getEnvConfig('search.elastic.host');
+ $this->index = PhabricatorEnv::getEnvConfig('search.elastic.namespace');
+ }
+
public function getEngineIdentifier() {
return 'elasticsearch';
}
@@ -15,7 +20,7 @@ public function getEnginePriority() {
}
public function isEnabled() {
- return (bool)PhabricatorEnv::getEnvConfig('search.elastic.host');
+ return (bool)$this->uri;
}
public function setURI($uri) {
diff --git a/src/applications/search/engine/PhabricatorJumpNavHandler.php b/src/applications/search/engine/PhabricatorJumpNavHandler.php
index 53e92b6e58..7a340a7e8f 100644
--- a/src/applications/search/engine/PhabricatorJumpNavHandler.php
+++ b/src/applications/search/engine/PhabricatorJumpNavHandler.php
@@ -69,7 +69,7 @@ public static function getJumpResponse(PhabricatorUser $viewer, $jump) {
->setURI('/maniphest/task/create/?title='
.phutil_escape_uri($matches[1]));
default:
- throw new Exception("Unknown jump effect '{$effect}'!");
+ throw new Exception(pht("Unknown jump effect '%s'!", $effect));
}
}
}
diff --git a/src/applications/search/index/PhabricatorSearchDocumentIndexer.php b/src/applications/search/index/PhabricatorSearchDocumentIndexer.php
index 18d07765ad..b3e90148ca 100644
--- a/src/applications/search/index/PhabricatorSearchDocumentIndexer.php
+++ b/src/applications/search/index/PhabricatorSearchDocumentIndexer.php
@@ -36,7 +36,7 @@ protected function loadDocumentByPHID($phid) {
->withPHIDs(array($phid))
->executeOne();
if (!$object) {
- throw new Exception("Unable to load object by phid '{$phid}'!");
+ throw new Exception(pht("Unable to load object by PHID '%s'!", $phid));
}
return $object;
}
@@ -73,17 +73,21 @@ public function indexDocumentByPHID($phid, $context) {
try {
$engine->reindexAbstractDocument($document);
} catch (Exception $ex) {
- $phid = $document->getPHID();
- $class = get_class($engine);
-
- phlog("Unable to index document {$phid} with engine {$class}.");
+ phlog(
+ pht(
+ 'Unable to index document %s with engine %s.',
+ $document->getPHID(),
+ get_class($engine)));
phlog($ex);
}
$this->dispatchDidUpdateIndexEvent($phid, $document);
} catch (Exception $ex) {
- $class = get_class($this);
- phlog("Unable to build document {$phid} with indexer {$class}.");
+ phlog(
+ pht(
+ 'Unable to build document %s with indexer %s.',
+ $phid,
+ get_class($this)));
phlog($ex);
}
diff --git a/src/applications/search/management/PhabricatorSearchManagementIndexWorkflow.php b/src/applications/search/management/PhabricatorSearchManagementIndexWorkflow.php
index fea5817de1..f7c679782e 100644
--- a/src/applications/search/management/PhabricatorSearchManagementIndexWorkflow.php
+++ b/src/applications/search/management/PhabricatorSearchManagementIndexWorkflow.php
@@ -6,7 +6,7 @@ final class PhabricatorSearchManagementIndexWorkflow
protected function didConstruct() {
$this
->setName('index')
- ->setSynopsis('Build or rebuild search indexes.')
+ ->setSynopsis(pht('Build or rebuild search indexes.'))
->setExamples(
"**index** D123\n".
"**index** --type DREV\n".
@@ -15,18 +15,19 @@ protected function didConstruct() {
array(
array(
'name' => 'all',
- 'help' => 'Reindex all documents.',
+ 'help' => pht('Reindex all documents.'),
),
array(
'name' => 'type',
'param' => 'TYPE',
- 'help' => 'PHID type to reindex, like "TASK" or "DREV".',
+ 'help' => pht('PHID type to reindex, like "TASK" or "DREV".'),
),
array(
'name' => 'background',
- 'help' => 'Instead of indexing in this process, queue tasks for '.
- 'the daemons. This can improve performance, but makes '.
- 'it more difficult to debug search indexing.',
+ 'help' => pht(
+ 'Instead of indexing in this process, queue tasks for '.
+ 'the daemons. This can improve performance, but makes '.
+ 'it more difficult to debug search indexing.'),
),
array(
'name' => 'objects',
@@ -45,11 +46,16 @@ public function execute(PhutilArgumentParser $args) {
if ($obj_names && ($is_all || $is_type)) {
throw new PhutilArgumentUsageException(
- "You can not name objects to index alongside the '--all' or '--type' ".
- "flags.");
+ pht(
+ "You can not name objects to index alongside the '%s' or '%s' flags.",
+ '--all',
+ '--type'));
} else if (!$obj_names && !($is_all || $is_type)) {
throw new PhutilArgumentUsageException(
- "Provide one of '--all', '--type' or a list of object names.");
+ pht(
+ "Provide one of '%s', '%s' or a list of object names.",
+ '--all',
+ '--type'));
}
if ($obj_names) {
@@ -59,7 +65,7 @@ public function execute(PhutilArgumentParser $args) {
}
if (!$phids) {
- throw new PhutilArgumentUsageException('Nothing to index!');
+ throw new PhutilArgumentUsageException(pht('Nothing to index!'));
}
if ($args->getArg('background')) {
@@ -73,8 +79,8 @@ public function execute(PhutilArgumentParser $args) {
$console->writeOut(
"%s\n",
pht(
- 'Run this workflow with "--background" to queue tasks for the '.
- 'daemon workers.'));
+ 'Run this workflow with "%s" to queue tasks for the daemon workers.',
+ '--background'));
}
$groups = phid_group_by_type($phids);
@@ -106,7 +112,9 @@ private function loadPHIDsByNames(array $names) {
foreach ($names as $name) {
if (empty($objects[$name])) {
throw new PhutilArgumentUsageException(
- "'{$name}' is not the name of a known object.");
+ pht(
+ "'%s' is not the name of a known object.",
+ $name));
}
}
diff --git a/src/applications/search/management/PhabricatorSearchManagementInitWorkflow.php b/src/applications/search/management/PhabricatorSearchManagementInitWorkflow.php
index e4a8ddb693..56a5b33352 100644
--- a/src/applications/search/management/PhabricatorSearchManagementInitWorkflow.php
+++ b/src/applications/search/management/PhabricatorSearchManagementInitWorkflow.php
@@ -6,7 +6,7 @@ final class PhabricatorSearchManagementInitWorkflow
protected function didConstruct() {
$this
->setName('init')
- ->setSynopsis('Initialize or repair an index.')
+ ->setSynopsis(pht('Initialize or repair an index.'))
->setExamples('**init**');
}
@@ -28,7 +28,7 @@ public function execute(PhutilArgumentParser $args) {
} else if (!$engine->indexIsSane()) {
$console->writeOut(
'%s',
- pht('Index exists but is incorrect, fixing...'));
+ pht('Index exists but is incorrect, fixing...'));
$engine->initIndex();
$console->writeOut(
"%s\n",
@@ -39,8 +39,9 @@ public function execute(PhutilArgumentParser $args) {
if ($work_done) {
$console->writeOut(
"%s\n",
- pht('Index maintenance complete. Run `./bin/search index` to '.
- 'reindex documents'));
+ pht(
+ 'Index maintenance complete. Run `%s` to reindex documents',
+ './bin/search index'));
} else {
$console->writeOut(
"%s\n",
diff --git a/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php b/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php
index 1ca6b109d3..092f758f3b 100644
--- a/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php
+++ b/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php
@@ -137,7 +137,7 @@ public function buildSearchForm(
)))
->appendChild(
id(new AphrontFormTextControl())
- ->setLabel('Query')
+ ->setLabel(pht('Query'))
->setName('query')
->setValue($saved->getParameter('query')))
->appendChild($status_control)
@@ -145,25 +145,25 @@ public function buildSearchForm(
->appendControl(
id(new AphrontFormTokenizerControl())
->setName('authorPHIDs')
- ->setLabel('Authors')
+ ->setLabel(pht('Authors'))
->setDatasource(new PhabricatorPeopleUserFunctionDatasource())
->setValue($author_phids))
->appendControl(
id(new AphrontFormTokenizerControl())
->setName('ownerPHIDs')
- ->setLabel('Owners')
+ ->setLabel(pht('Owners'))
->setDatasource(new PhabricatorPeopleOwnerDatasource())
->setValue($owner_phids))
->appendControl(
id(new AphrontFormTokenizerControl())
->setName('subscriberPHIDs')
- ->setLabel('Subscribers')
+ ->setLabel(pht('Subscribers'))
->setDatasource(new PhabricatorMetaMTAMailableFunctionDatasource())
->setValue($subscriber_phids))
->appendControl(
id(new AphrontFormTokenizerControl())
->setName('projectPHIDs')
- ->setLabel('In Any Project')
+ ->setLabel(pht('In Any Project'))
->setDatasource(new PhabricatorProjectDatasource())
->setValue($project_phids));
}
diff --git a/src/applications/search/query/PhabricatorSearchDocumentQuery.php b/src/applications/search/query/PhabricatorSearchDocumentQuery.php
index 1770f4b046..4928ee6a63 100644
--- a/src/applications/search/query/PhabricatorSearchDocumentQuery.php
+++ b/src/applications/search/query/PhabricatorSearchDocumentQuery.php
@@ -86,8 +86,7 @@ public function getQueryApplicationClass() {
protected function getResultCursor($result) {
throw new Exception(
pht(
- 'This query does not support cursor paging; it must be offset '.
- 'paged.'));
+ 'This query does not support cursor paging; it must be offset paged.'));
}
protected function nextPage(array $page) {
diff --git a/src/applications/settings/panel/PhabricatorConduitCertificateSettingsPanel.php b/src/applications/settings/panel/PhabricatorConduitCertificateSettingsPanel.php
index 5ffc536fad..d7210a3c8f 100644
--- a/src/applications/settings/panel/PhabricatorConduitCertificateSettingsPanel.php
+++ b/src/applications/settings/panel/PhabricatorConduitCertificateSettingsPanel.php
@@ -67,7 +67,8 @@ public function processRequest(AphrontRequest $request) {
$notice->appendChild(phutil_tag(
'p',
array(),
- pht('Your old certificate has been destroyed and you have been issued '.
+ pht(
+ 'Your old certificate has been destroyed and you have been issued '.
'a new certificate. Sessions established under the old certificate '.
'are no longer valid.')));
$notice = $notice->render();
@@ -83,7 +84,8 @@ public function processRequest(AphrontRequest $request) {
->appendChild(phutil_tag(
'p',
array('class' => 'aphront-form-instructions'),
- pht('This certificate allows you to authenticate over Conduit, '.
+ pht(
+ 'This certificate allows you to authenticate over Conduit, '.
'the Phabricator API. Normally, you just run %s to install it.',
phutil_tag('tt', array(), 'arc install-certificate'))))
->appendChild(
@@ -98,7 +100,8 @@ public function processRequest(AphrontRequest $request) {
->setHeaderText(pht('Arcanist Certificate'))
->setForm($cert_form);
- $regen_instruction = pht('You can regenerate this certificate, which '.
+ $regen_instruction = pht(
+ 'You can regenerate this certificate, which '.
'will invalidate the old certificate and create a new one.');
$regen_form = new AphrontFormView();
diff --git a/src/applications/settings/panel/PhabricatorConpherencePreferencesSettingsPanel.php b/src/applications/settings/panel/PhabricatorConpherencePreferencesSettingsPanel.php
index c9383f4176..69f84f16a1 100644
--- a/src/applications/settings/panel/PhabricatorConpherencePreferencesSettingsPanel.php
+++ b/src/applications/settings/panel/PhabricatorConpherencePreferencesSettingsPanel.php
@@ -49,9 +49,10 @@ public function processRequest(AphrontRequest $request) {
=> pht('Notifications Only'),
))
->setCaption(
- pht('Should Conpherence send emails for updates or '.
- 'notifications only? This global setting can be overridden '.
- 'on a per-thread basis within Conpherence.')))
+ pht(
+ 'Should Conpherence send emails for updates or '.
+ 'notifications only? This global setting can be overridden '.
+ 'on a per-thread basis within Conpherence.')))
->appendChild(
id(new AphrontFormSubmitControl())
->setValue(pht('Save Preferences')));
diff --git a/src/applications/settings/panel/PhabricatorDeveloperPreferencesSettingsPanel.php b/src/applications/settings/panel/PhabricatorDeveloperPreferencesSettingsPanel.php
index 4d59d19414..1d81cc67b2 100644
--- a/src/applications/settings/panel/PhabricatorDeveloperPreferencesSettingsPanel.php
+++ b/src/applications/settings/panel/PhabricatorDeveloperPreferencesSettingsPanel.php
@@ -43,10 +43,10 @@ public function processRequest(AphrontRequest $request) {
$is_console_enabled = PhabricatorEnv::getEnvConfig('darkconsole.enabled');
$preamble = pht(
- '**DarkConsole** is a developer console which can help build and '.
- 'debug Phabricator applications. It includes tools for understanding '.
- 'errors, performance, service calls, and other low-level aspects of '.
- 'Phabricator\'s inner workings.');
+ "**DarkConsole** is a developer console which can help build and ".
+ "debug Phabricator applications. It includes tools for understanding ".
+ "errors, performance, service calls, and other low-level aspects of ".
+ "Phabricator's inner workings.");
if ($is_console_enabled) {
$instructions = pht(
@@ -56,15 +56,17 @@ public function processRequest(AphrontRequest $request) {
'tools. You may want to disable it again later if you only need it '.
'temporarily.'.
"\n\n".
- 'NOTE: After enabling DarkConsole, **press the ##`## key on your '.
+ 'NOTE: After enabling DarkConsole, **press the ##%s## key on your '.
'keyboard** to show or hide it.',
- $preamble);
+ $preamble,
+ '`');
} else {
$instructions = pht(
"%s\n\n".
'Before you can turn on DarkConsole, it needs to be enabled in '.
- 'the configuration for this install (`darkconsole.enabled`).',
- $preamble);
+ 'the configuration for this install (`%s`).',
+ $preamble,
+ 'darkconsole.enabled');
}
$form = id(new AphrontFormView())
diff --git a/src/applications/settings/panel/PhabricatorDiffPreferencesSettingsPanel.php b/src/applications/settings/panel/PhabricatorDiffPreferencesSettingsPanel.php
index cc6a4e91e6..72fca5e879 100644
--- a/src/applications/settings/panel/PhabricatorDiffPreferencesSettingsPanel.php
+++ b/src/applications/settings/panel/PhabricatorDiffPreferencesSettingsPanel.php
@@ -85,10 +85,11 @@ public function processRequest(AphrontRequest $request) {
1 => pht('Enable Filetree'),
))
->setCaption(
- pht('When looking at a revision or commit, enable a sidebar '.
- 'showing affected files. You can press %s to show or hide '.
- 'the sidebar.',
- phutil_tag('tt', array(), 'f'))))
+ pht(
+ 'When looking at a revision or commit, enable a sidebar '.
+ 'showing affected files. You can press %s to show or hide '.
+ 'the sidebar.',
+ phutil_tag('tt', array(), 'f'))))
->appendChild(
id(new AphrontFormSubmitControl())
->setValue(pht('Save Preferences')));
diff --git a/src/applications/settings/panel/PhabricatorDisplayPreferencesSettingsPanel.php b/src/applications/settings/panel/PhabricatorDisplayPreferencesSettingsPanel.php
index 71f533dcdb..c2dcc36e66 100644
--- a/src/applications/settings/panel/PhabricatorDisplayPreferencesSettingsPanel.php
+++ b/src/applications/settings/panel/PhabricatorDisplayPreferencesSettingsPanel.php
@@ -95,13 +95,15 @@ function helloWorld() {
$pref_monospaced_textareas_value = 'disabled';
}
- $editor_instructions = pht('Link to edit files in external editor. '.
+ $editor_instructions = pht(
+ 'Link to edit files in external editor. '.
'%%f is replaced by filename, %%l by line number, %%r by repository '.
'callsign, %%%% by literal %%. For documentation, see: %s',
$editor_doc_link);
- $font_instructions = pht('Overrides default fonts in tools like '.
- 'Differential. Input should be valid CSS "font" declaration, such as '.
+ $font_instructions = pht(
+ 'Overrides default fonts in tools like Differential. '.
+ 'Input should be valid CSS "font" declaration, such as '.
'"13px Consolas"');
$form = id(new AphrontFormView())
@@ -114,10 +116,12 @@ function helloWorld() {
->setOptions(
array(
'glyph' =>
- pht("In page titles, show Tool names as unicode glyphs: ".
+ pht(
+ 'In page titles, show Tool names as unicode glyphs: %s',
"\xE2\x9A\x99"),
'text' =>
- pht('In page titles, show Tool names as plain text: '.
+ pht(
+ 'In page titles, show Tool names as plain text: '.
'[Differential]'),
)))
->appendChild(
diff --git a/src/applications/settings/panel/PhabricatorEmailAddressesSettingsPanel.php b/src/applications/settings/panel/PhabricatorEmailAddressesSettingsPanel.php
index 7ad59d4d37..21ccd38302 100644
--- a/src/applications/settings/panel/PhabricatorEmailAddressesSettingsPanel.php
+++ b/src/applications/settings/panel/PhabricatorEmailAddressesSettingsPanel.php
@@ -289,7 +289,7 @@ private function returnDeleteAddressResponse(
->appendParagraph(
pht(
'Are you sure you want to delete this address? You will no '.
- 'longer be able to use it to login.'))
+ 'longer be able to use it to login.'))
->appendParagraph(
pht(
'Note: Removing an email address from your account will invalidate '.
diff --git a/src/applications/settings/panel/PhabricatorEmailFormatSettingsPanel.php b/src/applications/settings/panel/PhabricatorEmailFormatSettingsPanel.php
index a2b040aabd..f7dd7909ed 100644
--- a/src/applications/settings/panel/PhabricatorEmailFormatSettingsPanel.php
+++ b/src/applications/settings/panel/PhabricatorEmailFormatSettingsPanel.php
@@ -67,7 +67,7 @@ public function processRequest(AphrontRequest $request) {
? pht('Vary')
: pht('Do Not Vary');
- $html_emails_default = 'Plain Text';
+ $html_emails_default = pht('Plain Text');
$re_prefix_value = $preferences->getPreference($pref_re_prefix);
if ($re_prefix_value === null) {
@@ -132,13 +132,13 @@ public function processRequest(AphrontRequest $request) {
->setValue($vary_value);
} else {
$html_email_control = id(new AphrontFormStaticControl())
- ->setValue('Server Default ('.$html_emails_default.')');
+ ->setValue(pht('Server Default (%s)', $html_emails_default));
$re_control = id(new AphrontFormStaticControl())
- ->setValue('Server Default ('.$re_prefix_default.')');
+ ->setValue(pht('Server Default (%s)', $re_prefix_default));
$vary_control = id(new AphrontFormStaticControl())
- ->setValue('Server Default ('.$vary_default.')');
+ ->setValue(pht('Server Default (%s)', $vary_default));
}
$form
diff --git a/src/applications/settings/panel/PhabricatorSSHKeysSettingsPanel.php b/src/applications/settings/panel/PhabricatorSSHKeysSettingsPanel.php
index 2749e7147f..288552fd44 100644
--- a/src/applications/settings/panel/PhabricatorSSHKeysSettingsPanel.php
+++ b/src/applications/settings/panel/PhabricatorSSHKeysSettingsPanel.php
@@ -35,7 +35,7 @@ public function processRequest(AphrontRequest $request) {
->setUser($viewer)
->setKeys($keys)
->setCanEdit(true)
- ->setNoDataString("You haven't added any SSH Public Keys.");
+ ->setNoDataString(pht("You haven't added any SSH Public Keys."));
$panel = new PHUIObjectBoxView();
$header = new PHUIHeaderView();
diff --git a/src/applications/settings/panel/PhabricatorSearchPreferencesSettingsPanel.php b/src/applications/settings/panel/PhabricatorSearchPreferencesSettingsPanel.php
index 496aed67ec..f05a5dd9f9 100644
--- a/src/applications/settings/panel/PhabricatorSearchPreferencesSettingsPanel.php
+++ b/src/applications/settings/panel/PhabricatorSearchPreferencesSettingsPanel.php
@@ -44,7 +44,7 @@ public function processRequest(AphrontRequest $request) {
$preferences->getPreference($pref_jump, 1))
->addCheckbox($pref_shortcut,
1,
- pht("Press '/' to focus the search input."),
+ pht("Press '%s' to focus the search input.", '/'),
$preferences->getPreference($pref_shortcut, 1)))
->appendChild(
id(new AphrontFormSubmitControl())
diff --git a/src/applications/settings/storage/PhabricatorUserPreferences.php b/src/applications/settings/storage/PhabricatorUserPreferences.php
index 7732df5568..d54cf6cb46 100644
--- a/src/applications/settings/storage/PhabricatorUserPreferences.php
+++ b/src/applications/settings/storage/PhabricatorUserPreferences.php
@@ -20,7 +20,7 @@ final class PhabricatorUserPreferences extends PhabricatorUserDAO {
const PREFERENCE_SEARCHBAR_JUMP = 'searchbar-jump';
const PREFERENCE_SEARCH_SHORTCUT = 'search-shortcut';
- const PREFERENCE_SEARCH_SCOPE = 'search-scope';
+ const PREFERENCE_SEARCH_SCOPE = 'search-scope';
const PREFERENCE_DIFFUSION_BLAME = 'diffusion-blame';
const PREFERENCE_DIFFUSION_COLOR = 'diffusion-color';
@@ -32,10 +32,10 @@ final class PhabricatorUserPreferences extends PhabricatorUserDAO {
const PREFERENCE_DIFF_UNIFIED = 'diff-unified';
const PREFERENCE_DIFF_FILETREE = 'diff-filetree';
- const PREFERENCE_DIFF_GHOSTS = 'diff-ghosts';
+ const PREFERENCE_DIFF_GHOSTS = 'diff-ghosts';
const PREFERENCE_CONPH_NOTIFICATIONS = 'conph-notifications';
- const PREFERENCE_CONPHERENCE_COLUMN = 'conpherence-column';
+ const PREFERENCE_CONPHERENCE_COLUMN = 'conpherence-column';
// These are in an unusual order for historic reasons.
const MAILTAG_PREFERENCE_NOTIFY = 0;
diff --git a/src/applications/slowvote/conduit/SlowvoteInfoConduitAPIMethod.php b/src/applications/slowvote/conduit/SlowvoteInfoConduitAPIMethod.php
index 50478abc0c..cecd799ad0 100644
--- a/src/applications/slowvote/conduit/SlowvoteInfoConduitAPIMethod.php
+++ b/src/applications/slowvote/conduit/SlowvoteInfoConduitAPIMethod.php
@@ -7,7 +7,7 @@ public function getAPIMethodName() {
}
public function getMethodDescription() {
- return 'Retrieve an array of information about a poll.';
+ return pht('Retrieve an array of information about a poll.');
}
protected function defineParamTypes() {
@@ -22,7 +22,7 @@ protected function defineReturnType() {
protected function defineErrorTypes() {
return array(
- 'ERR_BAD_POLL' => 'No such poll exists',
+ 'ERR_BAD_POLL' => pht('No such poll exists.'),
);
}
diff --git a/src/applications/subscriptions/command/PhabricatorSubscriptionsSubscribeEmailCommand.php b/src/applications/subscriptions/command/PhabricatorSubscriptionsSubscribeEmailCommand.php
index a20da47c4e..0c361ad2c6 100644
--- a/src/applications/subscriptions/command/PhabricatorSubscriptionsSubscribeEmailCommand.php
+++ b/src/applications/subscriptions/command/PhabricatorSubscriptionsSubscribeEmailCommand.php
@@ -17,17 +17,18 @@ public function getCommandSummary() {
public function getCommandDescription() {
return pht(
- 'Add one or more subscribers to the object. You can add users '.
- 'by providing their usernames, or add projects by adding their '.
- 'hashtags. For example, use `!subscribe alincoln #ios` to add the '.
- 'user `alincoln` and the project with hashtag `#ios` as subscribers.'.
+ 'Add one or more subscribers to the object. You can add users by '.
+ 'providing their usernames, or add projects by adding their hashtags. '.
+ 'For example, use `%s` to add the user `alincoln` and the project with '.
+ 'hashtag `#ios` as subscribers.'.
"\n\n".
'Subscribers which are invalid or unrecognized will be ignored. This '.
'command has no effect if you do not specify any subscribers.'.
"\n\n".
'Users who are CC\'d on the email itself are also automatically '.
'subscribed if Phabricator knows which accounts are linked to their '.
- 'email addresses.');
+ 'email addresses.',
+ '!subscribe alincoln #ios');
}
public function getCommandAliases() {
diff --git a/src/applications/system/controller/PhabricatorSystemSelectEncodingController.php b/src/applications/system/controller/PhabricatorSystemSelectEncodingController.php
index 4392f53ada..efbe67882a 100644
--- a/src/applications/system/controller/PhabricatorSystemSelectEncodingController.php
+++ b/src/applications/system/controller/PhabricatorSystemSelectEncodingController.php
@@ -15,9 +15,11 @@ public function processRequest() {
->setTitle(pht('No Encoding Support'))
->appendParagraph(
pht(
- 'This system does not have the "mbstring" extension installed, '.
- 'so character encodings are not supported. Install "mbstring" to '.
- 'enable support.'))
+ 'This system does not have the "%s" extension installed, '.
+ 'so character encodings are not supported. Install "%s" to '.
+ 'enable support.',
+ 'mbstring',
+ 'mbstring'))
->addCancelButton('/');
}
diff --git a/src/applications/system/management/PhabricatorSystemRemoveDestroyWorkflow.php b/src/applications/system/management/PhabricatorSystemRemoveDestroyWorkflow.php
index 2a4244e97f..2abbc52691 100644
--- a/src/applications/system/management/PhabricatorSystemRemoveDestroyWorkflow.php
+++ b/src/applications/system/management/PhabricatorSystemRemoveDestroyWorkflow.php
@@ -54,23 +54,81 @@ public function execute(PhutilArgumentParser $args) {
}
}
+ $banner = <<writeOut("\n\n%s\n\n", $banner);
+
$console->writeOut(
- "**%s**\n\n",
- pht(' IMPORTANT: OBJECTS WILL BE PERMANENTLY DESTROYED! '));
+ "** %s ** %s\n\n%s\n\n".
+ "** %s ** %s\n\n%s\n\n",
+ pht('IMPORTANT'),
+ pht('DATA WILL BE PERMANENTLY DESTROYED'),
+ phutil_console_wrap(
+ pht(
+ 'Objects will be permanently destroyed. There is no way to '.
+ 'undo this operation or ever retrieve this data unless you '.
+ 'maintain external backups.')),
+ pht('IMPORTANT'),
+ pht('DELETING OBJECTS OFTEN BREAKS THINGS'),
+ phutil_console_wrap(
+ pht(
+ 'Destroying objects may cause related objects to stop working, '.
+ 'and may leave scattered references to objects which no longer '.
+ 'exist. In most cases, it is much better to disable or archive '.
+ 'objects instead of destroying them. This risk is greatest when '.
+ 'deleting complex or highly connected objects like repositories, '.
+ 'projects and users.'.
+ "\n\n".
+ 'These tattered edges are an expected consquence of destroying '.
+ 'objects, and the Phabricator upstream will not help you fix '.
+ 'them. We strongly recomend disabling or archiving objects '.
+ 'instead.')));
+
+ $phids = mpull($named_objects, 'getPHID');
+ $handles = PhabricatorUser::getOmnipotentUser()->loadHandles($phids);
$console->writeOut(
pht(
- "There is no way to undo this operation or ever retrieve this data.".
- "\n\n".
- "These %s object(s) will be **completely destroyed forever**:".
- "\n\n",
- new PhutilNumber(count($named_objects))));
+ 'These %s object(s) will be destroyed forever:',
+ new PhutilNumber(count($named_objects)))."\n\n");
foreach ($named_objects as $object_name => $object) {
+ $phid = $object->getPHID();
+
$console->writeOut(
- " - %s (%s)\n",
+ " - %s (%s) %s\n",
$object_name,
- get_class($object));
+ get_class($object),
+ $handles[$phid]->getFullName());
}
$force = $args->getArg('force');
diff --git a/src/applications/tokens/phid/PhabricatorTokenTokenPHIDType.php b/src/applications/tokens/phid/PhabricatorTokenTokenPHIDType.php
index c458c52fbd..1791cc88c7 100644
--- a/src/applications/tokens/phid/PhabricatorTokenTokenPHIDType.php
+++ b/src/applications/tokens/phid/PhabricatorTokenTokenPHIDType.php
@@ -30,7 +30,7 @@ public function loadHandles(
$name = $token->getName();
- $handle->setName("{$name} Token");
+ $handle->setName(pht('%s Token', $name));
}
}
diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionCommentEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionCommentEditor.php
index 23b77fbd1b..94a1cdaa3b 100644
--- a/src/applications/transactions/editor/PhabricatorApplicationTransactionCommentEditor.php
+++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionCommentEditor.php
@@ -121,14 +121,16 @@ private function validateEdit(
if (!$xaction->getPHID()) {
throw new Exception(
- 'Transaction must have a PHID before calling applyEdit()!');
+ pht(
+ 'Transaction must have a PHID before calling %s!',
+ 'applyEdit()'));
}
$type_comment = PhabricatorTransactions::TYPE_COMMENT;
if ($xaction->getTransactionType() == $type_comment) {
if ($comment->getPHID()) {
throw new Exception(
- 'Transaction comment must not yet have a PHID!');
+ pht('Transaction comment must not yet have a PHID!'));
}
}
diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
index 8c9c26bfe9..7c8a1cff42 100644
--- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
+++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
@@ -257,7 +257,10 @@ private function getTransactionOldValue(
case PhabricatorTransactions::TYPE_EDGE:
$edge_type = $xaction->getMetadataValue('edge:type');
if (!$edge_type) {
- throw new Exception("Edge transaction has no 'edge:type'!");
+ throw new Exception(
+ pht(
+ "Edge transaction has no '%s'!",
+ 'edge:type'));
}
$old_edges = array();
@@ -312,13 +315,13 @@ private function getTransactionNewValue(
protected function getCustomTransactionOldValue(
PhabricatorLiskDAO $object,
PhabricatorApplicationTransaction $xaction) {
- throw new Exception('Capability not supported!');
+ throw new Exception(pht('Capability not supported!'));
}
protected function getCustomTransactionNewValue(
PhabricatorLiskDAO $object,
PhabricatorApplicationTransaction $xaction) {
- throw new Exception('Capability not supported!');
+ throw new Exception(pht('Capability not supported!'));
}
protected function transactionHasEffect(
@@ -385,12 +388,11 @@ private function applyInternalEffects(
PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) {
- case PhabricatorTransactions::TYPE_BUILDABLE:
- case PhabricatorTransactions::TYPE_TOKEN:
- return;
case PhabricatorTransactions::TYPE_CUSTOMFIELD:
$field = $this->getCustomFieldForTransaction($object, $xaction);
return $field->applyApplicationTransactionInternalEffects($xaction);
+ case PhabricatorTransactions::TYPE_BUILDABLE:
+ case PhabricatorTransactions::TYPE_TOKEN:
case PhabricatorTransactions::TYPE_VIEW_POLICY:
case PhabricatorTransactions::TYPE_EDIT_POLICY:
case PhabricatorTransactions::TYPE_JOIN_POLICY:
@@ -408,9 +410,6 @@ private function applyExternalEffects(
PhabricatorLiskDAO $object,
PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) {
- case PhabricatorTransactions::TYPE_BUILDABLE:
- case PhabricatorTransactions::TYPE_TOKEN:
- return;
case PhabricatorTransactions::TYPE_SUBSCRIBERS:
$subeditor = id(new PhabricatorSubscriptionsEditor())
->setObject($object)
@@ -442,6 +441,8 @@ private function applyExternalEffects(
$field = $this->getCustomFieldForTransaction($object, $xaction);
return $field->applyApplicationTransactionExternalEffects($xaction);
case PhabricatorTransactions::TYPE_EDGE:
+ case PhabricatorTransactions::TYPE_BUILDABLE:
+ case PhabricatorTransactions::TYPE_TOKEN:
case PhabricatorTransactions::TYPE_VIEW_POLICY:
case PhabricatorTransactions::TYPE_EDIT_POLICY:
case PhabricatorTransactions::TYPE_JOIN_POLICY:
@@ -458,8 +459,9 @@ protected function applyCustomInternalTransaction(
PhabricatorApplicationTransaction $xaction) {
$type = $xaction->getTransactionType();
throw new Exception(
- "Transaction type '{$type}' is missing an internal apply ".
- "implementation!");
+ pht(
+ "Transaction type '%s' is missing an internal apply implementation!",
+ $type));
}
protected function applyCustomExternalTransaction(
@@ -467,15 +469,22 @@ protected function applyCustomExternalTransaction(
PhabricatorApplicationTransaction $xaction) {
$type = $xaction->getTransactionType();
throw new Exception(
- "Transaction type '{$type}' is missing an external apply ".
- "implementation!");
+ pht(
+ "Transaction type '%s' is missing an external apply implementation!",
+ $type));
}
- // TODO: Write proper documentation for these hooks. These are like the
- // "applyCustom" hooks, except that implementation is optional, so you do
- // not need to handle all of the builtin transaction types. See T6403. These
- // are not completely implemented.
-
+ /**
+ * @{class:PhabricatorTransactions} provides many built-in transactions
+ * which should not require much - if any - code in specific applications.
+ *
+ * This method is a hook for the exceedingly-rare cases where you may need
+ * to do **additional** work for built-in transactions. Developers should
+ * extend this method, making sure to return the parent implementation
+ * regardless of handling any transactions.
+ *
+ * See also @{method:applyBuiltinExternalTransaction}.
+ */
protected function applyBuiltinInternalTransaction(
PhabricatorLiskDAO $object,
PhabricatorApplicationTransaction $xaction) {
@@ -493,6 +502,9 @@ protected function applyBuiltinInternalTransaction(
}
}
+ /**
+ * See @{method::applyBuiltinInternalTransaction}.
+ */
protected function applyBuiltinExternalTransaction(
PhabricatorLiskDAO $object,
PhabricatorApplicationTransaction $xaction) {
@@ -1006,27 +1018,28 @@ private function validateEditParameters(
if ($xaction->getPHID() || $xaction->getID()) {
throw new PhabricatorApplicationTransactionStructureException(
$xaction,
- pht(
- 'You can not apply transactions which already have IDs/PHIDs!'));
+ pht('You can not apply transactions which already have IDs/PHIDs!'));
}
if ($xaction->getObjectPHID()) {
throw new PhabricatorApplicationTransactionStructureException(
$xaction,
pht(
- 'You can not apply transactions which already have objectPHIDs!'));
+ 'You can not apply transactions which already have %s!',
+ 'objectPHIDs'));
}
if ($xaction->getAuthorPHID()) {
throw new PhabricatorApplicationTransactionStructureException(
$xaction,
pht(
- 'You can not apply transactions which already have authorPHIDs!'));
+ 'You can not apply transactions which already have %s!',
+ 'authorPHIDs'));
}
if ($xaction->getCommentPHID()) {
throw new PhabricatorApplicationTransactionStructureException(
$xaction,
pht(
- 'You can not apply transactions which already have '.
- 'commentPHIDs!'));
+ 'You can not apply transactions which already have %s!',
+ 'commentPHIDs'));
}
if ($xaction->getCommentVersion() !== 0) {
throw new PhabricatorApplicationTransactionStructureException(
@@ -1043,16 +1056,17 @@ private function validateEditParameters(
throw new PhabricatorApplicationTransactionStructureException(
$xaction,
pht(
- 'This transaction is supposed to have an oldValue set, but '.
- 'it does not!'));
+ 'This transaction is supposed to have an %s set, but it does not!',
+ 'oldValue'));
}
if ($has_value && !$expect_value) {
throw new PhabricatorApplicationTransactionStructureException(
$xaction,
pht(
- 'This transaction should generate its oldValue automatically, '.
- 'but has already had one set!'));
+ 'This transaction should generate its %s automatically, '.
+ 'but has already had one set!',
+ 'oldValue'));
}
$type = $xaction->getTransactionType();
@@ -1490,8 +1504,13 @@ protected function getPHIDTransactionNewValue(
if ($new) {
throw new Exception(
- "Invalid 'new' value for PHID transaction. Value should contain only ".
- "keys '+' (add PHIDs), '-' (remove PHIDs) and '=' (set PHIDS).");
+ pht(
+ "Invalid '%s' value for PHID transaction. Value should contain only ".
+ "keys '%s' (add PHIDs), '%' (remove PHIDs) and '%s' (set PHIDS).",
+ 'new',
+ '+',
+ '-',
+ '='));
}
$result = array();
@@ -1533,8 +1552,13 @@ protected function getEdgeTransactionNewValue(
if ($new) {
throw new Exception(
- "Invalid 'new' value for Edge transaction. Value should contain only ".
- "keys '+' (add edges), '-' (remove edges) and '=' (set edges).");
+ pht(
+ "Invalid '%s' value for Edge transaction. Value should contain only ".
+ "keys '%s' (add edges), '%s' (remove edges) and '%s' (set edges).",
+ 'new',
+ '+',
+ '-',
+ '='));
}
$old = $xaction->getOldValue();
@@ -1585,13 +1609,17 @@ private function checkEdgeList($list) {
foreach ($list as $key => $item) {
if (phid_get_type($key) === PhabricatorPHIDConstants::PHID_TYPE_UNKNOWN) {
throw new Exception(
- "Edge transactions must have destination PHIDs as in edge ".
- "lists (found key '{$key}').");
+ pht(
+ "Edge transactions must have destination PHIDs as in edge ".
+ "lists (found key '%s').",
+ $key));
}
if (!is_array($item) && $item !== $key) {
throw new Exception(
- "Edge transactions must have PHIDs or edge specs as values ".
- "(found value '{$item}').");
+ pht(
+ "Edge transactions must have PHIDs or edge specs as values ".
+ "(found value '%s').",
+ $item));
}
}
}
@@ -1624,8 +1652,7 @@ private function normalizeEdgeTransactionValue(
default:
throw new Exception(
pht(
- 'Transaction edge specification contains unexpected key '.
- '"%s".',
+ 'Transaction edge specification contains unexpected key "%s".',
$key));
}
}
@@ -1640,9 +1667,12 @@ private function normalizeEdgeTransactionValue(
if ($edge['type'] != $edge_type) {
$this_type = $edge['type'];
throw new Exception(
- "Edge transaction includes edge of type '{$this_type}', but ".
- "transaction is of type '{$edge_type}'. Each edge transaction must ".
- "alter edges of only one type.");
+ pht(
+ "Edge transaction includes edge of type '%s', but ".
+ "transaction is of type '%s'. Each edge transaction ".
+ "must alter edges of only one type.",
+ $this_type,
+ $edge_type));
}
}
@@ -1834,11 +1864,12 @@ private function validatePolicyTransaction(
$errors[] = new PhabricatorApplicationTransactionValidationError(
$transaction_type,
pht('Invalid'),
- pht('The selected %s policy excludes you. Choose a %s policy '.
- 'which allows you to %s the object.',
- $capability,
- $capability,
- $capability));
+ pht(
+ 'The selected %s policy excludes you. Choose a %s policy '.
+ 'which allows you to %s the object.',
+ $capability,
+ $capability,
+ $capability));
}
}
}
@@ -2141,14 +2172,14 @@ protected function getStrongestAction(
* @task mail
*/
protected function buildReplyHandler(PhabricatorLiskDAO $object) {
- throw new Exception('Capability not supported.');
+ throw new Exception(pht('Capability not supported.'));
}
/**
* @task mail
*/
protected function getMailSubjectPrefix() {
- throw new Exception('Capability not supported.');
+ throw new Exception(pht('Capability not supported.'));
}
@@ -2190,7 +2221,7 @@ protected function getMailAction(
* @task mail
*/
protected function buildMailTemplate(PhabricatorLiskDAO $object) {
- throw new Exception('Capability not supported.');
+ throw new Exception(pht('Capability not supported.'));
}
@@ -2198,7 +2229,7 @@ protected function buildMailTemplate(PhabricatorLiskDAO $object) {
* @task mail
*/
protected function getMailTo(PhabricatorLiskDAO $object) {
- throw new Exception('Capability not supported.');
+ throw new Exception(pht('Capability not supported.'));
}
@@ -2255,7 +2286,7 @@ protected function getMailCC(PhabricatorLiskDAO $object) {
}
if (!$has_support) {
- throw new Exception('Capability not supported.');
+ throw new Exception(pht('Capability not supported.'));
}
return array_mergev($phids);
@@ -2477,7 +2508,7 @@ protected function shouldApplyHeraldRules(
protected function buildHeraldAdapter(
PhabricatorLiskDAO $object,
array $xactions) {
- throw new Exception('No herald adapter specified.');
+ throw new Exception(pht('No herald adapter specified.'));
}
private function setHeraldAdapter(HeraldAdapter $adapter) {
@@ -2539,7 +2570,9 @@ private function getCustomFieldForTransaction(
$field_key = $xaction->getMetadataValue('customfield:key');
if (!$field_key) {
throw new Exception(
- "Custom field transaction has no 'customfield:key'!");
+ pht(
+ "Custom field transaction has no '%s'!",
+ 'customfield:key'));
}
$field = PhabricatorCustomField::getObjectField(
@@ -2549,14 +2582,20 @@ private function getCustomFieldForTransaction(
if (!$field) {
throw new Exception(
- "Custom field transaction has invalid 'customfield:key'; field ".
- "'{$field_key}' is disabled or does not exist.");
+ pht(
+ "Custom field transaction has invalid '%s'; field '%s' ".
+ "is disabled or does not exist.",
+ 'customfield:key',
+ $field_key));
}
if (!$field->shouldAppearInApplicationTransactions()) {
throw new Exception(
- "Custom field transaction '{$field_key}' does not implement ".
- "integration for ApplicationTransactions.");
+ pht(
+ "Custom field transaction '%s' does not implement ".
+ "integration for %s.",
+ $field_key,
+ 'ApplicationTransactions'));
}
$field->setViewer($this->getActor());
diff --git a/src/applications/transactions/exception/PhabricatorApplicationTransactionValidationException.php b/src/applications/transactions/exception/PhabricatorApplicationTransactionValidationException.php
index edc8d97985..2ed1f54feb 100644
--- a/src/applications/transactions/exception/PhabricatorApplicationTransactionValidationException.php
+++ b/src/applications/transactions/exception/PhabricatorApplicationTransactionValidationException.php
@@ -13,7 +13,7 @@ public function __construct(array $errors) {
$this->errors = $errors;
$message = array();
- $message[] = 'Validation errors:';
+ $message[] = pht('Validation errors:');
foreach ($this->errors as $error) {
$message[] = ' - '.$error->getMessage();
}
diff --git a/src/applications/transactions/storage/PhabricatorApplicationTransaction.php b/src/applications/transactions/storage/PhabricatorApplicationTransaction.php
index 355f15c2a7..a6c1715115 100644
--- a/src/applications/transactions/storage/PhabricatorApplicationTransaction.php
+++ b/src/applications/transactions/storage/PhabricatorApplicationTransaction.php
@@ -137,7 +137,7 @@ public function hasComment() {
public function getComment() {
if ($this->commentNotLoaded) {
- throw new Exception('Comment for this transaction was not loaded.');
+ throw new Exception(pht('Comment for this transaction was not loaded.'));
}
return $this->comment;
}
@@ -292,8 +292,7 @@ public function getHandleIfExists($phid) {
public function getHandles() {
if ($this->handles === null) {
throw new Exception(
- 'Transaction requires handles and it did not load them.'
- );
+ pht('Transaction requires handles and it did not load them.'));
}
return $this->handles;
}
diff --git a/src/applications/transactions/view/PhabricatorApplicationTransactionView.php b/src/applications/transactions/view/PhabricatorApplicationTransactionView.php
index 2a8575e3c3..021abfb91b 100644
--- a/src/applications/transactions/view/PhabricatorApplicationTransactionView.php
+++ b/src/applications/transactions/view/PhabricatorApplicationTransactionView.php
@@ -194,7 +194,7 @@ public function buildEvents($with_hiding = false) {
public function render() {
if (!$this->getObjectPHID()) {
- throw new Exception('Call setObjectPHID() before render()!');
+ throw new PhutilInvalidStateException('setObjectPHID');
}
$view = $this->buildPHUITimelineView();
@@ -208,8 +208,7 @@ public function render() {
public function buildPHUITimelineView($with_hiding = true) {
if (!$this->getObjectPHID()) {
- throw new Exception(
- 'Call setObjectPHID() before buildPHUITimelineView()!');
+ throw new PhutilInvalidStateException('setObjectPHID');
}
$view = new PHUITimelineView();
diff --git a/src/applications/typeahead/controller/PhabricatorTypeaheadFunctionHelpController.php b/src/applications/typeahead/controller/PhabricatorTypeaheadFunctionHelpController.php
index dd29069ee5..851551d77f 100644
--- a/src/applications/typeahead/controller/PhabricatorTypeaheadFunctionHelpController.php
+++ b/src/applications/typeahead/controller/PhabricatorTypeaheadFunctionHelpController.php
@@ -93,25 +93,21 @@ public function handleRequest(AphrontRequest $request) {
$content[] = '= '.pht('Using Typeahead Functions');
$content[] = pht(
- 'In addition to typing user and project names to build queries, you can '.
- 'also type the names of special functions which give you more options '.
- 'and the ability to express more complex queries.'.
- "\n\n".
- 'Functions have an internal name (like `viewer()`) and a '.
- 'human-readable name, like `Current Viewer`. In general, you can type '.
- 'either one to select the function. You can also click the '.
- '{nav icon=search} button on any typeahead control to browse available '.
- 'functions and find this documentation.'.
- "\n\n".
- 'This documentation uses the internal names to make it clear where '.
- 'tokens begin and end. Specifically, you will find queries written '.
- 'out like this in the documentation: '.
- "\n\n".
- '> viewer(), alincoln'.
- "\n\n".
- 'When this query is actually shown in the control, it will look more '.
- 'like this:'.
- "\n\n".
+ "In addition to typing user and project names to build queries, you can ".
+ "also type the names of special functions which give you more options ".
+ "and the ability to express more complex queries.\n\n".
+ "Functions have an internal name (like `%s`) and a human-readable name, ".
+ "like `Current Viewer`. In general, you can type either one to select ".
+ "the function. You can also click the {nav icon=search} button on any ".
+ "typeahead control to browse available functions and find this ".
+ "documentation.\n\n".
+ "This documentation uses the internal names to make it clear where ".
+ "tokens begin and end. Specifically, you will find queries written ".
+ "out like this in the documentation:\n\n%s\n\n".
+ "When this query is actually shown in the control, it will look more ".
+ "like this:\n\n%s",
+ 'viewer()',
+ '> viewer(), alincoln',
'> {nav Current Viewer} {nav alincoln (Abraham Lincoln)}');
diff --git a/src/applications/uiexample/examples/JavelinReactorUIExample.php b/src/applications/uiexample/examples/JavelinReactorUIExample.php
index 9104c84c27..9e47545072 100644
--- a/src/applications/uiexample/examples/JavelinReactorUIExample.php
+++ b/src/applications/uiexample/examples/JavelinReactorUIExample.php
@@ -3,11 +3,11 @@
final class JavelinReactorUIExample extends PhabricatorUIExample {
public function getName() {
- return 'Javelin Reactor';
+ return pht('Javelin Reactor');
}
public function getDescription() {
- return 'Lots of code';
+ return pht('Lots of code');
}
public function renderExample() {
@@ -15,55 +15,59 @@ public function renderExample() {
$examples = array(
array(
- 'Reactive button only generates a stream of events',
+ pht('Reactive button only generates a stream of events'),
'ReactorButtonExample',
'phabricator-uiexample-reactor-button',
array(),
),
array(
- 'Reactive checkbox generates a boolean dynamic value',
+ pht('Reactive checkbox generates a boolean dynamic value'),
'ReactorCheckboxExample',
'phabricator-uiexample-reactor-checkbox',
array('checked' => true),
),
array(
- 'Reactive focus detector generates a boolean dynamic value',
+ pht('Reactive focus detector generates a boolean dynamic value'),
'ReactorFocusExample',
'phabricator-uiexample-reactor-focus',
array(),
),
array(
- 'Reactive input box, with normal and calmed output',
+ pht('Reactive input box, with normal and calmed output'),
'ReactorInputExample',
'phabricator-uiexample-reactor-input',
array('init' => 'Initial value'),
),
array(
- 'Reactive mouseover detector generates a boolean dynamic value',
+ pht('Reactive mouseover detector generates a boolean dynamic value'),
'ReactorMouseoverExample',
'phabricator-uiexample-reactor-mouseover',
array(),
),
array(
- 'Reactive radio buttons generate a string dynamic value',
+ pht('Reactive radio buttons generate a string dynamic value'),
'ReactorRadioExample',
'phabricator-uiexample-reactor-radio',
array(),
),
array(
- 'Reactive select box generates a string dynamic value',
+ pht('Reactive select box generates a string dynamic value'),
'ReactorSelectExample',
'phabricator-uiexample-reactor-select',
array(),
),
array(
- 'sendclass makes the class of an element a string dynamic value',
+ pht(
+ '%s makes the class of an element a string dynamic value',
+ 'sendclass'),
'ReactorSendClassExample',
'phabricator-uiexample-reactor-sendclass',
array(),
),
array(
- 'sendproperties makes some properties of an object into dynamic values',
+ pht(
+ '%s makes some properties of an object into dynamic values',
+ 'sendproperties'),
'ReactorSendPropertiesExample',
'phabricator-uiexample-reactor-sendproperties',
array(),
diff --git a/src/applications/uiexample/examples/JavelinUIExample.php b/src/applications/uiexample/examples/JavelinUIExample.php
index 5976066bd2..c85a2d4cde 100644
--- a/src/applications/uiexample/examples/JavelinUIExample.php
+++ b/src/applications/uiexample/examples/JavelinUIExample.php
@@ -3,11 +3,11 @@
final class JavelinUIExample extends PhabricatorUIExample {
public function getName() {
- return 'Javelin UI';
+ return pht('Javelin UI');
}
public function getDescription() {
- return 'Here are some Javelin UI elements that you could use.';
+ return pht('Here are some Javelin UI elements that you could use.');
}
public function renderExample() {
@@ -34,7 +34,7 @@ public function renderExample() {
),
),
),
- 'Toggle Red Border');
+ pht('Toggle Red Border'));
$button_blue = javelin_tag(
'a',
@@ -51,7 +51,7 @@ public function renderExample() {
),
),
),
- 'Toggle Blue Background');
+ pht('Toggle Blue Background'));
$div = phutil_tag(
'div',
diff --git a/src/applications/uiexample/examples/JavelinViewUIExample.php b/src/applications/uiexample/examples/JavelinViewUIExample.php
index 73389475a7..f7df1749b4 100644
--- a/src/applications/uiexample/examples/JavelinViewUIExample.php
+++ b/src/applications/uiexample/examples/JavelinViewUIExample.php
@@ -3,11 +3,11 @@
final class JavelinViewUIExample extends PhabricatorUIExample {
public function getName() {
- return 'Javelin Views';
+ return pht('Javelin Views');
}
public function getDescription() {
- return 'Mix and match client and server views.';
+ return pht('Mix and match client and server views.');
}
public function renderExample() {
@@ -33,7 +33,7 @@ public function renderExample() {
$parent_server_template->appendChild($parent_client_template);
$parent_client_template->appendChild($child_server_template);
$child_server_template->appendChild($child_client_template);
- $child_client_template->appendChild('Hey, it worked.');
+ $child_client_template->appendChild(pht('Hey, it worked.'));
$panel = new PHUIObjectBoxView();
$panel->setHeaderText(pht('Example'));
diff --git a/src/applications/uiexample/examples/PHUIActionHeaderExample.php b/src/applications/uiexample/examples/PHUIActionHeaderExample.php
index 5962871f63..57a9435a94 100644
--- a/src/applications/uiexample/examples/PHUIActionHeaderExample.php
+++ b/src/applications/uiexample/examples/PHUIActionHeaderExample.php
@@ -3,11 +3,11 @@
final class PHUIActionHeaderExample extends PhabricatorUIExample {
public function getName() {
- return 'Action Headers';
+ return pht('Action Headers');
}
public function getDescription() {
- return 'Various header layouts with and without icons';
+ return pht('Various header layouts with and without icons');
}
public function renderExample() {
@@ -17,26 +17,26 @@ public function renderExample() {
->setHeader(pht('Header Plain'));
$header1 = id(new PHUIActionHeaderView())
- ->setHeaderTitle('Colorless');
+ ->setHeaderTitle(pht('Colorless'));
$header2 = id(new PHUIActionHeaderView())
- ->setHeaderTitle('Light Grey')
+ ->setHeaderTitle(pht('Light Grey'))
->setHeaderColor(PHUIActionHeaderView::HEADER_GREY);
$header3 = id(new PHUIActionHeaderView())
- ->setHeaderTitle('Light Blue')
+ ->setHeaderTitle(pht('Light Blue'))
->setHeaderColor(PHUIActionHeaderView::HEADER_LIGHTBLUE);
$header4 = id(new PHUIActionHeaderView())
- ->setHeaderTitle('Light Green')
+ ->setHeaderTitle(pht('Light Green'))
->setHeaderColor(PHUIActionHeaderView::HEADER_LIGHTGREEN);
$header5 = id(new PHUIActionHeaderView())
- ->setHeaderTitle('Light Red')
+ ->setHeaderTitle(pht('Light Red'))
->setHeaderColor(PHUIActionHeaderView::HEADER_LIGHTRED);
$header6 = id(new PHUIActionHeaderView())
- ->setHeaderTitle('Light Violet')
+ ->setHeaderTitle(pht('Light Violet'))
->setHeaderColor(PHUIActionHeaderView::HEADER_LIGHTVIOLET);
$layout1 = id(new AphrontMultiColumnView())
@@ -53,7 +53,7 @@ public function renderExample() {
->appendChild($layout1)
->addMargin(PHUI::MARGIN_LARGE);
-/* Policy Icons */
+ // Policy Icons
$title2 = id(new PHUIHeaderView())
->setHeader(pht('With Icons'));
@@ -113,7 +113,7 @@ public function renderExample() {
->addMargin(PHUI::MARGIN_LARGE);
-/* Action Icons */
+ // Action Icons
$title3 = id(new PHUIHeaderView())
->setHeader(pht('With Action Icons'));
@@ -142,18 +142,18 @@ public function renderExample() {
$action6->setHref('#');
$header1 = id(new PHUIActionHeaderView())
- ->setHeaderTitle('Company')
+ ->setHeaderTitle(pht('Company'))
->setHeaderHref('http://example.com/')
->addAction($action1);
$header2 = id(new PHUIActionHeaderView())
- ->setHeaderTitle('Public')
+ ->setHeaderTitle(pht('Public'))
->setHeaderHref('http://example.com/')
->setHeaderColor(PHUIActionHeaderView::HEADER_GREY)
->addAction($action1);
$header3 = id(new PHUIActionHeaderView())
- ->setHeaderTitle('Restricted')
+ ->setHeaderTitle(pht('Restricted'))
->setHeaderHref('http://example.com/')
->setHeaderColor(PHUIActionHeaderView::HEADER_LIGHTBLUE)
->addAction($action2);
@@ -191,51 +191,51 @@ public function renderExample() {
->appendChild($layout3)
->addMargin(PHUI::MARGIN_LARGE);
-/* Action Icons */
+ // Action Icons
$title4 = id(new PHUIHeaderView())
->setHeader(pht('With Tags'));
$tag1 = id(new PHUITagView())
->setType(PHUITagView::TYPE_STATE)
->setBackgroundColor(PHUITagView::COLOR_RED)
- ->setName('Open');
+ ->setName(pht('Open'));
$tag2 = id(new PHUITagView())
->setType(PHUITagView::TYPE_STATE)
->setBackgroundColor(PHUITagView::COLOR_BLUE)
- ->setName('Closed');
+ ->setName(pht('Closed'));
$action1 = new PHUIIconView();
$action1->setIconFont('fa-flag');
$action1->setHref('#');
$header1 = id(new PHUIActionHeaderView())
- ->setHeaderTitle('Company')
+ ->setHeaderTitle(pht('Company'))
->setTag($tag2);
$header2 = id(new PHUIActionHeaderView())
- ->setHeaderTitle('Public')
+ ->setHeaderTitle(pht('Public'))
->setHeaderColor(PHUIActionHeaderView::HEADER_GREY)
->addAction($action1)
->setTag($tag1);
$header3 = id(new PHUIActionHeaderView())
- ->setHeaderTitle('Restricted')
+ ->setHeaderTitle(pht('Restricted'))
->setHeaderColor(PHUIActionHeaderView::HEADER_LIGHTBLUE)
->setTag($tag2);
$header4 = id(new PHUIActionHeaderView())
- ->setHeaderTitle('Company')
+ ->setHeaderTitle(pht('Company'))
->setHeaderColor(PHUIActionHeaderView::HEADER_LIGHTGREEN)
->setTag($tag1);
$header5 = id(new PHUIActionHeaderView())
- ->setHeaderTitle('Public')
+ ->setHeaderTitle(pht('Public'))
->setHeaderColor(PHUIActionHeaderView::HEADER_LIGHTRED)
->setTag($tag2);
$header6 = id(new PHUIActionHeaderView())
- ->setHeaderTitle('Restricted')
+ ->setHeaderTitle(pht('Restricted'))
->setHeaderColor(PHUIActionHeaderView::HEADER_LIGHTVIOLET)
->setTag($tag1);
diff --git a/src/applications/uiexample/examples/PHUIActionPanelExample.php b/src/applications/uiexample/examples/PHUIActionPanelExample.php
index 229cfec4be..cbffbf6124 100644
--- a/src/applications/uiexample/examples/PHUIActionPanelExample.php
+++ b/src/applications/uiexample/examples/PHUIActionPanelExample.php
@@ -3,11 +3,11 @@
final class PHUIActionPanelExample extends PhabricatorUIExample {
public function getName() {
- return 'Action Panel';
+ return pht('Action Panel');
}
public function getDescription() {
- return 'A panel with strong tendencies for inciting ACTION!';
+ return pht('A panel with strong tendencies for inciting ACTION!');
}
public function renderExample() {
@@ -30,7 +30,7 @@ public function renderExample() {
->setFontIcon('fa-server')
->setHeader(pht('Launch Instance'))
->setHref('#')
- ->setSubHeader(pht('Maybe this is what you\'re likely here for.'))
+ ->setSubHeader(pht("Maybe this is what you're likely here for."))
->setStatus(pht('You have no instances.'))
->setState(PHUIActionPanelView::STATE_ERROR);
$view->addColumn($panel2);
diff --git a/src/applications/uiexample/examples/PHUIBoxExample.php b/src/applications/uiexample/examples/PHUIBoxExample.php
index a8999f5cf9..1f372c4cd6 100644
--- a/src/applications/uiexample/examples/PHUIBoxExample.php
+++ b/src/applications/uiexample/examples/PHUIBoxExample.php
@@ -3,18 +3,18 @@
final class PHUIBoxExample extends PhabricatorUIExample {
public function getName() {
- return 'Box';
+ return pht('Box');
}
public function getDescription() {
- return 'It\'s a fancy or non-fancy box. Put stuff in it.';
+ return pht("It's a fancy or non-fancy box. Put stuff in it.");
}
public function renderExample() {
$content1 = 'Asmund and Signy';
$content2 = 'The Cottager and his Cat';
- $content3 = 'Geirlug The King\'s Daughter';
+ $content3 = "Geirlug The King's Daughter";
$layout1 =
array(
@@ -67,18 +67,18 @@ public function renderExample() {
->setTag('a')
->setColor(PHUIButtonView::SIMPLE)
->setIcon($image)
- ->setText('Such Wow')
+ ->setText(pht('Such Wow'))
->addClass(PHUI::MARGIN_SMALL_RIGHT);
$header = id(new PHUIHeaderView())
- ->setHeader('Fancy Box')
+ ->setHeader(pht('Fancy Box'))
->addActionLink($button);
$obj4 = id(new PHUIObjectBoxView())
->setHeader($header)
->appendChild(id(new PHUIBoxView())
->addPadding(PHUI::PADDING_MEDIUM)
- ->appendChild('Such Fancy, Nice Box, Many Corners.'));
+ ->appendChild(pht('Such Fancy, Nice Box, Many Corners.')));
$head1 = id(new PHUIHeaderView())
->setHeader(pht('Plain Box'));
diff --git a/src/applications/uiexample/examples/PHUIButtonBarExample.php b/src/applications/uiexample/examples/PHUIButtonBarExample.php
index 293cd2336a..8e00a99436 100644
--- a/src/applications/uiexample/examples/PHUIButtonBarExample.php
+++ b/src/applications/uiexample/examples/PHUIButtonBarExample.php
@@ -74,7 +74,7 @@ public function renderExample() {
->addClass('mlr mll mlb');
$wrap1 = id(new PHUIObjectBoxView())
- ->setHeaderText('Button Bar Example')
+ ->setHeaderText(pht('Button Bar Example'))
->appendChild($layout1)
->appendChild($layout2)
->appendChild($layout3);
diff --git a/src/applications/uiexample/examples/PHUIButtonExample.php b/src/applications/uiexample/examples/PHUIButtonExample.php
index 218e97e958..216a4a4406 100644
--- a/src/applications/uiexample/examples/PHUIButtonExample.php
+++ b/src/applications/uiexample/examples/PHUIButtonExample.php
@@ -3,11 +3,13 @@
final class PHUIButtonExample extends PhabricatorUIExample {
public function getName() {
- return 'Buttons';
+ return pht('Buttons');
}
public function getDescription() {
- return hsprintf('Use <button> to render buttons.');
+ return pht(
+ 'Use %s to render buttons.',
+ phutil_tag('tt', array(), '<button>'));
}
public function renderExample() {
@@ -79,7 +81,7 @@ public function renderExample() {
->setColor($color)
->setSize($size)
->setTag('a')
- ->setText('Clicky');
+ ->setText(pht('Clicky'));
$column[$key][] = hsprintf('
%s', $billing_title, $shipping))
diff --git a/src/applications/uiexample/examples/PhabricatorNotificationUIExample.php b/src/applications/uiexample/examples/PhabricatorNotificationUIExample.php
index c9d0d85e53..1b825693fa 100644
--- a/src/applications/uiexample/examples/PhabricatorNotificationUIExample.php
+++ b/src/applications/uiexample/examples/PhabricatorNotificationUIExample.php
@@ -3,15 +3,16 @@
final class PhabricatorNotificationUIExample extends PhabricatorUIExample {
public function getName() {
- return 'Notifications';
+ return pht('Notifications');
}
public function getDescription() {
- return hsprintf('Use JX.Notification to create notifications.');
+ return pht(
+ 'Use %s to create notifications.',
+ phutil_tag('tt', array(), 'JX.Notification'));
}
public function renderExample() {
-
require_celerity_resource('phabricator-notification-css');
Javelin::initBehavior('phabricator-notification-example');
@@ -21,7 +22,7 @@ public function renderExample() {
'sigil' => 'notification-example',
'class' => 'button green',
),
- 'Show Notification');
+ pht('Show Notification'));
$content = hsprintf('
%s
', $content);
diff --git a/src/applications/uiexample/examples/PhabricatorPagerUIExample.php b/src/applications/uiexample/examples/PhabricatorPagerUIExample.php
index cb5212d046..e2e938a302 100644
--- a/src/applications/uiexample/examples/PhabricatorPagerUIExample.php
+++ b/src/applications/uiexample/examples/PhabricatorPagerUIExample.php
@@ -3,17 +3,17 @@
final class PhabricatorPagerUIExample extends PhabricatorUIExample {
public function getName() {
- return 'Pager';
+ return pht('Pager');
}
public function getDescription() {
- return hsprintf(
- 'Use AphrontPagerView to create a control which allows '.
- 'users to paginate through large amounts of content.');
+ return pht(
+ 'Use %s to create a control which allows '.
+ 'users to paginate through large amounts of content.',
+ phutil_tag('tt', array(), 'AphrontPagerView'));
}
public function renderExample() {
-
$request = $this->getRequest();
$offset = (int)$request->getInt('offset');
@@ -37,9 +37,10 @@ public function renderExample() {
$panel->appendChild($table);
$panel->appendChild(hsprintf(
- '
'.
- 'Use AphrontPagerView to render a pager element.'.
- '
'));
+ '
%s
',
+ pht(
+ 'Use %s to render a pager element.',
+ phutil_tag('tt', array(), 'AphrontPagerView'))));
$pager = new AphrontPagerView();
$pager->setPageSize($page_size);
@@ -49,9 +50,8 @@ public function renderExample() {
$panel->appendChild($pager);
$panel->appendChild(hsprintf(
- '
'.
- 'You can show more or fewer pages of surrounding context.'.
- '
'));
+ '
%s
',
+ pht('You can show more or fewer pages of surrounding context.')));
$many_pages_pager = new AphrontPagerView();
$many_pages_pager->setPageSize($page_size);
@@ -62,11 +62,12 @@ public function renderExample() {
$panel->appendChild($many_pages_pager);
$panel->appendChild(hsprintf(
- '
'.
+ '
%s
',
+ pht(
'When it is prohibitively expensive or complex to attain a complete '.
'count of the items, you can select one extra item and set '.
- 'hasMorePages(true) if it exists, creating an inexact pager.'.
- ''));
+ '%s if it exists, creating an inexact pager.',
+ phutil_tag('tt', array(), 'hasMorePages(true)'))));
$inexact_pager = new AphrontPagerView();
$inexact_pager->setPageSize($page_size);
diff --git a/src/applications/uiexample/examples/PhabricatorSetupIssueUIExample.php b/src/applications/uiexample/examples/PhabricatorSetupIssueUIExample.php
index a166a3dc8a..e5370d30cf 100644
--- a/src/applications/uiexample/examples/PhabricatorSetupIssueUIExample.php
+++ b/src/applications/uiexample/examples/PhabricatorSetupIssueUIExample.php
@@ -3,11 +3,11 @@
final class PhabricatorSetupIssueUIExample extends PhabricatorUIExample {
public function getName() {
- return 'Setup Issue';
+ return pht('Setup Issue');
}
public function getDescription() {
- return 'Setup errors and warnings.';
+ return pht('Setup errors and warnings.');
}
public function renderExample() {
diff --git a/src/applications/uiexample/examples/PhabricatorSortTableUIExample.php b/src/applications/uiexample/examples/PhabricatorSortTableUIExample.php
index 7ed2cdce2b..7911710815 100644
--- a/src/applications/uiexample/examples/PhabricatorSortTableUIExample.php
+++ b/src/applications/uiexample/examples/PhabricatorSortTableUIExample.php
@@ -3,11 +3,11 @@
final class PhabricatorSortTableUIExample extends PhabricatorUIExample {
public function getName() {
- return 'Sortable Tables';
+ return pht('Sortable Tables');
}
public function getDescription() {
- return 'Using sortable tables.';
+ return pht('Using sortable tables.');
}
public function renderExample() {
@@ -66,11 +66,11 @@ public function renderExample() {
$table = new AphrontTableView($rows);
$table->setHeaders(
array(
- 'Make',
- 'Model',
- 'Year',
- 'Price',
- 'Color',
+ pht('Make'),
+ pht('Model'),
+ pht('Year'),
+ pht('Price'),
+ pht('Color'),
));
$table->setColumnClasses(
array(
@@ -88,7 +88,7 @@ public function renderExample() {
$orders);
$panel = new PHUIObjectBoxView();
- $panel->setHeaderText('Sortable Table of Vehicles');
+ $panel->setHeaderText(pht('Sortable Table of Vehicles'));
$panel->appendChild($table);
return $panel;
diff --git a/src/applications/uiexample/examples/PhabricatorStatusUIExample.php b/src/applications/uiexample/examples/PhabricatorStatusUIExample.php
index 16961885be..6583bc5848 100644
--- a/src/applications/uiexample/examples/PhabricatorStatusUIExample.php
+++ b/src/applications/uiexample/examples/PhabricatorStatusUIExample.php
@@ -3,16 +3,16 @@
final class PhabricatorStatusUIExample extends PhabricatorUIExample {
public function getName() {
- return 'Status List';
+ return pht('Status List');
}
public function getDescription() {
- return hsprintf(
- 'Use PHUIStatusListView to show relationships with objects.');
+ return pht(
+ 'Use %s to show relationships with objects.',
+ phutil_tag('tt', array(), 'PHUIStatusListView'));
}
public function renderExample() {
-
$out = array();
$view = new PHUIStatusListView();
diff --git a/src/applications/uiexample/examples/PhabricatorTooltipUIExample.php b/src/applications/uiexample/examples/PhabricatorTooltipUIExample.php
index d93aa3a094..373161612a 100644
--- a/src/applications/uiexample/examples/PhabricatorTooltipUIExample.php
+++ b/src/applications/uiexample/examples/PhabricatorTooltipUIExample.php
@@ -3,11 +3,13 @@
final class PhabricatorTooltipUIExample extends PhabricatorUIExample {
public function getName() {
- return 'Tooltips';
+ return pht('Tooltips');
}
public function getDescription() {
- return hsprintf('Use JX.Tooltip to create tooltips.');
+ return pht(
+ 'Use %s to create tooltips.',
+ phutil_tag('tt', array(), 'JX.Tooltip'));
}
public function renderExample() {
diff --git a/src/applications/uiexample/examples/PhabricatorTwoColumnUIExample.php b/src/applications/uiexample/examples/PhabricatorTwoColumnUIExample.php
index a77b068705..fd9b422a26 100644
--- a/src/applications/uiexample/examples/PhabricatorTwoColumnUIExample.php
+++ b/src/applications/uiexample/examples/PhabricatorTwoColumnUIExample.php
@@ -3,11 +3,11 @@
final class PhabricatorTwoColumnUIExample extends PhabricatorUIExample {
public function getName() {
- return 'Two Column Layout';
+ return pht('Two Column Layout');
}
public function getDescription() {
- return 'Two Column mobile friendly layout';
+ return pht('Two Column mobile friendly layout');
}
public function renderExample() {
diff --git a/src/applications/uiexample/examples/PhabricatorUIExample.php b/src/applications/uiexample/examples/PhabricatorUIExample.php
index 0afe5447a2..2f2ffe0b55 100644
--- a/src/applications/uiexample/examples/PhabricatorUIExample.php
+++ b/src/applications/uiexample/examples/PhabricatorUIExample.php
@@ -29,10 +29,11 @@ protected function createBasicDummyHandle($name, $type, $fullname = null,
if ($fullname) {
$handle->setFullName($fullname);
} else {
- $handle->setFullName(sprintf('%s%d: %s',
- substr($type, 0, 1),
- $id,
- $name));
+ $handle->setFullName(
+ sprintf('%s%d: %s',
+ substr($type, 0, 1),
+ $id,
+ $name));
}
if ($uri) {
diff --git a/src/applications/xhprof/view/PhabricatorXHProfProfileTopLevelView.php b/src/applications/xhprof/view/PhabricatorXHProfProfileTopLevelView.php
index e332ca4d2f..172e4d3447 100644
--- a/src/applications/xhprof/view/PhabricatorXHProfProfileTopLevelView.php
+++ b/src/applications/xhprof/view/PhabricatorXHProfProfileTopLevelView.php
@@ -89,26 +89,28 @@ public function render() {
array(
'sigil' => 'has-tooltip',
'meta' => array(
- 'tip' => pht('Total wall time spent in this function and all of '.
- 'its children (children are other functions it called '.
- 'while executing).'),
+ 'tip' => pht(
+ 'Total wall time spent in this function and all of '.
+ 'its children (children are other functions it called '.
+ 'while executing).'),
'size' => 200,
),
),
- 'Wall Time (Inclusive)'),
+ pht('Wall Time (Inclusive)')),
'%',
javelin_tag(
'span',
array(
'sigil' => 'has-tooltip',
'meta' => array(
- 'tip' => pht('Wall time spent in this function, excluding time '.
- 'spent in children (children are other functions it '.
- 'called while executing).'),
+ 'tip' => pht(
+ 'Wall time spent in this function, excluding time '.
+ 'spent in children (children are other functions it '.
+ 'called while executing).'),
'size' => 200,
),
),
- 'Wall Time (Exclusive)'),
+ pht('Wall Time (Exclusive)')),
'%',
));
$table->setColumnClasses(
@@ -128,7 +130,7 @@ public function render() {
if ($this->file) {
$button = id(new PHUIButtonView())
->setHref($this->file->getBestURI())
- ->setText(pht('Download .xhprof Profile'))
+ ->setText(pht('Download %s Profile', '.xhprof'))
->setTag('a');
$header->addActionLink($button);
}
diff --git a/src/docs/user/configuration/configuring_file_domain.diviner b/src/docs/user/configuration/configuring_file_domain.diviner
index 5724bc3536..98576e5ae3 100644
--- a/src/docs/user/configuration/configuring_file_domain.diviner
+++ b/src/docs/user/configuration/configuring_file_domain.diviner
@@ -52,6 +52,10 @@ your Phabricator install as an origin (make sure you point it at the primary
domain name of your install, not just a load balancer or instance). You do not
need to set up a new domain name, which makes setup a bit more straightforward.
+Most settings can be left at their default values, but you should change
+the **Allowed HTTP Methods** setting from `GET, HEAD` to
+`GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE`.
+
Once configured, accessing the distribution's domain name should return a
Phabricator error page indicating that Phabricator does not recognize the
domain. If you see this page, it means you've configured things correctly.
diff --git a/src/docs/user/userguide/arcanist_new_project.diviner b/src/docs/user/userguide/arcanist_new_project.diviner
index fbb2ad4a45..448d3ea947 100644
--- a/src/docs/user/userguide/arcanist_new_project.diviner
+++ b/src/docs/user/userguide/arcanist_new_project.diviner
@@ -49,10 +49,6 @@ Other options include:
See below for details about path resolution, or see
@{article:libphutil Libraries User Guide} for a general introduction to
libphutil libraries.
- - **project.name**: name an "Arcanist Project" to associate this working
- copy (Git, Mercurial) or directory (SVN) with. Previously, this was a
- required option, but `arc` can now usually operate without it in Git and
- Mercurial. This option was previously called `project_id`.
- **https.cabundle**: specifies the path to an alternate certificate bundle
for use when making HTTPS connections.
- **lint.engine**: the name of a subclass of
diff --git a/src/docs/user/userguide/arcanist_quick_start.diviner b/src/docs/user/userguide/arcanist_quick_start.diviner
index 261056bbeb..98633bfaef 100644
--- a/src/docs/user/userguide/arcanist_quick_start.diviner
+++ b/src/docs/user/userguide/arcanist_quick_start.diviner
@@ -44,12 +44,9 @@ Create a `.arcconfig` file in your project's working copy:
yourproject/ $ $EDITOR .arcconfig
yourproject/ $ cat .arcconfig
{
- "project.name" : "yourprojectname",
"phabricator.uri" : "https://phabricator.example.com/"
}
-Set `project.name` to a string that identifies the project.
-
Set `phabricator.uri` to the URI for your Phabricator install (where `arc`
should send changes to).
diff --git a/src/docs/user/userguide/libraries.diviner b/src/docs/user/userguide/libraries.diviner
index 33f6f57b67..656b167d8d 100644
--- a/src/docs/user/userguide/libraries.diviner
+++ b/src/docs/user/userguide/libraries.diviner
@@ -83,8 +83,7 @@ Phabricator. For example, you might write this file to
`libcustom/.arcconfig`:
{
- "project.name" : "libcustom",
- "load" : [
+ "load": [
"phabricator/src/"
]
}
diff --git a/src/infrastructure/customfield/config/PhabricatorCustomFieldConfigOptionType.php b/src/infrastructure/customfield/config/PhabricatorCustomFieldConfigOptionType.php
index 6ff9eae1d0..1de963c177 100644
--- a/src/infrastructure/customfield/config/PhabricatorCustomFieldConfigOptionType.php
+++ b/src/infrastructure/customfield/config/PhabricatorCustomFieldConfigOptionType.php
@@ -12,9 +12,6 @@ public function readRequest(
$storage_value = $request->getStr('value');
$in_value = phutil_json_decode($storage_value);
- if (!is_array($in_value)) {
- $in_value = array();
- }
// When we submit from JS, we submit a list (since maps are not guaranteed
// to retain order). Convert it into a map for storage (since it's far more
@@ -37,20 +34,16 @@ public function renderControl(
$field_spec = PhabricatorEnv::getEnvConfig($option->getKey());
}
- // Get all of the fields (including disabled fields) by querying for them
- // with a faux spec where no fields are disabled.
- $faux_spec = $field_spec;
- foreach ($faux_spec as $key => $spec) {
- unset($faux_spec[$key]['disabled']);
- }
-
// TODO: We might need to build a real object here eventually.
$faux_object = null;
$fields = PhabricatorCustomField::buildFieldList(
$field_base_class,
- $faux_spec,
- $faux_object);
+ $field_spec,
+ $faux_object,
+ array(
+ 'withDisabled' => true,
+ ));
$list_id = celerity_generate_unique_node_id();
$input_id = celerity_generate_unique_node_id();
@@ -66,7 +59,8 @@ public function renderControl(
->addAttribute($field->getFieldDescription())
->setHeader($field->getFieldName());
- $is_disabled = !empty($field_spec[$key]['disabled']);
+ $spec = idx($field_spec, $key, array());
+ $is_disabled = idx($spec, 'disabled', $field->shouldDisableByDefault());
$disabled_item = clone $item;
$enabled_item = clone $item;
@@ -113,7 +107,7 @@ public function renderControl(
'id' => $input_id,
'type' => 'hidden',
'name' => 'value',
- 'value' => json_encode($display_value),
+ 'value' => '',
));
Javelin::initBehavior(
diff --git a/src/infrastructure/customfield/exception/PhabricatorCustomFieldDataNotAvailableException.php b/src/infrastructure/customfield/exception/PhabricatorCustomFieldDataNotAvailableException.php
index 26141dc506..c1bc74d366 100644
--- a/src/infrastructure/customfield/exception/PhabricatorCustomFieldDataNotAvailableException.php
+++ b/src/infrastructure/customfield/exception/PhabricatorCustomFieldDataNotAvailableException.php
@@ -1,16 +1,15 @@
getFieldKey();
- $name = $field->getFieldName();
- $class = get_class($field);
-
parent::__construct(
- "Custom field '{$name}' (with key '{$key}', of class '{$class}') is ".
- "attempting to access data which is not available in this context.");
+ pht(
+ "Custom field '%s' (with key '%s', of class '%s') is attempting ".
+ "to access data which is not available in this context.",
+ $field->getFieldName(),
+ $field->getFieldKey(),
+ get_class($field)));
}
}
diff --git a/src/infrastructure/customfield/exception/PhabricatorCustomFieldNotProxyException.php b/src/infrastructure/customfield/exception/PhabricatorCustomFieldNotProxyException.php
index 585f31c41b..6fd2f93be6 100644
--- a/src/infrastructure/customfield/exception/PhabricatorCustomFieldNotProxyException.php
+++ b/src/infrastructure/customfield/exception/PhabricatorCustomFieldNotProxyException.php
@@ -1,17 +1,18 @@
getFieldKey();
- $name = $field->getFieldName();
- $class = get_class($field);
-
parent::__construct(
- "Custom field '{$name}' (with key '{$key}', of class '{$class}') can ".
- "not have a proxy set with setProxy(), because it returned false from ".
- "canSetProxy().");
+ pht(
+ "Custom field '%s' (with key '%s', of class '%s') can not have a ".
+ "proxy set with %s, because it returned %s from %s.",
+ $field->getFieldName(),
+ $field->getFieldKey(),
+ get_class($field),
+ 'setProxy()',
+ 'false',
+ 'canSetProxy()'));
}
}
diff --git a/src/infrastructure/customfield/field/PhabricatorCustomField.php b/src/infrastructure/customfield/field/PhabricatorCustomField.php
index 28110e7334..b154e0e065 100644
--- a/src/infrastructure/customfield/field/PhabricatorCustomField.php
+++ b/src/infrastructure/customfield/field/PhabricatorCustomField.php
@@ -105,7 +105,18 @@ public static function getObjectField(
/**
* @task apps
*/
- public static function buildFieldList($base_class, array $spec, $object) {
+ public static function buildFieldList(
+ $base_class,
+ array $spec,
+ $object,
+ array $options = array()) {
+
+ PhutilTypeSpec::checkMap(
+ $options,
+ array(
+ 'withDisabled' => 'optional bool',
+ ));
+
$field_objects = id(new PhutilSymbolLoader())
->setAncestorClass($base_class)
->loadObjects();
@@ -135,13 +146,16 @@ public static function buildFieldList($base_class, array $spec, $object) {
$fields = array_select_keys($fields, array_keys($spec)) + $fields;
- foreach ($spec as $key => $config) {
- if (empty($fields[$key])) {
- continue;
- }
- if (!empty($config['disabled'])) {
- if ($fields[$key]->canDisableField()) {
- unset($fields[$key]);
+ if (empty($options['withDisabled'])) {
+ foreach ($fields as $key => $field) {
+ $config = idx($spec, $key, array()) + array(
+ 'disabled' => $field->shouldDisableByDefault(),
+ );
+
+ if (!empty($config['disabled'])) {
+ if ($field->canDisableField()) {
+ unset($fields[$key]);
+ }
}
}
}
@@ -1055,22 +1069,6 @@ public function shouldHideInApplicationTransactions(
return false;
}
- /**
- * TODO: this is only used by Diffusion right now and everything is completely
- * faked since Diffusion doesn't use ApplicationTransactions yet. This should
- * get fleshed out as we have more use cases.
- *
- * @task appxaction
- */
- public function buildApplicationTransactionMailBody(
- PhabricatorApplicationTransaction $xaction,
- PhabricatorMetaMTAMailBody $body) {
- if ($this->proxy) {
- return $this->proxy->buildApplicationTransactionMailBody($xaction, $body);
- }
- return;
- }
-
/* -( Transaction Mail )--------------------------------------------------- */
diff --git a/src/infrastructure/customfield/field/PhabricatorCustomFieldList.php b/src/infrastructure/customfield/field/PhabricatorCustomFieldList.php
index 15b83928e1..160a618397 100644
--- a/src/infrastructure/customfield/field/PhabricatorCustomFieldList.php
+++ b/src/infrastructure/customfield/field/PhabricatorCustomFieldList.php
@@ -147,8 +147,12 @@ public function appendFieldsToPropertyList(
break;
default:
throw new Exception(
- "Unknown field property view style '{$style}'; valid styles are ".
- "'block' and 'property'.");
+ pht(
+ "Unknown field property view style '%s'; valid styles are ".
+ "'%s' and '%s'.",
+ $style,
+ 'block',
+ 'property'));
}
}
$fields = $head + $tail;
diff --git a/src/infrastructure/customfield/storage/PhabricatorCustomFieldIndexStorage.php b/src/infrastructure/customfield/storage/PhabricatorCustomFieldIndexStorage.php
index 18024ec175..d16be819f4 100644
--- a/src/infrastructure/customfield/storage/PhabricatorCustomFieldIndexStorage.php
+++ b/src/infrastructure/customfield/storage/PhabricatorCustomFieldIndexStorage.php
@@ -1,7 +1,6 @@
conduit)) {
throw new Exception(
- "This bot is not configured with a Conduit uplink. Set 'conduit.uri', ".
- "'conduit.user' and 'conduit.cert' in the configuration to connect.");
+ pht(
+ "This bot is not configured with a Conduit uplink. Set '%s', ".
+ "'%s' and '%s' in the configuration to connect.",
+ 'conduit.uri',
+ 'conduit.user',
+ 'conduit.cert'));
}
return $this->conduit;
}
diff --git a/src/infrastructure/daemon/bot/adapter/PhabricatorIRCProtocolAdapter.php b/src/infrastructure/daemon/bot/adapter/PhabricatorIRCProtocolAdapter.php
index eab9c4b8fa..eee4974877 100644
--- a/src/infrastructure/daemon/bot/adapter/PhabricatorIRCProtocolAdapter.php
+++ b/src/infrastructure/daemon/bot/adapter/PhabricatorIRCProtocolAdapter.php
@@ -32,7 +32,9 @@ public function connect() {
if (!preg_match('/^[A-Za-z0-9_`[{}^|\]\\-]+$/', $nick)) {
throw new Exception(
- "Nickname '{$nick}' is invalid!");
+ pht(
+ "Nickname '%s' is invalid!",
+ $nick));
}
$errno = null;
@@ -43,11 +45,11 @@ public function connect() {
$socket = fsockopen('ssl://'.$server, $port, $errno, $error);
}
if (!$socket) {
- throw new Exception("Failed to connect, #{$errno}: {$error}");
+ throw new Exception(pht('Failed to connect, #%d: %s', $errno, $error));
}
$ok = stream_set_blocking($socket, false);
if (!$ok) {
- throw new Exception('Failed to set stream nonblocking.');
+ throw new Exception(pht('Failed to set stream nonblocking.'));
}
$this->socket = $socket;
@@ -76,7 +78,7 @@ public function getNextMessages($poll_frequency) {
// was most likely because we were signaled.
$ok = @stream_select($read, $write, $except, $timeout_sec = 0);
if ($ok === false) {
- throw new Exception('stream_select() failed!');
+ throw new Exception(pht('%s failed!', 'stream_select()'));
}
}
@@ -87,12 +89,12 @@ public function getNextMessages($poll_frequency) {
// This indicates the connection was terminated on the other side,
// just exit via exception and let the overseer restart us after a
// delay so we can reconnect.
- throw new Exception('Remote host closed connection.');
+ throw new Exception(pht('Remote host closed connection.'));
}
do {
$data = fread($this->socket, 4096);
if ($data === false) {
- throw new Exception('fread() failed!');
+ throw new Exception(pht('%s failed!', 'fread()'));
} else {
$messages[] = id(new PhabricatorBotMessage())
->setCommand('LOG')
@@ -106,7 +108,7 @@ public function getNextMessages($poll_frequency) {
do {
$len = fwrite($this->socket, $this->writeBuffer);
if ($len === false) {
- throw new Exception('fwrite() failed!');
+ throw new Exception(pht('%s failed!', 'fwrite()'));
} else if ($len === 0) {
break;
} else {
@@ -206,7 +208,7 @@ private function handleIRCProtocol(array $matches) {
}
$join = $this->getConfig('join');
if (!$join) {
- throw new Exception('Not configured to join any channels!');
+ throw new Exception(pht('Not configured to join any channels!'));
}
foreach ($join as $channel) {
$this->write("JOIN {$channel}");
diff --git a/src/infrastructure/daemon/bot/adapter/PhabricatorStreamingProtocolAdapter.php b/src/infrastructure/daemon/bot/adapter/PhabricatorStreamingProtocolAdapter.php
index 6863880c54..52707b1a03 100644
--- a/src/infrastructure/daemon/bot/adapter/PhabricatorStreamingProtocolAdapter.php
+++ b/src/infrastructure/daemon/bot/adapter/PhabricatorStreamingProtocolAdapter.php
@@ -24,7 +24,7 @@ public function connect() {
// First, join the room
if (!$rooms) {
- throw new Exception('Not configured to join any rooms!');
+ throw new Exception(pht('Not configured to join any rooms!'));
}
$this->readBuffers = array();
@@ -91,7 +91,7 @@ private function blockingMultiExec() {
// Check for errors
if ($status != CURLM_OK) {
throw new Exception(
- 'Phabricator Bot had a problem reading from stream.');
+ pht('Phabricator Bot had a problem reading from stream.'));
}
}
@@ -99,7 +99,7 @@ public function getNextMessages($poll_frequency) {
$messages = array();
if (!$this->active) {
- throw new Exception('Phabricator Bot stopped reading from stream.');
+ throw new Exception(pht('Phabricator Bot stopped reading from stream.'));
}
// Prod our http request
diff --git a/src/infrastructure/daemon/bot/handler/PhabricatorBotDebugLogHandler.php b/src/infrastructure/daemon/bot/handler/PhabricatorBotDebugLogHandler.php
index 7c2d0b57cb..eb4f9b24a9 100644
--- a/src/infrastructure/daemon/bot/handler/PhabricatorBotDebugLogHandler.php
+++ b/src/infrastructure/daemon/bot/handler/PhabricatorBotDebugLogHandler.php
@@ -1,7 +1,7 @@
getCommand() != 'MESSAGE') {
throw new Exception(
- 'Handler is trying to reply to something which is not a message!');
+ pht('Handler is trying to reply to something which is not a message!'));
}
$reply = id(new PhabricatorBotMessage())
diff --git a/src/infrastructure/daemon/bot/handler/PhabricatorBotSymbolHandler.php b/src/infrastructure/daemon/bot/handler/PhabricatorBotSymbolHandler.php
index 48734af94a..2e7ff01bef 100644
--- a/src/infrastructure/daemon/bot/handler/PhabricatorBotSymbolHandler.php
+++ b/src/infrastructure/daemon/bot/handler/PhabricatorBotSymbolHandler.php
@@ -26,7 +26,10 @@ public function receiveMessage(PhabricatorBotMessage $message) {
$default_uri = $this->getURI('/diffusion/symbol/'.$symbol.'/');
if (count($results) > 1) {
- $response = "Multiple symbols named '{$symbol}': {$default_uri}";
+ $response = pht(
+ "Multiple symbols named '%s': %s",
+ $symbol,
+ $default_uri);
} else if (count($results) == 1) {
$result = head($results);
$response =
@@ -35,7 +38,7 @@ public function receiveMessage(PhabricatorBotMessage $message) {
'('.$result['language'].'): '.
nonempty($result['uri'], $default_uri);
} else {
- $response = "No symbol '{$symbol}' found anywhere.";
+ $response = pht("No symbol '%s' found anywhere.", $symbol);
}
$this->replyTo($message, $response);
diff --git a/src/infrastructure/daemon/bot/handler/PhabricatorBotWhatsNewHandler.php b/src/infrastructure/daemon/bot/handler/PhabricatorBotWhatsNewHandler.php
index cc1cda2f77..a7d7ad9051 100644
--- a/src/infrastructure/daemon/bot/handler/PhabricatorBotWhatsNewHandler.php
+++ b/src/infrastructure/daemon/bot/handler/PhabricatorBotWhatsNewHandler.php
@@ -1,7 +1,7 @@
getID();
$class = $task->getTaskClass();
- $this->log("Working on task {$id} ({$class})...");
+ $this->log(pht('Working on task %d (%s)...', $id, $class));
$task = $task->executeTask();
$ex = $task->getExecutionException();
@@ -33,7 +33,7 @@ protected function run() {
$ex);
}
} else {
- $this->log("Task {$id} complete! Moved to archive.");
+ $this->log(pht('Task %s complete! Moved to archive.', $id));
}
}
diff --git a/src/infrastructure/daemon/workers/__tests__/PhabricatorTestWorker.php b/src/infrastructure/daemon/workers/__tests__/PhabricatorTestWorker.php
index 1b4788a513..86e83acb82 100644
--- a/src/infrastructure/daemon/workers/__tests__/PhabricatorTestWorker.php
+++ b/src/infrastructure/daemon/workers/__tests__/PhabricatorTestWorker.php
@@ -26,10 +26,10 @@ public function getWaitBeforeRetry(PhabricatorWorkerTask $task) {
protected function doWork() {
switch (idx($this->getTaskData(), 'doWork')) {
case 'fail-temporary':
- throw new Exception('Temporary failure!');
+ throw new Exception(pht('Temporary failure!'));
case 'fail-permanent':
throw new PhabricatorWorkerPermanentFailureException(
- 'Permanent failure!');
+ pht('Permanent failure!'));
default:
return;
}
diff --git a/src/infrastructure/daemon/workers/__tests__/PhabricatorWorkerTestCase.php b/src/infrastructure/daemon/workers/__tests__/PhabricatorWorkerTestCase.php
index 739d135f81..83d2585e18 100644
--- a/src/infrastructure/daemon/workers/__tests__/PhabricatorWorkerTestCase.php
+++ b/src/infrastructure/daemon/workers/__tests__/PhabricatorWorkerTestCase.php
@@ -10,7 +10,7 @@ protected function getPhabricatorTestCaseConfiguration() {
public function testLeaseTask() {
$task = $this->scheduleTask();
- $this->expectNextLease($task, 'Leasing should work.');
+ $this->expectNextLease($task, pht('Leasing should work.'));
}
public function testMultipleLease() {
@@ -19,7 +19,7 @@ public function testMultipleLease() {
$this->expectNextLease($task);
$this->expectNextLease(
null,
- 'We should not be able to lease a task multiple times.');
+ pht('We should not be able to lease a task multiple times.'));
}
public function testOldestFirst() {
@@ -28,7 +28,7 @@ public function testOldestFirst() {
$this->expectNextLease(
$task1,
- 'Older tasks should lease first, all else being equal.');
+ pht('Older tasks should lease first, all else being equal.'));
$this->expectNextLease($task2);
}
@@ -42,8 +42,9 @@ public function testNewBeforeLeased() {
$this->expectNextLease(
$task2,
- 'Tasks not previously leased should lease before previously '.
- 'leased tasks.');
+ pht(
+ 'Tasks not previously leased should lease before previously '.
+ 'leased tasks.'));
$this->expectNextLease($task1);
}
@@ -156,7 +157,9 @@ public function testLeasedIsOldestFirst() {
$this->expectNextLease(
$task2,
- 'Tasks which expired earlier should lease first, all else being equal.');
+ pht(
+ 'Tasks which expired earlier should lease first, '.
+ 'all else being equal.'));
$this->expectNextLease($task1);
}
@@ -167,10 +170,10 @@ public function testLeasedIsLowestPriority() {
$this->expectNextLease(
$task3,
- 'Tasks with a lower priority should be scheduled first.');
+ pht('Tasks with a lower priority should be scheduled first.'));
$this->expectNextLease(
$task1,
- 'Tasks with the same priority should be FIFO.');
+ pht('Tasks with the same priority should be FIFO.'));
$this->expectNextLease($task2);
}
diff --git a/src/infrastructure/daemon/workers/clock/PhabricatorMetronomicTriggerClock.php b/src/infrastructure/daemon/workers/clock/PhabricatorMetronomicTriggerClock.php
index 99a7080869..d704211388 100644
--- a/src/infrastructure/daemon/workers/clock/PhabricatorMetronomicTriggerClock.php
+++ b/src/infrastructure/daemon/workers/clock/PhabricatorMetronomicTriggerClock.php
@@ -6,8 +6,7 @@
*
* For example, this clock can trigger an event every 30 seconds.
*/
-final class PhabricatorMetronomicTriggerClock
- extends PhabricatorTriggerClock {
+final class PhabricatorMetronomicTriggerClock extends PhabricatorTriggerClock {
public function validateProperties(array $properties) {
PhutilTypeSpec::checkMap(
diff --git a/src/infrastructure/daemon/workers/clock/PhabricatorNeverTriggerClock.php b/src/infrastructure/daemon/workers/clock/PhabricatorNeverTriggerClock.php
index 3f809c961e..cbf5be2861 100644
--- a/src/infrastructure/daemon/workers/clock/PhabricatorNeverTriggerClock.php
+++ b/src/infrastructure/daemon/workers/clock/PhabricatorNeverTriggerClock.php
@@ -5,8 +5,7 @@
*
* This clock can be used for testing, or to cancel events.
*/
-final class PhabricatorNeverTriggerClock
- extends PhabricatorTriggerClock {
+final class PhabricatorNeverTriggerClock extends PhabricatorTriggerClock {
public function validateProperties(array $properties) {
PhutilTypeSpec::checkMap(
diff --git a/src/infrastructure/daemon/workers/management/PhabricatorWorkerTriggerManagementWorkflow.php b/src/infrastructure/daemon/workers/management/PhabricatorWorkerTriggerManagementWorkflow.php
index 6251a8af3f..05eefdd91c 100644
--- a/src/infrastructure/daemon/workers/management/PhabricatorWorkerTriggerManagementWorkflow.php
+++ b/src/infrastructure/daemon/workers/management/PhabricatorWorkerTriggerManagementWorkflow.php
@@ -18,7 +18,7 @@ protected function loadTriggers(PhutilArgumentParser $args) {
$ids = $args->getArg('id');
if (!$ids) {
throw new PhutilArgumentUsageException(
- pht('Use --id to select triggers by ID.'));
+ pht('Use %s to select triggers by ID.', '--id'));
}
$triggers = id(new PhabricatorWorkerTriggerQuery())
diff --git a/src/infrastructure/daemon/workers/query/PhabricatorWorkerLeaseQuery.php b/src/infrastructure/daemon/workers/query/PhabricatorWorkerLeaseQuery.php
index 07c3460494..bb70f03d88 100644
--- a/src/infrastructure/daemon/workers/query/PhabricatorWorkerLeaseQuery.php
+++ b/src/infrastructure/daemon/workers/query/PhabricatorWorkerLeaseQuery.php
@@ -75,15 +75,17 @@ public function setLimit($limit) {
public function execute() {
if (!$this->limit) {
throw new Exception(
- pht('You must setLimit() when leasing tasks.'));
+ pht('You must %s when leasing tasks.', 'setLimit()'));
}
if ($this->leased !== false) {
if (!$this->skipLease) {
throw new Exception(
pht(
- 'If you potentially select leased tasks using withLeasedTasks(), '.
- 'you MUST disable lease acquisition by calling setSkipLease().'));
+ 'If you potentially select leased tasks using %s, '.
+ 'you MUST disable lease acquisition by calling %s.',
+ 'withLeasedTasks()',
+ 'setSkipLease()'));
}
}
@@ -224,7 +226,7 @@ protected function buildCustomWhereClause(
$where[] = 'leaseExpires < UNIX_TIMESTAMP()';
break;
default:
- throw new Exception("Unknown phase '{$phase}'!");
+ throw new Exception(pht("Unknown phase '%s'!", $phase));
}
if ($this->ids !== null) {
@@ -253,7 +255,7 @@ private function buildUpdateWhereClause(
throw new Exception(
pht(
'Trying to lease tasks selected in the leased phase! This is '.
- 'intended to be imposssible.'));
+ 'intended to be impossible.'));
case self::PHASE_UNLEASED:
$where[] = qsprintf($conn_w, 'leaseOwner IS NULL');
$where[] = qsprintf($conn_w, 'id IN (%Ld)', ipull($rows, 'id'));
@@ -270,7 +272,7 @@ private function buildUpdateWhereClause(
$where[] = qsprintf($conn_w, '(%Q)', implode(' OR ', $in));
break;
default:
- throw new Exception("Unknown phase '{$phase}'!");
+ throw new Exception(pht('Unknown phase "%s"!', $phase));
}
return $this->formatWhereClause($where);
diff --git a/src/infrastructure/daemon/workers/storage/PhabricatorWorkerActiveTask.php b/src/infrastructure/daemon/workers/storage/PhabricatorWorkerActiveTask.php
index 36ada93a13..0705a27780 100644
--- a/src/infrastructure/daemon/workers/storage/PhabricatorWorkerActiveTask.php
+++ b/src/infrastructure/daemon/workers/storage/PhabricatorWorkerActiveTask.php
@@ -89,24 +89,27 @@ protected function checkLease() {
if ($this->leaseOwner) {
$current_server_time = $this->serverTime + (time() - $this->localTime);
if ($current_server_time >= $this->leaseExpires) {
- $id = $this->getID();
- $class = $this->getTaskClass();
throw new Exception(
- "Trying to update Task {$id} ({$class}) after lease expiration!");
+ pht(
+ 'Trying to update Task %d (%s) after lease expiration!',
+ $this->getID(),
+ $this->getTaskClass()));
}
}
}
public function delete() {
throw new Exception(
- 'Active tasks can not be deleted directly. '.
- 'Use archiveTask() to move tasks to the archive.');
+ pht(
+ 'Active tasks can not be deleted directly. '.
+ 'Use %s to move tasks to the archive.',
+ 'archiveTask()'));
}
public function archiveTask($result, $duration) {
if ($this->getID() === null) {
throw new Exception(
- "Attempting to archive a task which hasn't been save()d!");
+ pht("Attempting to archive a task which hasn't been saved!"));
}
$this->checkLease();
@@ -142,10 +145,11 @@ public function executeTask() {
$maximum_failures = $worker->getMaximumRetryCount();
if ($maximum_failures !== null) {
if ($this->getFailureCount() > $maximum_failures) {
- $id = $this->getID();
throw new PhabricatorWorkerPermanentFailureException(
- "Task {$id} has exceeded the maximum number of failures ".
- "({$maximum_failures}).");
+ pht(
+ 'Task % has exceeded the maximum number of failures (%d).',
+ $this->getID(),
+ $maximum_failures));
}
}
diff --git a/src/infrastructure/daemon/workers/storage/PhabricatorWorkerArchiveTask.php b/src/infrastructure/daemon/workers/storage/PhabricatorWorkerArchiveTask.php
index 5186a005c4..9797373eb7 100644
--- a/src/infrastructure/daemon/workers/storage/PhabricatorWorkerArchiveTask.php
+++ b/src/infrastructure/daemon/workers/storage/PhabricatorWorkerArchiveTask.php
@@ -38,7 +38,7 @@ protected function getConfiguration() {
public function save() {
if ($this->getID() === null) {
- throw new Exception('Trying to archive a task with no ID.');
+ throw new Exception(pht('Trying to archive a task with no ID.'));
}
$other = new PhabricatorWorkerActiveTask();
diff --git a/src/infrastructure/daemon/workers/storage/PhabricatorWorkerTask.php b/src/infrastructure/daemon/workers/storage/PhabricatorWorkerTask.php
index 77543befb9..3d8c6887c6 100644
--- a/src/infrastructure/daemon/workers/storage/PhabricatorWorkerTask.php
+++ b/src/infrastructure/daemon/workers/storage/PhabricatorWorkerTask.php
@@ -62,12 +62,17 @@ final public function getWorkerInstance() {
if (!class_exists($class)) {
throw new PhabricatorWorkerPermanentFailureException(
- "Task class '{$class}' does not exist!");
+ pht(
+ "Task class '%s' does not exist!",
+ $class));
}
if (!is_subclass_of($class, 'PhabricatorWorker')) {
throw new PhabricatorWorkerPermanentFailureException(
- "Task class '{$class}' does not extend PhabricatorWorker.");
+ pht(
+ "Task class '%s' does not extend %s.",
+ $class,
+ 'PhabricatorWorker'));
}
return newv($class, array($this->getData()));
diff --git a/src/infrastructure/diff/PhabricatorInlineCommentController.php b/src/infrastructure/diff/PhabricatorInlineCommentController.php
index 4608ebeffa..343319b3d8 100644
--- a/src/infrastructure/diff/PhabricatorInlineCommentController.php
+++ b/src/infrastructure/diff/PhabricatorInlineCommentController.php
@@ -15,6 +15,14 @@ abstract protected function deleteComment(
abstract protected function saveComment(
PhabricatorInlineCommentInterface $inline);
+ protected function hideComments(array $ids) {
+ throw new PhutilMethodNotImplementedException();
+ }
+
+ protected function showComments(array $ids) {
+ throw new PhutilMethodNotImplementedException();
+ }
+
private $changesetID;
private $isNewFile;
private $isOnRight;
@@ -84,6 +92,22 @@ public function processRequest() {
$op = $this->getOperation();
switch ($op) {
+ case 'hide':
+ case 'show':
+ if (!$request->validateCSRF()) {
+ return new Aphront404Response();
+ }
+
+ $ids = $request->getStrList('ids');
+ if ($ids) {
+ if ($op == 'hide') {
+ $this->hideComments($ids);
+ } else {
+ $this->showComments($ids);
+ }
+ }
+
+ return id(new AphrontAjaxResponse())->setContent(array());
case 'done':
if (!$request->validateCSRF()) {
return new Aphront404Response();
diff --git a/src/infrastructure/diff/interface/PhabricatorInlineCommentInterface.php b/src/infrastructure/diff/interface/PhabricatorInlineCommentInterface.php
index 8ba648f2b6..13bf3ad83b 100644
--- a/src/infrastructure/diff/interface/PhabricatorInlineCommentInterface.php
+++ b/src/infrastructure/diff/interface/PhabricatorInlineCommentInterface.php
@@ -57,4 +57,7 @@ public function delete();
public function setIsGhost($is_ghost);
public function getIsGhost();
+ public function supportsHiding();
+ public function isHidden();
+
}
diff --git a/src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php b/src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php
index e265cafad1..de17b5dd2b 100644
--- a/src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php
+++ b/src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php
@@ -18,6 +18,10 @@ public function setInlineComment(PhabricatorInlineCommentInterface $comment) {
return $this;
}
+ public function isHidden() {
+ return $this->inlineComment->isHidden();
+ }
+
public function setHandles(array $handles) {
assert_instances_of($handles, 'PhabricatorObjectHandle');
$this->handles = $handles;
@@ -192,6 +196,8 @@ public function render() {
if (!$this->preview) {
$nextprev = new PHUIButtonBarView();
$nextprev->addClass('mml');
+
+
$up = id(new PHUIButtonView())
->setTag('a')
->setColor(PHUIButtonView::SIMPLE)
@@ -208,6 +214,18 @@ public function render() {
->addSigil('differential-inline-next')
->setMustCapture(true);
+ $hide = id(new PHUIButtonView())
+ ->setTag('a')
+ ->setColor(PHUIButtonView::SIMPLE)
+ ->setTooltip(pht('Hide Comment'))
+ ->setIconFont('fa-times')
+ ->addSigil('hide-inline')
+ ->setMustCapture(true);
+
+ if ($viewer_phid && $inline->getID() && $inline->supportsHiding()) {
+ $nextprev->addButton($hide);
+ }
+
$nextprev->addButton($up);
$nextprev->addButton($down);
diff --git a/src/infrastructure/diff/view/PHUIDiffInlineCommentRowScaffold.php b/src/infrastructure/diff/view/PHUIDiffInlineCommentRowScaffold.php
index 194ff6f5cc..b0c0b4ccac 100644
--- a/src/infrastructure/diff/view/PHUIDiffInlineCommentRowScaffold.php
+++ b/src/infrastructure/diff/view/PHUIDiffInlineCommentRowScaffold.php
@@ -23,8 +23,18 @@ public function addInlineView(PHUIDiffInlineCommentView $view) {
protected function getRowAttributes() {
// TODO: This is semantic information used by the JS when placing comments
// and using keyboard navigation; we should move it out of class names.
+
+ $style = null;
+ foreach ($this->getInlineViews() as $view) {
+ if ($view->isHidden()) {
+ $style = 'display: none';
+ }
+ }
+
return array(
'class' => 'inline',
+ 'sigil' => 'inline-row',
+ 'style' => $style,
);
}
diff --git a/src/infrastructure/diff/view/PHUIDiffInlineCommentUndoView.php b/src/infrastructure/diff/view/PHUIDiffInlineCommentUndoView.php
index 4d398ca0ce..c4bdd65bf8 100644
--- a/src/infrastructure/diff/view/PHUIDiffInlineCommentUndoView.php
+++ b/src/infrastructure/diff/view/PHUIDiffInlineCommentUndoView.php
@@ -23,7 +23,7 @@ public function render() {
array(
'class' => 'differential-inline-undo',
),
- array('Changes discarded. ', $link));
+ array(pht('Changes discarded. '), $link));
}
}
diff --git a/src/infrastructure/diff/view/PHUIDiffInlineCommentView.php b/src/infrastructure/diff/view/PHUIDiffInlineCommentView.php
index f2f82471d6..b62160e232 100644
--- a/src/infrastructure/diff/view/PHUIDiffInlineCommentView.php
+++ b/src/infrastructure/diff/view/PHUIDiffInlineCommentView.php
@@ -17,4 +17,8 @@ public function getScaffoldCellID() {
return null;
}
+ public function isHidden() {
+ return false;
+ }
+
}
diff --git a/src/infrastructure/diff/view/PHUIDiffOneUpInlineCommentRowScaffold.php b/src/infrastructure/diff/view/PHUIDiffOneUpInlineCommentRowScaffold.php
index 6b8cb0a32e..708b70b360 100644
--- a/src/infrastructure/diff/view/PHUIDiffOneUpInlineCommentRowScaffold.php
+++ b/src/infrastructure/diff/view/PHUIDiffOneUpInlineCommentRowScaffold.php
@@ -28,7 +28,7 @@ public function render() {
phutil_tag('td', $attrs, $inline),
);
- return phutil_tag('tr', $this->getRowAttributes(), $cells);
+ return javelin_tag('tr', $this->getRowAttributes(), $cells);
}
}
diff --git a/src/infrastructure/diff/view/PHUIDiffRevealIconView.php b/src/infrastructure/diff/view/PHUIDiffRevealIconView.php
new file mode 100644
index 0000000000..b2c879a8b5
--- /dev/null
+++ b/src/infrastructure/diff/view/PHUIDiffRevealIconView.php
@@ -0,0 +1,27 @@
+setIconFont('fa-comment')
+ ->addSigil('has-tooltip')
+ ->setMetadata(
+ array(
+ 'tip' => pht('Show Hidden Comments'),
+ 'align' => 'E',
+ 'size' => 275,
+ ));
+
+ return javelin_tag(
+ 'a',
+ array(
+ 'href' => '#',
+ 'class' => 'reveal-inlines',
+ 'sigil' => 'reveal-inlines',
+ 'mustcapture' => true,
+ ),
+ $icon);
+ }
+
+}
diff --git a/src/infrastructure/diff/view/PHUIDiffTwoUpInlineCommentRowScaffold.php b/src/infrastructure/diff/view/PHUIDiffTwoUpInlineCommentRowScaffold.php
index e2c2183856..4fac5088d1 100644
--- a/src/infrastructure/diff/view/PHUIDiffTwoUpInlineCommentRowScaffold.php
+++ b/src/infrastructure/diff/view/PHUIDiffTwoUpInlineCommentRowScaffold.php
@@ -68,7 +68,7 @@ public function render() {
phutil_tag('td', $right_attrs, $right_side),
);
- return phutil_tag('tr', $this->getRowAttributes(), $cells);
+ return javelin_tag('tr', $this->getRowAttributes(), $cells);
}
}
diff --git a/src/infrastructure/edges/constants/PhabricatorEdgeConfig.php b/src/infrastructure/edges/constants/PhabricatorEdgeConfig.php
index b7662353bc..4e256dd5ca 100644
--- a/src/infrastructure/edges/constants/PhabricatorEdgeConfig.php
+++ b/src/infrastructure/edges/constants/PhabricatorEdgeConfig.php
@@ -24,7 +24,9 @@ public static function establishConnection($phid_type, $conn_type) {
if (!$class) {
throw new Exception(
- "Edges are not available for objects of type '{$phid_type}'!");
+ pht(
+ "Edges are not available for objects of type '%s'!",
+ $phid_type));
}
return newv($class, array())->establishConnection($conn_type);
diff --git a/src/infrastructure/edges/exception/PhabricatorEdgeCycleException.php b/src/infrastructure/edges/exception/PhabricatorEdgeCycleException.php
index 7556405b0e..87ece77e83 100644
--- a/src/infrastructure/edges/exception/PhabricatorEdgeCycleException.php
+++ b/src/infrastructure/edges/exception/PhabricatorEdgeCycleException.php
@@ -12,7 +12,10 @@ public function __construct($cycle_edge_type, array $cycle) {
$cycle_list = implode(', ', $cycle);
parent::__construct(
- "Graph cycle detected (type={$cycle_edge_type}, cycle={$cycle_list}).");
+ pht(
+ 'Graph cycle detected (type=%s, cycle=%s).',
+ $cycle_edge_type,
+ $cycle_list));
}
public function getCycle() {
diff --git a/src/infrastructure/edges/query/PhabricatorEdgeQuery.php b/src/infrastructure/edges/query/PhabricatorEdgeQuery.php
index 1323d42e3e..2dfceb7fbc 100644
--- a/src/infrastructure/edges/query/PhabricatorEdgeQuery.php
+++ b/src/infrastructure/edges/query/PhabricatorEdgeQuery.php
@@ -160,7 +160,9 @@ public static function loadSingleEdgeData($src_phid, $edge_type, $dest_phid) {
public function execute() {
if (!$this->sourcePHIDs) {
throw new Exception(
- 'You must use withSourcePHIDs() to query edges.');
+ pht(
+ 'You must use %s to query edges.',
+ 'withSourcePHIDs()'));
}
$sources = phid_group_by_type($this->sourcePHIDs);
@@ -256,8 +258,7 @@ public function getDestinationPHIDs(
array $src_phids = array(),
array $types = array()) {
if ($this->resultSet === null) {
- throw new Exception(
- 'You must execute() a query before you you can getDestinationPHIDs().');
+ throw new PhutilInvalidStateException('execute');
}
$result_phids = array();
diff --git a/src/infrastructure/edges/type/PhabricatorEdgeType.php b/src/infrastructure/edges/type/PhabricatorEdgeType.php
index c485efd987..d62c5a9670 100644
--- a/src/infrastructure/edges/type/PhabricatorEdgeType.php
+++ b/src/infrastructure/edges/type/PhabricatorEdgeType.php
@@ -18,16 +18,20 @@ final public function getEdgeConstant() {
if ($const === false) {
throw new Exception(
pht(
- 'EdgeType class "%s" must define an EDGECONST property.',
- get_class($this)));
+ '%s class "%s" must define an %s property.',
+ __CLASS__,
+ get_class($this),
+ 'EDGECONST'));
}
if (!is_int($const) || ($const <= 0)) {
throw new Exception(
pht(
- 'EdgeType class "%s" has an invalid EDGECONST property. Edge '.
- 'constants must be positive integers.',
- get_class($this)));
+ '%s class "%s" has an invalid %s property. '.
+ 'Edge constants must be positive integers.',
+ __CLASS__,
+ get_class($this),
+ 'EDGECONST'));
}
return $const;
diff --git a/src/infrastructure/edges/util/PhabricatorEdgeGraph.php b/src/infrastructure/edges/util/PhabricatorEdgeGraph.php
index 57b422328e..457b9ec70e 100644
--- a/src/infrastructure/edges/util/PhabricatorEdgeGraph.php
+++ b/src/infrastructure/edges/util/PhabricatorEdgeGraph.php
@@ -11,7 +11,7 @@ public function setEdgeType($edge_type) {
protected function loadEdges(array $nodes) {
if (!$this->edgeType) {
- throw new Exception('Set edge type before loading graph!');
+ throw new Exception(pht('Set edge type before loading graph!'));
}
$edges = id(new PhabricatorEdgeQuery())
diff --git a/src/infrastructure/env/PhabricatorConfigFileSource.php b/src/infrastructure/env/PhabricatorConfigFileSource.php
index fa02040c3e..6855a9f0b3 100644
--- a/src/infrastructure/env/PhabricatorConfigFileSource.php
+++ b/src/infrastructure/env/PhabricatorConfigFileSource.php
@@ -2,10 +2,9 @@
/**
* Configuration source which reads from a configuration file on disk (a
- * PHP file in the conf/ directory). This source
+ * PHP file in the `conf/` directory).
*/
-final class PhabricatorConfigFileSource
- extends PhabricatorConfigProxySource {
+final class PhabricatorConfigFileSource extends PhabricatorConfigProxySource {
/**
* @phutil-external-symbol function phabricator_read_config_file
diff --git a/src/infrastructure/env/PhabricatorConfigLocalSource.php b/src/infrastructure/env/PhabricatorConfigLocalSource.php
index 8e3c524061..3a2295eb5e 100644
--- a/src/infrastructure/env/PhabricatorConfigLocalSource.php
+++ b/src/infrastructure/env/PhabricatorConfigLocalSource.php
@@ -1,7 +1,6 @@
loadConfig();
diff --git a/src/infrastructure/env/PhabricatorConfigProxySource.php b/src/infrastructure/env/PhabricatorConfigProxySource.php
index 818b55452b..23e4d0a228 100644
--- a/src/infrastructure/env/PhabricatorConfigProxySource.php
+++ b/src/infrastructure/env/PhabricatorConfigProxySource.php
@@ -10,7 +10,7 @@ abstract class PhabricatorConfigProxySource
final protected function getSource() {
if (!$this->source) {
- throw new Exception('No configuration source set!');
+ throw new Exception(pht('No configuration source set!'));
}
return $this->source;
}
diff --git a/src/infrastructure/env/PhabricatorConfigSource.php b/src/infrastructure/env/PhabricatorConfigSource.php
index dd52a18c72..1fbdf2f209 100644
--- a/src/infrastructure/env/PhabricatorConfigSource.php
+++ b/src/infrastructure/env/PhabricatorConfigSource.php
@@ -21,11 +21,13 @@ public function canWrite() {
}
public function setKeys(array $keys) {
- throw new Exception('This configuration source does not support writes.');
+ throw new Exception(
+ pht('This configuration source does not support writes.'));
}
public function deleteKeys(array $keys) {
- throw new Exception('This configuration source does not support writes.');
+ throw new Exception(
+ pht('This configuration source does not support writes.'));
}
}
diff --git a/src/infrastructure/env/PhabricatorConfigStackSource.php b/src/infrastructure/env/PhabricatorConfigStackSource.php
index a118cf01b8..a8c5113f15 100644
--- a/src/infrastructure/env/PhabricatorConfigStackSource.php
+++ b/src/infrastructure/env/PhabricatorConfigStackSource.php
@@ -19,7 +19,7 @@ public function pushSource(PhabricatorConfigSource $source) {
public function popSource() {
if (empty($this->stack)) {
- throw new Exception('Popping an empty config stack!');
+ throw new Exception(pht('Popping an empty %s!', __CLASS__));
}
return array_shift($this->stack);
}
diff --git a/src/infrastructure/env/PhabricatorEnv.php b/src/infrastructure/env/PhabricatorEnv.php
index 39f911e3c5..4d1f8ad4a2 100644
--- a/src/infrastructure/env/PhabricatorEnv.php
+++ b/src/infrastructure/env/PhabricatorEnv.php
@@ -389,7 +389,10 @@ public static function getEnvConfig($key) {
self::$cache[$key] = $result[$key];
return $result[$key];
} else {
- throw new Exception("No config value specified for key '{$key}'.");
+ throw new Exception(
+ pht(
+ "No config value specified for key '%s'.",
+ $key));
}
}
@@ -507,7 +510,9 @@ public static function getAnyBaseURI() {
if (!$base_uri) {
throw new Exception(
- "Define 'phabricator.base-uri' in your configuration to continue.");
+ pht(
+ "Define '%s' in your configuration to continue.",
+ 'phabricator.base-uri'));
}
return $base_uri;
@@ -553,8 +558,9 @@ public static function popTestEnvironment($key) {
if ($stack_key !== $key) {
self::$sourceStack->pushSource($source);
throw new Exception(
- 'Scoped environments were destroyed in a diffent order than they '.
- 'were initialized.');
+ pht(
+ 'Scoped environments were destroyed in a different order than they '.
+ 'were initialized.'));
}
}
diff --git a/src/infrastructure/env/__tests__/PhabricatorEnvTestCase.php b/src/infrastructure/env/__tests__/PhabricatorEnvTestCase.php
index e363cf2fb1..d47258822b 100644
--- a/src/infrastructure/env/__tests__/PhabricatorEnvTestCase.php
+++ b/src/infrastructure/env/__tests__/PhabricatorEnvTestCase.php
@@ -20,7 +20,7 @@ public function testLocalURIForLink() {
$this->assertEqual(
$expect,
PhabricatorEnv::isValidLocalURIForLink($uri),
- "Valid local resource: {$uri}");
+ pht('Valid local resource: %s', $uri));
}
}
@@ -37,7 +37,7 @@ public function testRemoteURIForLink() {
$this->assertEqual(
$expect,
PhabricatorEnv::isValidRemoteURIForLink($uri),
- "Valid linkable remote URI: {$uri}");
+ pht('Valid linkable remote URI: %s', $uri));
}
}
@@ -78,7 +78,7 @@ public function testRemoteURIForFetch() {
$this->assertEqual(
$expect,
PhabricatorEnv::isValidRemoteURIForFetch($uri, $protocols),
- "Valid fetchable remote URI: {$uri}");
+ pht('Valid fetchable remote URI: %s', $uri));
}
}
@@ -185,8 +185,9 @@ public function testOverrideOrder() {
$this->assertTrue(
$caught instanceof Exception,
- 'Destroying a scoped environment which is not on the top of the stack '.
- 'should throw.');
+ pht(
+ 'Destroying a scoped environment which is not on the top of the '.
+ 'stack should throw.'));
if (phutil_is_hiphop_runtime()) {
$inner->__destruct();
diff --git a/src/infrastructure/events/PhabricatorEventEngine.php b/src/infrastructure/events/PhabricatorEventEngine.php
index 67807317c6..0cbeb478ac 100644
--- a/src/infrastructure/events/PhabricatorEventEngine.php
+++ b/src/infrastructure/events/PhabricatorEventEngine.php
@@ -23,7 +23,7 @@ public static function initialize() {
}
}
- // Add builtin listeners.
+ // Add built-in listeners.
$listeners[] = new DarkConsoleEventPluginAPI();
// Add application listeners.
diff --git a/src/infrastructure/events/PhabricatorEventListener.php b/src/infrastructure/events/PhabricatorEventListener.php
index abaad375e6..be07500163 100644
--- a/src/infrastructure/events/PhabricatorEventListener.php
+++ b/src/infrastructure/events/PhabricatorEventListener.php
@@ -30,7 +30,7 @@ public function canUseApplication(PhabricatorUser $viewer) {
protected function addActionMenuItems(PhutilEvent $event, $items) {
if ($event->getType() !== PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS) {
- throw new Exception('Not an action menu event!');
+ throw new Exception(pht('Not an action menu event!'));
}
if (!$items) {
diff --git a/src/infrastructure/events/PhabricatorExampleEventListener.php b/src/infrastructure/events/PhabricatorExampleEventListener.php
index fb85678da1..3e3353f376 100644
--- a/src/infrastructure/events/PhabricatorExampleEventListener.php
+++ b/src/infrastructure/events/PhabricatorExampleEventListener.php
@@ -23,7 +23,7 @@ public function handleEvent(PhutilEvent $event) {
$console->writeOut(
"%s\n",
pht(
- '% got test event at %d',
+ '%s got test event at %d',
__CLASS__,
$event->getValue('time')));
}
diff --git a/src/infrastructure/internationalization/translation/PhabricatorBritishEnglishTranslation.php b/src/infrastructure/internationalization/translation/PhabricatorBritishEnglishTranslation.php
index 3361b963b9..530b3aac14 100644
--- a/src/infrastructure/internationalization/translation/PhabricatorBritishEnglishTranslation.php
+++ b/src/infrastructure/internationalization/translation/PhabricatorBritishEnglishTranslation.php
@@ -9,8 +9,8 @@ public function getLocaleCode() {
protected function getTranslations() {
return array(
- '%s set this project\'s color to %s.' =>
- '%s set this project\'s colour to %s.',
+ "%s set this project's color to %s." =>
+ "%s set this project's colour to %s.",
'Basic Colors' =>
'Basic Colours',
'Choose Icon and Color...' =>
diff --git a/src/infrastructure/internationalization/translation/PhabricatorUSEnglishTranslation.php b/src/infrastructure/internationalization/translation/PhabricatorUSEnglishTranslation.php
index a1e0433b2c..111e38857f 100644
--- a/src/infrastructure/internationalization/translation/PhabricatorUSEnglishTranslation.php
+++ b/src/infrastructure/internationalization/translation/PhabricatorUSEnglishTranslation.php
@@ -1067,6 +1067,35 @@ protected function getTranslations() {
),
),
+ 'These %s object(s) will be destroyed forever:' => array(
+ 'This object will be destroyed forever:',
+ 'These objects will be destroyed forever:',
+ ),
+
+ 'Are you absolutely certain you want to destroy these %s '.
+ 'object(s)?' => array(
+ 'Are you absolutely certain you want to destroy this object?',
+ 'Are you absolutely certain you want to destroy these objects?',
+ ),
+
+ '%s added %s owner(s): %s.' => array(
+ array(
+ '%s added an owner: %3$s.',
+ '%s added owners: %3$s.',
+ ),
+ ),
+
+ '%s removed %s owner(s): %s.' => array(
+ array(
+ '%s removed an owner: %3$s.',
+ '%s removed owners: %3$s.',
+ ),
+ ),
+
+ '%s changed %s package owner(s), added %s: %s; removed %s: %s.' => array(
+ '%s changed package owners, added: %4$s; removed: %6$s.',
+ ),
+
);
}
diff --git a/src/infrastructure/lint/linter/PhabricatorJavelinLinter.php b/src/infrastructure/lint/linter/PhabricatorJavelinLinter.php
index 2cca2030af..d235dc889a 100644
--- a/src/infrastructure/lint/linter/PhabricatorJavelinLinter.php
+++ b/src/infrastructure/lint/linter/PhabricatorJavelinLinter.php
@@ -14,7 +14,7 @@ final class PhabricatorJavelinLinter extends ArcanistLinter {
const LINT_MISSING_BINARY = 5;
public function getInfoName() {
- return 'Javelin Linter';
+ return pht('Javelin Linter');
}
public function getInfoDescription() {
@@ -71,11 +71,16 @@ public function getLintSeverityMap() {
public function getLintNameMap() {
return array(
- self::LINT_PRIVATE_ACCESS => 'Private Method/Member Access',
- self::LINT_MISSING_DEPENDENCY => 'Missing Javelin Dependency',
- self::LINT_UNNECESSARY_DEPENDENCY => 'Unnecessary Javelin Dependency',
- self::LINT_UNKNOWN_DEPENDENCY => 'Unknown Javelin Dependency',
- self::LINT_MISSING_BINARY => '`javelinsymbols` Not In Path',
+ self::LINT_PRIVATE_ACCESS =>
+ pht('Private Method/Member Access'),
+ self::LINT_MISSING_DEPENDENCY =>
+ pht('Missing Javelin Dependency'),
+ self::LINT_UNNECESSARY_DEPENDENCY =>
+ pht('Unnecessary Javelin Dependency'),
+ self::LINT_UNKNOWN_DEPENDENCY =>
+ pht('Unknown Javelin Dependency'),
+ self::LINT_MISSING_BINARY =>
+ pht('`%s` Not In Path', 'javelinsymbols'),
);
}
@@ -110,10 +115,12 @@ public function lintPath($path) {
1,
0,
self::LINT_MISSING_BINARY,
- "The 'javelinsymbols' binary in the Javelin project is not ".
- "available in \$PATH, so the Javelin linter can't run. This ".
- "isn't a big concern, but means some Javelin problems can't be ".
- "automatically detected.");
+ pht(
+ "The '%s' binary in the Javelin project is not available in %s, ".
+ "so the Javelin linter can't run. This isn't a big concern, ".
+ "but means some Javelin problems can't be automatically detected.",
+ 'javelinsymbols',
+ '$PATH'));
}
return;
}
@@ -129,9 +136,11 @@ public function lintPath($path) {
$line,
0,
self::LINT_PRIVATE_ACCESS,
- "This file accesses private symbol '{$symbol}' across file ".
- "boundaries. You may only access private members and methods ".
- "from the file where they are defined.");
+ pht(
+ "This file accesses private symbol '%s' across file ".
+ "boundaries. You may only access private members and methods ".
+ "from the file where they are defined.",
+ $symbol));
}
break;
}
@@ -169,8 +178,11 @@ public function lintPath($path) {
0,
0,
self::LINT_UNKNOWN_DEPENDENCY,
- "This file @requires component '{$requires_symbol}', but it does ".
- "not exist. You may need to rebuild the Celerity map.");
+ pht(
+ "This file %s component '%s', but it does not exist. ".
+ "You may need to rebuild the Celerity map.",
+ '@requires',
+ $requires_symbol));
unset($requires[$key]);
continue;
}
@@ -194,8 +206,10 @@ public function lintPath($path) {
$line,
0,
self::LINT_MISSING_DEPENDENCY,
- "This file uses '{$class}' but does not @requires the component ".
- "which installs it. You may need to rebuild the Celerity map.");
+ pht(
+ "This file uses '%s' but does not @requires the component ".
+ "which installs it. You may need to rebuild the Celerity map.",
+ $class));
}
foreach ($requires as $component) {
@@ -203,8 +217,10 @@ public function lintPath($path) {
0,
0,
self::LINT_UNNECESSARY_DEPENDENCY,
- "This file @requires component '{$component}' but does not use ".
- "anything it provides.");
+ pht(
+ "This file %s component '%s' but does not use anything it provides.",
+ '@requires',
+ $component));
}
}
@@ -237,7 +253,7 @@ private function getUsedAndInstalledSymbolsForPath($path) {
$matches = null;
if (!preg_match('/^([?+\*])([^:]*):(\d+)$/', $line, $matches)) {
throw new Exception(
- 'Received malformed output from `javelinsymbols`.');
+ pht('Received malformed output from `%s`.', 'javelinsymbols'));
}
$type = $matches[1];
$symbol = $matches[2];
diff --git a/src/infrastructure/markup/PhabricatorMarkupEngine.php b/src/infrastructure/markup/PhabricatorMarkupEngine.php
index c29dddd821..7083a69738 100644
--- a/src/infrastructure/markup/PhabricatorMarkupEngine.php
+++ b/src/infrastructure/markup/PhabricatorMarkupEngine.php
@@ -190,12 +190,17 @@ public function getEngineMetadata(
private function requireKeyProcessed($key) {
if (empty($this->objects[$key])) {
throw new Exception(
- "Call addObject() before using results (key = '{$key}').");
+ pht(
+ "Call %s before using results (key = '%s').",
+ 'addObject()',
+ $key));
}
if (!isset($this->objects[$key]['output'])) {
throw new Exception(
- 'Call process() before using results.');
+ pht(
+ 'Call %s before using results.',
+ 'process()'));
}
}
@@ -417,7 +422,7 @@ public static function getEngine($ruleset = 'default') {
$engine->setConfig('pygments.enabled', false);
break;
default:
- throw new Exception("Unknown engine ruleset: {$ruleset}!");
+ throw new Exception(pht('Unknown engine ruleset: %s!', $ruleset));
}
$engines[$ruleset] = $engine;
@@ -449,7 +454,6 @@ private static function getMarkupEngineDefaultConfiguration() {
* @task engine
*/
public static function newMarkupEngine(array $options) {
-
$options += self::getMarkupEngineDefaultConfiguration();
$engine = new PhutilRemarkupEngine();
diff --git a/src/infrastructure/markup/interpreter/PhabricatorRemarkupCowsayBlockInterpreter.php b/src/infrastructure/markup/interpreter/PhabricatorRemarkupCowsayBlockInterpreter.php
index 8f3cd3552c..d1c4de1154 100644
--- a/src/infrastructure/markup/interpreter/PhabricatorRemarkupCowsayBlockInterpreter.php
+++ b/src/infrastructure/markup/interpreter/PhabricatorRemarkupCowsayBlockInterpreter.php
@@ -10,7 +10,9 @@ public function getInterpreterName() {
public function markupContent($content, array $argv) {
if (!Filesystem::binaryExists('cowsay')) {
return $this->markupError(
- pht('Unable to locate the `cowsay` binary. Install cowsay.'));
+ pht(
+ 'Unable to locate the `%s` binary. Install cowsay.',
+ 'cowsay'));
}
$bin = idx($argv, 'think') ? 'cowthink' : 'cowsay';
diff --git a/src/infrastructure/query/order/PhabricatorQueryOrderItem.php b/src/infrastructure/query/order/PhabricatorQueryOrderItem.php
index a37cb92e04..474b495e48 100644
--- a/src/infrastructure/query/order/PhabricatorQueryOrderItem.php
+++ b/src/infrastructure/query/order/PhabricatorQueryOrderItem.php
@@ -15,8 +15,7 @@
* This class is primarily internal to the query infrastructure, and most
* application code should not need to interact with it directly.
*/
-final class PhabricatorQueryOrderItem
- extends Phobject {
+final class PhabricatorQueryOrderItem extends Phobject {
private $orderKey;
private $isReversed;
diff --git a/src/infrastructure/query/policy/PhabricatorPolicyAwareQuery.php b/src/infrastructure/query/policy/PhabricatorPolicyAwareQuery.php
index e1b2028a19..1d8f10b916 100644
--- a/src/infrastructure/query/policy/PhabricatorPolicyAwareQuery.php
+++ b/src/infrastructure/query/policy/PhabricatorPolicyAwareQuery.php
@@ -172,7 +172,7 @@ final public function executeOne() {
}
if (count($results) > 1) {
- throw new Exception('Expected a single result!');
+ throw new Exception(pht('Expected a single result!'));
}
if (!$results) {
@@ -191,7 +191,7 @@ final public function executeOne() {
*/
final public function execute() {
if (!$this->viewer) {
- throw new Exception('Call setViewer() before execute()!');
+ throw new PhutilInvalidStateException('setViewer');
}
$parent_query = $this->getParentQuery();
diff --git a/src/infrastructure/sms/management/PhabricatorSMSManagementListOutboundWorkflow.php b/src/infrastructure/sms/management/PhabricatorSMSManagementListOutboundWorkflow.php
index 1597ba928c..5766201667 100644
--- a/src/infrastructure/sms/management/PhabricatorSMSManagementListOutboundWorkflow.php
+++ b/src/infrastructure/sms/management/PhabricatorSMSManagementListOutboundWorkflow.php
@@ -6,17 +6,16 @@ final class PhabricatorSMSManagementListOutboundWorkflow
protected function didConstruct() {
$this
->setName('list-outbound')
- ->setSynopsis('List outbound sms messages sent by Phabricator.')
- ->setExamples(
- '**list-outbound**')
+ ->setSynopsis(pht('List outbound SMS messages sent by Phabricator.'))
+ ->setExamples('**list-outbound**')
->setArguments(
array(
array(
'name' => 'limit',
'param' => 'N',
'default' => 100,
- 'help' =>
- 'Show a specific number of sms messages (default 100).',
+ 'help' => pht(
+ 'Show a specific number of SMS messages (default 100).'),
),
));
}
@@ -30,15 +29,15 @@ public function execute(PhutilArgumentParser $args) {
$args->getArg('limit'));
if (!$sms_messages) {
- $console->writeErr("%s\n", pht('No sent sms.'));
+ $console->writeErr("%s\n", pht('No sent SMS.'));
return 0;
}
$table = id(new PhutilConsoleTable())
->setShowHeader(false)
- ->addColumn('id', array('title' => 'ID'))
- ->addColumn('status', array('title' => 'Status'))
- ->addColumn('recv', array('title' => 'Recipient'));
+ ->addColumn('id', array('title' => pht('ID')))
+ ->addColumn('status', array('title' => pht('Status')))
+ ->addColumn('recv', array('title' => pht('Recipient')));
foreach (array_reverse($sms_messages) as $sms) {
$table->addRow(array(
diff --git a/src/infrastructure/sms/management/PhabricatorSMSManagementSendTestWorkflow.php b/src/infrastructure/sms/management/PhabricatorSMSManagementSendTestWorkflow.php
index c49f9443a6..7bb4573099 100644
--- a/src/infrastructure/sms/management/PhabricatorSMSManagementSendTestWorkflow.php
+++ b/src/infrastructure/sms/management/PhabricatorSMSManagementSendTestWorkflow.php
@@ -8,22 +8,21 @@ protected function didConstruct() {
->setName('send-test')
->setSynopsis(
pht(
- 'Simulate sending an sms. This may be useful to test your sms '.
- 'configuration, or while developing new sms adapters.'))
- ->setExamples(
- "**send-test** --to 12345678 --body 'pizza time yet?'")
+ 'Simulate sending an SMS. This may be useful to test your SMS '.
+ 'configuration, or while developing new SMS adapters.'))
+ ->setExamples("**send-test** --to 12345678 --body 'pizza time yet?'")
->setArguments(
array(
array(
'name' => 'to',
'param' => 'number',
- 'help' => 'Send sms "To:" the specified number.',
+ 'help' => pht('Send SMS "To:" the specified number.'),
'repeat' => true,
),
array(
'name' => 'body',
'param' => 'text',
- 'help' => 'Send sms with the specified body.',
+ 'help' => pht('Send SMS with the specified body.'),
),
));
}
diff --git a/src/infrastructure/sms/management/PhabricatorSMSManagementShowOutboundWorkflow.php b/src/infrastructure/sms/management/PhabricatorSMSManagementShowOutboundWorkflow.php
index d9bd7e65a0..19a306b6da 100644
--- a/src/infrastructure/sms/management/PhabricatorSMSManagementShowOutboundWorkflow.php
+++ b/src/infrastructure/sms/management/PhabricatorSMSManagementShowOutboundWorkflow.php
@@ -6,7 +6,7 @@ final class PhabricatorSMSManagementShowOutboundWorkflow
protected function didConstruct() {
$this
->setName('show-outbound')
- ->setSynopsis('Show diagnostic details about outbound sms.')
+ ->setSynopsis(pht('Show diagnostic details about outbound SMS.'))
->setExamples(
'**show-outbound** --id 1 --id 2')
->setArguments(
@@ -14,7 +14,7 @@ protected function didConstruct() {
array(
'name' => 'id',
'param' => 'id',
- 'help' => 'Show details about outbound sms with given ID.',
+ 'help' => pht('Show details about outbound SMS with given ID.'),
'repeat' => true,
),
));
@@ -26,7 +26,9 @@ public function execute(PhutilArgumentParser $args) {
$ids = $args->getArg('id');
if (!$ids) {
throw new PhutilArgumentUsageException(
- "Use the '--id' flag to specify one or more sms messages to show.");
+ pht(
+ "Use the '%s' flag to specify one or more SMS messages to show.",
+ '--id'));
}
$messages = id(new PhabricatorSMS())->loadAllWhere(
@@ -38,8 +40,9 @@ public function execute(PhutilArgumentParser $args) {
$missing = array_diff_key($ids, $messages);
if ($missing) {
throw new PhutilArgumentUsageException(
- 'Some specified sms messages do not exist: '.
- implode(', ', array_keys($missing)));
+ pht(
+ 'Some specified SMS messages do not exist: %s',
+ implode(', ', array_keys($missing))));
}
}
diff --git a/src/infrastructure/sms/worker/PhabricatorSMSDemultiplexWorker.php b/src/infrastructure/sms/worker/PhabricatorSMSDemultiplexWorker.php
index daa5244a10..60baa0dbd8 100644
--- a/src/infrastructure/sms/worker/PhabricatorSMSDemultiplexWorker.php
+++ b/src/infrastructure/sms/worker/PhabricatorSMSDemultiplexWorker.php
@@ -1,7 +1,6 @@
save();
throw new PhabricatorWorkerPermanentFailureException(
pht(
- 'Phabricator is running in silent mode. See `phabricator.silent` '.
- 'in the configuration to change this setting.'));
+ 'Phabricator is running in silent mode. See `%s` '.
+ 'in the configuration to change this setting.',
+ 'phabricator.silent'));
}
try {
diff --git a/src/infrastructure/ssh/PhabricatorSSHPassthruCommand.php b/src/infrastructure/ssh/PhabricatorSSHPassthruCommand.php
index f27d44660d..9cd9614880 100644
--- a/src/infrastructure/ssh/PhabricatorSSHPassthruCommand.php
+++ b/src/infrastructure/ssh/PhabricatorSSHPassthruCommand.php
@@ -90,15 +90,24 @@ public function execute() {
$error_channel = $this->errorChannel;
if (!$command_channel) {
- throw new Exception('Set a command channel before calling execute()!');
+ throw new Exception(
+ pht(
+ 'Set a command channel before calling %s!',
+ __FUNCTION__.'()'));
}
if (!$io_channel) {
- throw new Exception('Set an IO channel before calling execute()!');
+ throw new Exception(
+ pht(
+ 'Set an IO channel before calling %s!',
+ __FUNCTION__.'()'));
}
if (!$error_channel) {
- throw new Exception('Set an error channel before calling execute()!');
+ throw new Exception(
+ pht(
+ 'Set an error channel before calling %s!',
+ __FUNCTION__.'()'));
}
$channels = array($command_channel, $io_channel, $error_channel);
diff --git a/src/infrastructure/storage/__tests__/AphrontIsolatedDatabaseConnectionTestCase.php b/src/infrastructure/storage/__tests__/AphrontIsolatedDatabaseConnectionTestCase.php
index ed3c8560d5..a0a64481bd 100644
--- a/src/infrastructure/storage/__tests__/AphrontIsolatedDatabaseConnectionTestCase.php
+++ b/src/infrastructure/storage/__tests__/AphrontIsolatedDatabaseConnectionTestCase.php
@@ -30,11 +30,11 @@ public function testInsertGeneratesID() {
queryfx($conn, 'INSERT');
$id2 = $conn->getInsertID();
- $this->assertTrue((bool)$id1, 'ID1 exists.');
- $this->assertTrue((bool)$id2, 'ID2 exists.');
+ $this->assertTrue((bool)$id1, pht('ID1 exists.'));
+ $this->assertTrue((bool)$id2, pht('ID2 exists.'));
$this->assertTrue(
$id1 != $id2,
- "IDs '{$id1}' and '{$id2}' are distinct.");
+ pht("IDs '%s' and '%s' are distinct.", $id1, $id2));
}
public function testDeletePermitted() {
@@ -133,7 +133,7 @@ private function assertNoSuchRow($data) {
$this->assertEqual(
null,
$row,
- 'Expect fake row to exist only in isolation.');
+ pht('Expect fake row to exist only in isolation.'));
} catch (AphrontConnectionQueryException $ex) {
// If we can't connect to the database, conclude that the isolated
// connection actually is isolated. Philosophically, this perhaps allows
diff --git a/src/infrastructure/storage/__tests__/QueryFormattingTestCase.php b/src/infrastructure/storage/__tests__/QueryFormattingTestCase.php
index 1e2955bbbc..6bd0eeedaf 100644
--- a/src/infrastructure/storage/__tests__/QueryFormattingTestCase.php
+++ b/src/infrastructure/storage/__tests__/QueryFormattingTestCase.php
@@ -25,7 +25,7 @@ public function testQueryFormatting() {
}
$this->assertTrue(
(bool)$raised,
- 'qsprintf should raise exception for invalid %d conversion.');
+ pht('%s should raise exception for invalid %%d conversion.', 'qsprintf'));
$this->assertEqual(
"''",
diff --git a/src/infrastructure/storage/lisk/LiskDAO.php b/src/infrastructure/storage/lisk/LiskDAO.php
index d21001c0a3..9d8172e02a 100644
--- a/src/infrastructure/storage/lisk/LiskDAO.php
+++ b/src/infrastructure/storage/lisk/LiskDAO.php
@@ -498,7 +498,9 @@ public function loadOneWhere($pattern /* , $arg, $arg, $arg ... */) {
if (count($data) > 1) {
throw new AphrontCountQueryException(
- 'More than 1 result from loadOneWhere()!');
+ pht(
+ 'More than one result from %s!',
+ __FUNCTION__.'()'));
}
$data = reset($data);
@@ -545,7 +547,8 @@ protected function loadRawDataWhere($pattern /* , $args... */) {
*/
public function reload() {
if (!$this->getID()) {
- throw new Exception("Unable to reload object that hasn't been loaded!");
+ throw new Exception(
+ pht("Unable to reload object that hasn't been loaded!"));
}
$result = $this->loadOneWhere(
@@ -809,7 +812,9 @@ final public function loadOneRelative(
if (count($relatives) > 1) {
throw new AphrontCountQueryException(
- 'More than 1 result from loadOneRelative()!');
+ pht(
+ 'More than one result from %s!',
+ __FUNCTION__.'()'));
}
return reset($relatives);
@@ -954,7 +959,10 @@ protected function checkProperty($property) {
*/
public function establishConnection($mode, $force_new = false) {
if ($mode != 'r' && $mode != 'w') {
- throw new Exception("Unknown mode '{$mode}', should be 'r' or 'w'.");
+ throw new Exception(
+ pht(
+ "Unknown mode '%s', should be 'r' or 'w'.",
+ $mode));
}
if ($this->forcedConnection) {
@@ -1218,7 +1226,7 @@ protected function insertRecordIntoDatabase($mode) {
case self::IDS_MANUAL:
break;
default:
- throw new Exception('Unknown CONFIG_IDs mechanism!');
+ throw new Exception(pht('Unknown %s mechanism!', 'CONFIG_IDs'));
}
$this->willWriteData($data);
@@ -1237,7 +1245,7 @@ protected function insertRecordIntoDatabase($mode) {
throw new PhutilProxyException(
pht(
"Unable to insert or update object of class %s, field '%s' ".
- "has a nonscalar value.",
+ "has a non-scalar value.",
get_class($this),
$key),
$parameter_exception);
@@ -1273,9 +1281,10 @@ protected function shouldInsertWhenSaved() {
if ($key_type == self::IDS_MANUAL) {
throw new Exception(
- 'You are using manual IDs. You must override the '.
- 'shouldInsertWhenSaved() method to properly detect '.
- 'when to insert a new record.');
+ pht(
+ 'You are using manual IDs. You must override the %s method '.
+ 'to properly detect when to insert a new record.',
+ __FUNCTION__.'()'));
} else {
return !$this->getID();
}
@@ -1314,8 +1323,9 @@ protected function getIDKeyForUse() {
$id_key = $this->getIDKey();
if (!$id_key) {
throw new Exception(
- 'This DAO does not have a single-part primary key. The method you '.
- 'called requires a single-part primary key.');
+ pht(
+ 'This DAO does not have a single-part primary key. The method you '.
+ 'called requires a single-part primary key.'));
}
return $id_key;
}
@@ -1330,8 +1340,10 @@ protected function getIDKeyForUse() {
*/
public function generatePHID() {
throw new Exception(
- 'To use CONFIG_AUX_PHID, you need to overload '.
- 'generatePHID() to perform PHID generation.');
+ pht(
+ 'To use %s, you need to overload %s to perform PHID generation.',
+ 'CONFIG_AUX_PHID',
+ 'generatePHID()'));
}
@@ -1555,7 +1567,7 @@ public static function endIsolateAllLiskEffectsToCurrentProcess() {
self::$processIsolationLevel--;
if (self::$processIsolationLevel < 0) {
throw new Exception(
- 'Lisk process isolation level was reduced below 0.');
+ pht('Lisk process isolation level was reduced below 0.'));
}
}
@@ -1591,7 +1603,7 @@ public static function endIsolateAllLiskEffectsToTransactions() {
self::$transactionIsolationLevel--;
if (self::$transactionIsolationLevel < 0) {
throw new Exception(
- 'Lisk transaction isolation level was reduced below 0.');
+ pht('Lisk transaction isolation level was reduced below 0.'));
} else if (self::$transactionIsolationLevel == 0) {
foreach (self::$connections as $key => $conn) {
if ($conn) {
@@ -1643,7 +1655,8 @@ protected function applyLiskDataSerialization(array &$data, $deserialize) {
}
break;
default:
- throw new Exception("Unknown serialization format '{$format}'.");
+ throw new Exception(
+ pht("Unknown serialization format '%s'.", $format));
}
}
}
@@ -1680,11 +1693,11 @@ final protected function call($method, $args) {
$property = $dispatch_map[$method];
} else {
if (substr($method, 0, 3) !== 'get') {
- throw new Exception("Unable to resolve method '{$method}'!");
+ throw new Exception(pht("Unable to resolve method '%s'!", $method));
}
$property = substr($method, 3);
if (!($property = $this->checkProperty($property))) {
- throw new Exception("Bad getter call: {$method}");
+ throw new Exception(pht('Bad getter call: %s', $method));
}
$dispatch_map[$method] = $property;
}
@@ -1697,12 +1710,12 @@ final protected function call($method, $args) {
$property = $dispatch_map[$method];
} else {
if (substr($method, 0, 3) !== 'set') {
- throw new Exception("Unable to resolve method '{$method}'!");
+ throw new Exception(pht("Unable to resolve method '%s'!", $method));
}
$property = substr($method, 3);
$property = $this->checkProperty($property);
if (!$property) {
- throw new Exception("Bad setter call: {$method}");
+ throw new Exception(pht('Bad setter call: %s', $method));
}
$dispatch_map[$method] = $property;
}
@@ -1712,7 +1725,7 @@ final protected function call($method, $args) {
return $this;
}
- throw new Exception("Unable to resolve method '{$method}'.");
+ throw new Exception(pht("Unable to resolve method '%s'.", $method));
}
/**
@@ -1721,7 +1734,10 @@ final protected function call($method, $args) {
* @task util
*/
public function __set($name, $value) {
- phlog('Wrote to undeclared property '.get_class($this).'::$'.$name.'.');
+ phlog(
+ pht(
+ 'Wrote to undeclared property %s.',
+ get_class($this).'::$'.$name));
$this->$name = $value;
}
diff --git a/src/infrastructure/storage/lisk/LiskDAOSet.php b/src/infrastructure/storage/lisk/LiskDAOSet.php
index 399aef3687..f81f54f9c9 100644
--- a/src/infrastructure/storage/lisk/LiskDAOSet.php
+++ b/src/infrastructure/storage/lisk/LiskDAOSet.php
@@ -27,7 +27,10 @@ final class LiskDAOSet {
public function addToSet(LiskDAO $dao) {
if ($this->relatives) {
- throw new Exception("Don't call addToSet() after loading data!");
+ throw new Exception(
+ pht(
+ "Don't call %s after loading data!",
+ __FUNCTION__.'()'));
}
$this->daos[] = $dao;
$dao->putInSet($this);
diff --git a/src/infrastructure/storage/lisk/PhabricatorDataNotAttachedException.php b/src/infrastructure/storage/lisk/PhabricatorDataNotAttachedException.php
index 7e32428b5e..6f25c4d553 100644
--- a/src/infrastructure/storage/lisk/PhabricatorDataNotAttachedException.php
+++ b/src/infrastructure/storage/lisk/PhabricatorDataNotAttachedException.php
@@ -15,21 +15,21 @@ public function __construct($object) {
if (is_array($frame)) {
$method = idx($frame, 'function');
if (preg_match('/^get[A-Z]/', $method)) {
- $via = " (via {$method}())";
+ $via = ' '.pht('(via %s)', "{$method}()");
}
}
- $class = get_class($object);
-
- $message =
- "Attempting to access attached data on {$class}{$via}, but the data is ".
- "not actually attached. Before accessing attachable data on an object, ".
- "you must load and attach it.\n\n".
- "Data is normally attached by calling the corresponding needX() ".
- "method on the Query class when the object is loaded. You can also ".
- "call the corresponding attachX() method explicitly.";
-
- parent::__construct($message);
+ parent::__construct(
+ pht(
+ "Attempting to access attached data on %s, but the data is not ".
+ "actually attached. Before accessing attachable data on an object, ".
+ "you must load and attach it.\n\n".
+ "Data is normally attached by calling the corresponding %s method on ".
+ "the Query class when the object is loaded. You can also call the ".
+ "corresponding %s method explicitly.",
+ get_class($object).$via,
+ 'needX()',
+ 'attachX()'));
}
}
diff --git a/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php b/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php
index f233fe25e7..534c38b7dc 100644
--- a/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php
+++ b/src/infrastructure/storage/lisk/PhabricatorLiskDAO.php
@@ -42,7 +42,7 @@ public static function getStorageNamespace() {
$namespace = self::getDefaultStorageNamespace();
}
if (!strlen($namespace)) {
- throw new Exception('No storage namespace configured!');
+ throw new Exception(pht('No storage namespace configured!'));
}
return $namespace;
}
diff --git a/src/infrastructure/storage/lisk/__tests__/LiskFixtureTestCase.php b/src/infrastructure/storage/lisk/__tests__/LiskFixtureTestCase.php
index c4bd744abc..065c23e2ff 100644
--- a/src/infrastructure/storage/lisk/__tests__/LiskFixtureTestCase.php
+++ b/src/infrastructure/storage/lisk/__tests__/LiskFixtureTestCase.php
@@ -67,7 +67,7 @@ public function testReadableTransactions() {
$this->assertTrue(
($loaded !== null),
- 'Reads inside transactions should have transaction visibility.');
+ pht('Reads inside transactions should have transaction visibility.'));
LiskDAO::beginIsolateAllLiskEffectsToTransactions();
} catch (Exception $ex) {
diff --git a/src/infrastructure/storage/lisk/__tests__/LiskIsolationTestCase.php b/src/infrastructure/storage/lisk/__tests__/LiskIsolationTestCase.php
index 848dfe7b67..8ff5068505 100644
--- a/src/infrastructure/storage/lisk/__tests__/LiskIsolationTestCase.php
+++ b/src/infrastructure/storage/lisk/__tests__/LiskIsolationTestCase.php
@@ -5,21 +5,21 @@ final class LiskIsolationTestCase extends PhabricatorTestCase {
public function testIsolatedWrites() {
$dao = new LiskIsolationTestDAO();
- $this->assertEqual(null, $dao->getID(), 'Expect no ID.');
- $this->assertEqual(null, $dao->getPHID(), 'Expect no PHID.');
+ $this->assertEqual(null, $dao->getID(), pht('Expect no ID.'));
+ $this->assertEqual(null, $dao->getPHID(), pht('Expect no PHID.'));
$dao->save(); // Effects insert
$id = $dao->getID();
$phid = $dao->getPHID();
- $this->assertTrue((bool)$id, 'Expect ID generated.');
- $this->assertTrue((bool)$phid, 'Expect PHID generated.');
+ $this->assertTrue((bool)$id, pht('Expect ID generated.'));
+ $this->assertTrue((bool)$phid, pht('Expect PHID generated.'));
$dao->save(); // Effects update
- $this->assertEqual($id, $dao->getID(), 'Expect ID unchanged.');
- $this->assertEqual($phid, $dao->getPHID(), 'Expect PHID unchanged.');
+ $this->assertEqual($id, $dao->getID(), pht('Expect ID unchanged.'));
+ $this->assertEqual($phid, $dao->getPHID(), pht('Expect PHID unchanged.'));
}
public function testEphemeral() {
@@ -50,8 +50,10 @@ public function testIsolationContainment() {
$method->invoke($dao, 'r');
$this->assertFailure(
- 'LiskIsolationTestDAO did not throw an exception when instructed to '.
- 'explicitly connect to an external database.');
+ pht(
+ '%s did not throw an exception when instructed to '.
+ 'explicitly connect to an external database.',
+ 'LiskIsolationTestDAO'));
} catch (LiskIsolationTestDAOException $ex) {
// Expected, pass.
}
@@ -66,17 +68,17 @@ public function testMagicMethods() {
$this->assertEqual(
null,
$dao->getName(),
- 'getName() on empty object');
+ pht('%s on empty object', 'getName()'));
$this->assertEqual(
$dao,
$dao->setName('x'),
- 'setName() returns $this');
+ pht('%s returns %s', 'setName()', '$this'));
$this->assertEqual(
'y',
$dao->setName('y')->getName(),
- 'setName() has an effect');
+ pht('%s has an effect', 'setName()'));
$ex = null;
try {
@@ -86,7 +88,7 @@ public function testMagicMethods() {
}
$this->assertTrue(
(bool)$ex,
- 'Typoing "get" should throw.');
+ pht('Typoing "%s" should throw.', 'get'));
$ex = null;
try {
@@ -96,7 +98,7 @@ public function testMagicMethods() {
}
$this->assertTrue(
(bool)$ex,
- 'Typoing "set" should throw.');
+ pht('Typoing "%s" should throw.', 'set'));
$ex = null;
try {
@@ -106,7 +108,7 @@ public function testMagicMethods() {
}
$this->assertTrue(
(bool)$ex,
- 'Made up method should throw.');
+ pht('Made up method should throw.'));
}
}
diff --git a/src/infrastructure/storage/lisk/__tests__/LiskIsolationTestDAO.php b/src/infrastructure/storage/lisk/__tests__/LiskIsolationTestDAO.php
index 7d5a5d6021..d9070753f8 100644
--- a/src/infrastructure/storage/lisk/__tests__/LiskIsolationTestDAO.php
+++ b/src/infrastructure/storage/lisk/__tests__/LiskIsolationTestDAO.php
@@ -17,8 +17,9 @@ public function generatePHID() {
protected function establishLiveConnection($mode) {
throw new LiskIsolationTestDAOException(
- 'Isolation failure! DAO is attempting to connect to an external '.
- 'resource!');
+ pht(
+ 'Isolation failure! DAO is attempting to connect to an external '.
+ 'resource!'));
}
protected function getConnectionNamespace() {
diff --git a/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementAdjustWorkflow.php b/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementAdjustWorkflow.php
index 8800bfb0e1..e7437a30b9 100644
--- a/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementAdjustWorkflow.php
+++ b/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementAdjustWorkflow.php
@@ -41,8 +41,9 @@ private function requireAllPatchesApplied() {
throw new PhutilArgumentUsageException(
pht(
'You have not initialized the database yet. You must initialize '.
- 'the database before you can adjust schemata. Run `storage upgrade` '.
- 'to initialize the database.'));
+ 'the database before you can adjust schemata. Run `%s` '.
+ 'to initialize the database.',
+ 'storage upgrade'));
}
$applied = array_fuse($applied);
@@ -56,8 +57,9 @@ private function requireAllPatchesApplied() {
pht(
'You have not applied all available storage patches yet. You must '.
'apply all available patches before you can adjust schemata. '.
- 'Run `storage status` to show patch status, and `storage upgrade` '.
- 'to apply missing patches.'));
+ 'Run `%s` to show patch status, and `%s` to apply missing patches.',
+ 'storage status',
+ 'storage upgrade'));
}
}
diff --git a/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementDatabasesWorkflow.php b/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementDatabasesWorkflow.php
index 085ba1c877..5509a32d73 100644
--- a/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementDatabasesWorkflow.php
+++ b/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementDatabasesWorkflow.php
@@ -7,7 +7,7 @@ protected function didConstruct() {
$this
->setName('databases')
->setExamples('**databases** [__options__]')
- ->setSynopsis('List Phabricator databases.');
+ ->setSynopsis(pht('List Phabricator databases.'));
}
public function execute(PhutilArgumentParser $args) {
diff --git a/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementDestroyWorkflow.php b/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementDestroyWorkflow.php
index 4666494e55..6c1c216359 100644
--- a/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementDestroyWorkflow.php
+++ b/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementDestroyWorkflow.php
@@ -7,13 +7,15 @@ protected function didConstruct() {
$this
->setName('destroy')
->setExamples('**destroy** [__options__]')
- ->setSynopsis('Permanently destroy all storage and data.')
+ ->setSynopsis(pht('Permanently destroy all storage and data.'))
->setArguments(
array(
array(
'name' => 'unittest-fixtures',
- 'help' => 'Restrict **destroy** operations to databases created '.
- 'by PhabricatorTestCase test fixtures.',
+ 'help' => pht(
+ 'Restrict **destroy** operations to databases created '.
+ 'by %s test fixtures.',
+ 'PhabricatorTestCase'),
),
));
}
@@ -24,17 +26,18 @@ public function execute(PhutilArgumentParser $args) {
if (!$is_dry && !$is_force) {
echo phutil_console_wrap(
- 'Are you completely sure you really want to permanently destroy all '.
- 'storage for Phabricator data? This operation can not be undone and '.
- 'your data will not be recoverable if you proceed.');
+ pht(
+ 'Are you completely sure you really want to permanently destroy all '.
+ 'storage for Phabricator data? This operation can not be undone and '.
+ 'your data will not be recoverable if you proceed.'));
- if (!phutil_console_confirm('Permanently destroy all data?')) {
- echo "Cancelled.\n";
+ if (!phutil_console_confirm(pht('Permanently destroy all data?'))) {
+ echo pht('Cancelled.')."\n";
exit(1);
}
- if (!phutil_console_confirm('Really destroy all data forever?')) {
- echo "Cancelled.\n";
+ if (!phutil_console_confirm(pht('Really destroy all data forever?'))) {
+ echo pht('Cancelled.')."\n";
exit(1);
}
}
@@ -61,9 +64,9 @@ public function execute(PhutilArgumentParser $args) {
foreach ($databases as $database) {
if ($is_dry) {
- echo "DRYRUN: Would drop database '{$database}'.\n";
+ echo pht("DRYRUN: Would drop database '%s'.", $database)."\n";
} else {
- echo "Dropping database '{$database}'...\n";
+ echo pht("Dropping database '%s'...", $database)."\n";
queryfx(
$api->getConn(null),
'DROP DATABASE IF EXISTS %T',
@@ -72,7 +75,7 @@ public function execute(PhutilArgumentParser $args) {
}
if (!$is_dry) {
- echo "Storage was destroyed.\n";
+ echo pht('Storage was destroyed.')."\n";
}
return 0;
diff --git a/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementDumpWorkflow.php b/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementDumpWorkflow.php
index 2c975bdece..e9a09bccd1 100644
--- a/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementDumpWorkflow.php
+++ b/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementDumpWorkflow.php
@@ -7,7 +7,7 @@ protected function didConstruct() {
$this
->setName('dump')
->setExamples('**dump** [__options__]')
- ->setSynopsis('Dump all data in storage to stdout.');
+ ->setSynopsis(pht('Dump all data in storage to stdout.'));
}
public function execute(PhutilArgumentParser $args) {
@@ -22,8 +22,9 @@ public function execute(PhutilArgumentParser $args) {
pht(
'**Storage Not Initialized**: There is no database storage '.
'initialized in this storage namespace ("%s"). Use '.
- '**storage upgrade** to initialize storage.',
- $namespace));
+ '**%s** to initialize storage.',
+ $namespace,
+ 'storage upgrade'));
return 1;
}
diff --git a/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementProbeWorkflow.php b/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementProbeWorkflow.php
index 00492f68ac..a4ef562c37 100644
--- a/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementProbeWorkflow.php
+++ b/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementProbeWorkflow.php
@@ -7,7 +7,7 @@ protected function didConstruct() {
$this
->setName('probe')
->setExamples('**probe**')
- ->setSynopsis('Show approximate table sizes.');
+ ->setSynopsis(pht('Show approximate table sizes.'));
}
public function execute(PhutilArgumentParser $args) {
diff --git a/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementQuickstartWorkflow.php b/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementQuickstartWorkflow.php
index b20787c05f..561e01cedd 100644
--- a/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementQuickstartWorkflow.php
+++ b/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementQuickstartWorkflow.php
@@ -26,7 +26,8 @@ public function execute(PhutilArgumentParser $args) {
if (!$output) {
throw new PhutilArgumentUsageException(
pht(
- 'Specify a file to write with `--output`.'));
+ 'Specify a file to write with `%s`.',
+ '--output'));
}
$namespace = 'phabricator_quickstart_'.Filesystem::readRandomCharacters(8);
@@ -95,7 +96,9 @@ public function execute(PhutilArgumentParser $args) {
// If we didn't make any changes, yell about it. We'll produce an invalid
// dump otherwise.
throw new PhutilArgumentUsageException(
- pht('Failed to apply hack to adjust FULLTEXT search column!'));
+ pht(
+ 'Failed to apply hack to adjust %s search column!',
+ 'FULLTEXT'));
}
$dump = str_replace(
diff --git a/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementShellWorkflow.php b/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementShellWorkflow.php
index ffbb018687..58a7c072a3 100644
--- a/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementShellWorkflow.php
+++ b/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementShellWorkflow.php
@@ -7,7 +7,7 @@ protected function didConstruct() {
$this
->setName('shell')
->setExamples('**shell** [__options__]')
- ->setSynopsis('Launch an interactive shell.');
+ ->setSynopsis(pht('Launch an interactive shell.'));
}
public function execute(PhutilArgumentParser $args) {
diff --git a/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementStatusWorkflow.php b/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementStatusWorkflow.php
index 8ab341996a..ebff080bd4 100644
--- a/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementStatusWorkflow.php
+++ b/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementStatusWorkflow.php
@@ -7,7 +7,7 @@ protected function didConstruct() {
$this
->setName('status')
->setExamples('**status** [__options__]')
- ->setSynopsis('Show patch application status.');
+ ->setSynopsis(pht('Show patch application status.'));
}
public function execute(PhutilArgumentParser $args) {
@@ -18,25 +18,26 @@ public function execute(PhutilArgumentParser $args) {
if ($applied === null) {
echo phutil_console_format(
- "**Database Not Initialized**: Run **storage upgrade** to ".
- "initialize.\n");
+ "**%s**: %s\n",
+ pht('Database Not Initialized'),
+ pht('Run **%s** to initialize.', 'storage upgrade'));
return 1;
}
$table = id(new PhutilConsoleTable())
->setShowHeader(false)
- ->addColumn('id', array('title' => 'ID'))
- ->addColumn('status', array('title' => 'Status'))
- ->addColumn('type', array('title' => 'Type'))
- ->addColumn('name', array('title' => 'Name'));
+ ->addColumn('id', array('title' => pht('ID')))
+ ->addColumn('status', array('title' => pht('Status')))
+ ->addColumn('type', array('title' => pht('Type')))
+ ->addColumn('name', array('title' => pht('Name')));
foreach ($patches as $patch) {
$table->addRow(array(
'id' => $patch->getFullKey(),
'status' => in_array($patch->getFullKey(), $applied)
- ? 'Applied'
- : 'Not Applied',
+ ? pht('Applied')
+ : pht('Not Applied'),
'type' => $patch->getType(),
'name' => $patch->getName(),
));
diff --git a/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementUpgradeWorkflow.php b/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementUpgradeWorkflow.php
index 3ce0891315..f6cf6ad473 100644
--- a/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementUpgradeWorkflow.php
+++ b/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementUpgradeWorkflow.php
@@ -7,7 +7,7 @@ protected function didConstruct() {
$this
->setName('upgrade')
->setExamples('**upgrade** [__options__]')
- ->setSynopsis('Upgrade database schemata.')
+ ->setSynopsis(pht('Upgrade database schemata.'))
->setArguments(
array(
array(
@@ -46,12 +46,14 @@ public function execute(PhutilArgumentParser $args) {
if (!$is_dry && !$is_force) {
echo phutil_console_wrap(
- 'Before running storage upgrades, you should take down the '.
- 'Phabricator web interface and stop any running Phabricator '.
- 'daemons (you can disable this warning with --force).');
-
- if (!phutil_console_confirm('Are you ready to continue?')) {
- echo "Cancelled.\n";
+ pht(
+ 'Before running storage upgrades, you should take down the '.
+ 'Phabricator web interface and stop any running Phabricator '.
+ 'daemons (you can disable this warning with %s).',
+ '--force'));
+
+ if (!phutil_console_confirm(pht('Are you ready to continue?'))) {
+ echo pht('Cancelled.')."\n";
return 1;
}
}
@@ -60,8 +62,12 @@ public function execute(PhutilArgumentParser $args) {
if ($apply_only) {
if (empty($patches[$apply_only])) {
throw new PhutilArgumentUsageException(
- "--apply argument '{$apply_only}' is not a valid patch. Use ".
- "'storage status' to show patch status.");
+ pht(
+ "%s argument '%s' is not a valid patch. ".
+ "Use '%s' to show patch status.",
+ '--apply',
+ $apply_only,
+ 'storage status'));
}
}
@@ -73,15 +79,17 @@ public function execute(PhutilArgumentParser $args) {
if ($applied === null) {
if ($is_dry) {
- echo "DRYRUN: Patch metadata storage doesn't exist yet, it would ".
- "be created.\n";
+ echo pht(
+ "DRYRUN: Patch metadata storage doesn't exist yet, ".
+ "it would be created.\n");
return 0;
}
if ($apply_only) {
throw new PhutilArgumentUsageException(
- 'Storage has not been initialized yet, you must initialize storage '.
- 'before selectively applying patches.');
+ pht(
+ 'Storage has not been initialized yet, you must initialize '.
+ 'storage before selectively applying patches.'));
return 1;
}
@@ -103,7 +111,7 @@ public function execute(PhutilArgumentParser $args) {
$api->markPatchApplied($patch);
}
} else {
- echo "Loading quickstart template...\n";
+ echo pht('Loading quickstart template...')."\n";
$root = dirname(phutil_get_library_root('phabricator'));
$sql = $root.'/resources/sql/quickstart.sql';
$api->applyPatchSQL($sql);
@@ -111,7 +119,7 @@ public function execute(PhutilArgumentParser $args) {
}
if ($init_only) {
- echo "Storage initialized.\n";
+ echo pht('Storage initialized.')."\n";
return 0;
}
@@ -127,11 +135,13 @@ public function execute(PhutilArgumentParser $args) {
if (!$is_force && !$is_dry) {
echo phutil_console_wrap(
- "Patch '{$apply_only}' has already been applied. Are you sure ".
- "you want to apply it again? This may put your storage in a state ".
- "that the upgrade scripts can not automatically manage.");
- if (!phutil_console_confirm('Apply patch again?')) {
- echo "Cancelled.\n";
+ pht(
+ "Patch '%s' has already been applied. Are you sure you want ".
+ "to apply it again? This may put your storage in a state ".
+ "that the upgrade scripts can not automatically manage.",
+ $apply_only));
+ if (!phutil_console_confirm(pht('Apply patch again?'))) {
+ echo pht('Cancelled.')."\n";
return 1;
}
}
@@ -155,8 +165,11 @@ public function execute(PhutilArgumentParser $args) {
foreach ($patch->getAfter() as $after) {
if (empty($applied[$after])) {
if ($apply_only) {
- echo "Unable to apply patch '{$apply_only}' because it depends ".
- "on patch '{$after}', which has not been applied.\n";
+ echo pht(
+ "Unable to apply patch '%s' because it depends ".
+ "on patch '%s', which has not been applied.\n",
+ $apply_only,
+ $after);
return 1;
}
$can_apply = false;
@@ -171,9 +184,9 @@ public function execute(PhutilArgumentParser $args) {
$applied_something = true;
if ($is_dry) {
- echo "DRYRUN: Would apply patch '{$key}'.\n";
+ echo pht("DRYRUN: Would apply patch '%s'.", $key)."\n";
} else {
- echo "Applying patch '{$key}'...\n";
+ echo pht("Applying patch '%s'...", $key)."\n";
$api->applyPatch($patch);
if (!$skip_mark) {
$api->markPatchApplied($key);
@@ -190,7 +203,9 @@ public function execute(PhutilArgumentParser $args) {
'Some patches could not be applied: '.
implode(', ', array_keys($patches)));
} else if (!$is_dry && !$apply_only) {
- echo "Storage is up to date. Use 'storage status' for details.\n";
+ echo pht(
+ "Storage is up to date. Use '%s' for details.\n",
+ 'storage status');
}
break;
}
diff --git a/src/infrastructure/storage/patch/PhabricatorSQLPatchList.php b/src/infrastructure/storage/patch/PhabricatorSQLPatchList.php
index 390d591a07..2ab9d528c3 100644
--- a/src/infrastructure/storage/patch/PhabricatorSQLPatchList.php
+++ b/src/infrastructure/storage/patch/PhabricatorSQLPatchList.php
@@ -53,17 +53,24 @@ final public static function buildAllPatches() {
if (isset($seen_namespaces[$namespace])) {
$prior = $seen_namespaces[$namespace];
throw new Exception(
- "PatchList '{$patch_class}' has the same namespace, '{$namespace}', ".
- "as another patch list class, '{$prior}'. Each patch list MUST have ".
- "a unique namespace.");
+ pht(
+ "%s '%s' has the same namespace, '%s', as another patch list ".
+ "class, '%s'. Each patch list MUST have a unique namespace.",
+ __CLASS__,
+ $patch_class,
+ $namespace,
+ $prior));
}
$last_key = null;
foreach ($patch_list->getPatches() as $key => $patch) {
if (!is_array($patch)) {
throw new Exception(
- "PatchList '{$patch_class}' has a patch '{$key}' which is not ".
- "an array.");
+ pht(
+ "%s '%s' has a patch '%s' which is not an array.",
+ __CLASS__,
+ $patch_class,
+ $key));
}
$valid = array(
@@ -77,30 +84,47 @@ final public static function buildAllPatches() {
foreach ($patch as $pkey => $pval) {
if (empty($valid[$pkey])) {
throw new Exception(
- "PatchList '{$patch_class}' has a patch, '{$key}', with an ".
- "unknown property, '{$pkey}'. Patches must have only valid ".
- "keys: ".implode(', ', array_keys($valid)).'.');
+ pht(
+ "%s '%s' has a patch, '%s', with an unknown property, '%s'.".
+ "Patches must have only valid keys: %s.",
+ __CLASS__,
+ $patch_class,
+ $key,
+ $pkey,
+ implode(', ', array_keys($valid))));
}
}
if (is_numeric($key)) {
throw new Exception(
- "PatchList '{$patch_class}' has a patch with a numeric key, ".
- "'{$key}'. Patches must use string keys.");
+ pht(
+ "%s '%s' has a patch with a numeric key, '%s'. ".
+ "Patches must use string keys.",
+ __CLASS__,
+ $patch_class,
+ $key));
}
if (strpos($key, ':') !== false) {
throw new Exception(
- "PatchList '{$patch_class}' has a patch with a colon in the ".
- "key name, '{$key}'. Patch keys may not contain colons.");
+ pht(
+ "%s '%s' has a patch with a colon in the key name, '%s'. ".
+ "Patch keys may not contain colons.",
+ __CLASS__,
+ $patch_class,
+ $key));
}
$full_key = "{$namespace}:{$key}";
if (isset($specs[$full_key])) {
throw new Exception(
- "PatchList '{$patch_class}' has a patch '{$key}' which ".
- "duplicates an existing patch key.");
+ pht(
+ "%s '%s' has a patch '%s' which duplicates an ".
+ "existing patch key.",
+ __CLASS__,
+ $patch_class,
+ $key));
}
$patch['key'] = $key;
@@ -110,8 +134,10 @@ final public static function buildAllPatches() {
if (isset($patch['legacy'])) {
if ($namespace != 'phabricator') {
throw new Exception(
- "Only patches in the 'phabricator' namespace may contain ".
- "'legacy' keys.");
+ pht(
+ "Only patches in the '%s' namespace may contain '%s' keys.",
+ 'phabricator',
+ 'legacy'));
}
} else {
$patch['legacy'] = false;
@@ -120,11 +146,13 @@ final public static function buildAllPatches() {
if (!array_key_exists('after', $patch)) {
if ($last_key === null) {
throw new Exception(
- "Patch '{$full_key}' is missing key 'after', and is the first ".
- "patch in the patch list '{$patch_class}', so its application ".
- "order can not be determined implicitly. The first patch in a ".
- "patch list must list the patch or patches it depends on ".
- "explicitly.");
+ pht(
+ "Patch '%s' is missing key 'after', and is the first patch ".
+ "in the patch list '%s', so its application order can not be ".
+ "determined implicitly. The first patch in a patch list must ".
+ "list the patch or patches it depends on explicitly.",
+ $full_key,
+ $patch_class));
} else {
$patch['after'] = array($last_key);
}
@@ -140,8 +168,10 @@ final public static function buildAllPatches() {
$type = idx($patch, 'type');
if (!$type) {
throw new Exception(
- "Patch '{$namespace}:{$key}' is missing key 'type'. Every patch ".
- "must have a type.");
+ pht(
+ "Patch '%s' is missing key '%s'. Every patch must have a type.",
+ "{$namespace}:{$key}",
+ 'type'));
}
switch ($type) {
@@ -151,7 +181,10 @@ final public static function buildAllPatches() {
break;
default:
throw new Exception(
- "Patch '{$namespace}:{$key}' has unknown patch type '{$type}'.");
+ pht(
+ "Patch '%s' has unknown patch type '%s'.",
+ "{$namespace}:{$key}",
+ $type));
}
$specs[$full_key] = $patch;
@@ -162,8 +195,11 @@ final public static function buildAllPatches() {
foreach ($patch['after'] as $after) {
if (empty($specs[$after])) {
throw new Exception(
- "Patch '{$key}' references nonexistent dependency, '{$after}'. ".
- "Patches may only depend on patches which actually exist.");
+ pht(
+ "Patch '%s' references nonexistent dependency, '%s'. ".
+ "Patches may only depend on patches which actually exist.",
+ $key,
+ $after));
}
}
}
diff --git a/src/infrastructure/testing/PhabricatorTestCase.php b/src/infrastructure/testing/PhabricatorTestCase.php
index 2545413de9..ad88ca360f 100644
--- a/src/infrastructure/testing/PhabricatorTestCase.php
+++ b/src/infrastructure/testing/PhabricatorTestCase.php
@@ -138,8 +138,10 @@ protected function didRunTests() {
unset($this->env);
} catch (Exception $ex) {
throw new Exception(
- 'Some test called PhabricatorEnv::beginScopedEnv(), but is still '.
- 'holding a reference to the scoped environment!');
+ pht(
+ 'Some test called %s, but is still holding '.
+ 'a reference to the scoped environment!',
+ 'PhabricatorEnv::beginScopedEnv()'));
}
}
@@ -208,8 +210,9 @@ protected function generateNewTestUser() {
public static function assertExecutingUnitTests() {
if (!self::$testsAreRunning) {
throw new Exception(
- 'Executing test code outside of test execution! This code path can '.
- 'only be run during unit tests.');
+ pht(
+ 'Executing test code outside of test execution! This code path can '.
+ 'only be run during unit tests.'));
}
}
diff --git a/src/infrastructure/time/PhabricatorTime.php b/src/infrastructure/time/PhabricatorTime.php
index 03495d8412..2adcc95d49 100644
--- a/src/infrastructure/time/PhabricatorTime.php
+++ b/src/infrastructure/time/PhabricatorTime.php
@@ -12,7 +12,7 @@ public static function pushTime($epoch, $timezone) {
$ok = date_default_timezone_set($timezone);
if (!$ok) {
- throw new Exception("Invalid timezone '{$timezone}'!");
+ throw new Exception(pht("Invalid timezone '%s'!", $timezone));
}
self::$stack[] = array(
@@ -72,4 +72,10 @@ public static function getTodayMidnightDateTime($viewer) {
return $today;
}
+ public static function getDateTimeFromEpoch($epoch, PhabricatorUser $viewer) {
+ $datetime = new DateTime('@'.$epoch);
+ $datetime->setTimeZone($viewer->getTimeZone());
+ return $datetime;
+ }
+
}
diff --git a/src/infrastructure/util/PhabricatorHash.php b/src/infrastructure/util/PhabricatorHash.php
index df1fbfa08b..00d7cca63c 100644
--- a/src/infrastructure/util/PhabricatorHash.php
+++ b/src/infrastructure/util/PhabricatorHash.php
@@ -17,7 +17,9 @@ public static function digest($string, $key = null) {
if (!$key) {
throw new Exception(
- "Set a 'security.hmac-key' in your Phabricator configuration!");
+ pht(
+ "Set a '%s' in your Phabricator configuration!",
+ 'security.hmac-key'));
}
return hash_hmac('sha1', $string, $key);
@@ -31,7 +33,7 @@ public static function digest($string, $key = null) {
public static function digestPassword(PhutilOpaqueEnvelope $envelope, $salt) {
$result = $envelope->openEnvelope();
if (!$result) {
- throw new Exception('Trying to digest empty password!');
+ throw new Exception(pht('Trying to digest empty password!'));
}
for ($ii = 0; $ii < 1000; $ii++) {
@@ -100,8 +102,9 @@ public static function digestToLength($string, $length) {
if ($length < $min_length) {
throw new Exception(
pht(
- 'Length parameter in digestToLength() must be at least %s, '.
+ 'Length parameter in %s must be at least %s, '.
'but %s was provided.',
+ 'digestToLength()',
new PhutilNumber($min_length),
new PhutilNumber($length)));
}
diff --git a/src/infrastructure/util/__tests__/PhabricatorHashTestCase.php b/src/infrastructure/util/__tests__/PhabricatorHashTestCase.php
index 8b33d22f5d..c6839dae09 100644
--- a/src/infrastructure/util/__tests__/PhabricatorHashTestCase.php
+++ b/src/infrastructure/util/__tests__/PhabricatorHashTestCase.php
@@ -14,7 +14,7 @@ public function testHashForIndex() {
$this->assertEqual(
$expect,
PhabricatorHash::digestForIndex($input),
- "Input: {$input}");
+ pht('Input: %s', $input));
}
// Test that the encoding produces 6 bits of entropy per byte.
@@ -35,7 +35,7 @@ public function testHashForIndex() {
$this->assertEqual(
(1 << 6),
count($seen),
- "Distinct characters in hash of: {$input}");
+ pht('Distinct characters in hash of: %s', $input));
}
}
diff --git a/src/infrastructure/util/__tests__/PhabricatorSlugTestCase.php b/src/infrastructure/util/__tests__/PhabricatorSlugTestCase.php
index 3c820a085e..0f96a735e6 100644
--- a/src/infrastructure/util/__tests__/PhabricatorSlugTestCase.php
+++ b/src/infrastructure/util/__tests__/PhabricatorSlugTestCase.php
@@ -40,7 +40,7 @@ public function testSlugNormalization() {
$this->assertEqual(
$normal,
PhabricatorSlug::normalize($slug),
- "Normalization of '{$slug}'");
+ pht("Normalization of '%s'", $slug));
}
}
@@ -55,7 +55,7 @@ public function testSlugAncestry() {
$this->assertEqual(
$ancestry,
PhabricatorSlug::getAncestry($slug),
- "Ancestry of '{$slug}'");
+ pht("Ancestry of '%s'", $slug));
}
}
@@ -71,7 +71,7 @@ public function testSlugDepth() {
$this->assertEqual(
$depth,
PhabricatorSlug::getDepth($slug),
- "Depth of '{$slug}'");
+ pht("Depth of '%s'", $slug));
}
}
}
diff --git a/src/view/__tests__/PhabricatorLocalTimeTestCase.php b/src/view/__tests__/PhabricatorLocalTimeTestCase.php
index 609f725ec2..f9fd31ad9a 100644
--- a/src/view/__tests__/PhabricatorLocalTimeTestCase.php
+++ b/src/view/__tests__/PhabricatorLocalTimeTestCase.php
@@ -12,25 +12,25 @@ public function testLocalTimeFormatting() {
$this->assertEqual(
'Jan 1 2000, 12:00 AM',
phabricator_datetime(946684800, $utc),
- 'Datetime formatting');
+ pht('Datetime formatting'));
$this->assertEqual(
'Jan 1 2000',
phabricator_date(946684800, $utc),
- 'Date formatting');
+ pht('Date formatting'));
$this->assertEqual(
'12:00 AM',
phabricator_time(946684800, $utc),
- 'Time formatting');
+ pht('Time formatting'));
$this->assertEqual(
'Dec 31 1999, 4:00 PM',
phabricator_datetime(946684800, $user),
- 'Localization');
+ pht('Localization'));
$this->assertEqual(
'',
phabricator_datetime(0, $user),
- 'Missing epoch should fail gracefully');
+ pht('Missing epoch should fail gracefully'));
}
}
diff --git a/src/view/form/PHUIFormPageView.php b/src/view/form/PHUIFormPageView.php
index 7b45edb255..cb62d33127 100644
--- a/src/view/form/PHUIFormPageView.php
+++ b/src/view/form/PHUIFormPageView.php
@@ -85,12 +85,12 @@ public function addControl(AphrontFormControl $control) {
$name = $control->getName();
if (!strlen($name)) {
- throw new Exception('Form control has no name!');
+ throw new Exception(pht('Form control has no name!'));
}
if (isset($this->controls[$name])) {
throw new Exception(
- "Form page contains duplicate control with name '{$name}'!");
+ pht("Form page contains duplicate control with name '%s'!", $name));
}
$this->controls[$name] = $control;
@@ -106,7 +106,7 @@ public function getControls() {
public function getControl($name) {
if (empty($this->controls[$name])) {
- throw new Exception("No page control '{$name}'!");
+ throw new Exception(pht("No page control '%s'!", $name));
}
return $this->controls[$name];
}
@@ -117,7 +117,7 @@ protected function canAppendChild() {
public function setPagedFormView(PHUIPagedFormView $view, $key) {
if ($this->key) {
- throw new Exception('This page is already part of a form!');
+ throw new Exception(pht('This page is already part of a form!'));
}
$this->form = $view;
$this->key = $key;
diff --git a/src/view/form/PHUIPagedFormView.php b/src/view/form/PHUIPagedFormView.php
index ff72f67ca0..b5f6ad7066 100644
--- a/src/view/form/PHUIPagedFormView.php
+++ b/src/view/form/PHUIPagedFormView.php
@@ -27,7 +27,7 @@ protected function canAppendChild() {
*/
public function addPage($key, PHUIFormPageView $page) {
if (isset($this->pages[$key])) {
- throw new Exception("Duplicate page with key '{$key}'!");
+ throw new Exception(pht("Duplicate page with key '%s'!", $key));
}
$this->pages[$key] = $page;
$page->setPagedFormView($this, $key);
@@ -44,7 +44,7 @@ public function addPage($key, PHUIFormPageView $page) {
*/
public function getPage($key) {
if (!$this->pageExists($key)) {
- throw new Exception("No page '{$key}' exists!");
+ throw new Exception(pht("No page '%s' exists!", $key));
}
return $this->pages[$key];
}
@@ -87,7 +87,7 @@ protected function getPageByIndex($index) {
$index--;
}
- throw new Exception("Requesting out-of-bounds page '{$index}'.");
+ throw new Exception(pht("Requesting out-of-bounds page '%s'.", $index));
}
protected function getLastIndex() {
@@ -226,7 +226,7 @@ public function render() {
$selected_page = $this->getSelectedPage();
if (!$selected_page) {
- throw new Exception('No selected page!');
+ throw new Exception(pht('No selected page!'));
}
$form->addHiddenInput(
@@ -256,7 +256,7 @@ public function render() {
if ($this->isLastPage($selected_page)) {
$submit->addSubmitButton(pht('Save'));
} else {
- $submit->addSubmitButton(pht("Continue \xC2\xBB"));
+ $submit->addSubmitButton(pht('Continue')." \xC2\xBB");
}
$form->appendChild($selected_page);
diff --git a/src/view/form/control/AphrontFormCheckboxControl.php b/src/view/form/control/AphrontFormCheckboxControl.php
index 0d89e0a6ad..69be93ab9f 100644
--- a/src/view/form/control/AphrontFormCheckboxControl.php
+++ b/src/view/form/control/AphrontFormCheckboxControl.php
@@ -15,7 +15,7 @@ public function addCheckbox(
'value' => $value,
'label' => $label,
'checked' => $checked,
- 'id' => $id,
+ 'id' => $id,
);
return $this;
}
diff --git a/src/view/form/control/AphrontFormControl.php b/src/view/form/control/AphrontFormControl.php
index 4118d9ad4e..16e36be663 100644
--- a/src/view/form/control/AphrontFormControl.php
+++ b/src/view/form/control/AphrontFormControl.php
@@ -134,7 +134,7 @@ public function readValueFromDictionary(array $dictionary) {
public function setFormPage(PHUIFormPageView $page) {
if ($this->formPage) {
- throw new Exception('This control is already a member of a page!');
+ throw new Exception(pht('This control is already a member of a page!'));
}
$this->formPage = $page;
return $this;
@@ -142,7 +142,7 @@ public function setFormPage(PHUIFormPageView $page) {
public function getFormPage() {
if ($this->formPage === null) {
- throw new Exception('This control does not have a page!');
+ throw new Exception(pht('This control does not have a page!'));
}
return $this->formPage;
}
diff --git a/src/view/form/control/AphrontFormDateControl.php b/src/view/form/control/AphrontFormDateControl.php
index 84de3b3215..ac026d410b 100644
--- a/src/view/form/control/AphrontFormDateControl.php
+++ b/src/view/form/control/AphrontFormDateControl.php
@@ -5,14 +5,13 @@ final class AphrontFormDateControl extends AphrontFormControl {
private $initialTime;
private $zone;
- private $valueDay;
- private $valueMonth;
- private $valueYear;
+ private $valueDate;
private $valueTime;
private $allowNull;
private $continueOnInvalidDate = false;
private $isTimeDisabled;
private $isDisabled;
+ private $endDateID;
public function setAllowNull($allow_null) {
$this->allowNull = $allow_null;
@@ -24,6 +23,11 @@ public function setIsTimeDisabled($is_disabled) {
return $this;
}
+ public function setEndDateID($value) {
+ $this->endDateID = $value;
+ return $this;
+ }
+
const TIME_START_OF_DAY = 'start-of-day';
const TIME_END_OF_DAY = 'end-of-day';
const TIME_START_OF_BUSINESS = 'start-of-business';
@@ -35,9 +39,7 @@ public function setInitialTime($time) {
}
public function readValueFromRequest(AphrontRequest $request) {
- $day = $request->getInt($this->getDayInputName());
- $month = $request->getInt($this->getMonthInputName());
- $year = $request->getInt($this->getYearInputName());
+ $date = $request->getStr($this->getDateInputName());
$time = $request->getStr($this->getTimeInputName());
$enabled = $request->getBool($this->getCheckboxInputName());
@@ -49,10 +51,8 @@ public function readValueFromRequest(AphrontRequest $request) {
$err = $this->getError();
- if ($day || $month || $year || $time) {
- $this->valueDay = $day;
- $this->valueMonth = $month;
- $this->valueYear = $year;
+ if ($date || $time) {
+ $this->valueDate = $date;
$this->valueTime = $time;
// Assume invalid.
@@ -61,8 +61,8 @@ public function readValueFromRequest(AphrontRequest $request) {
$zone = $this->getTimezone();
try {
- $date = new DateTime("{$year}-{$month}-{$day} {$time}", $zone);
- $value = $date->format('U');
+ $datetime = new DateTime("{$date} {$time}", $zone);
+ $value = $datetime->format('U');
} catch (Exception $ex) {
$value = null;
}
@@ -94,9 +94,7 @@ protected function getCustomControlClass() {
public function setValue($epoch) {
if ($epoch instanceof AphrontFormDateControlValue) {
$this->continueOnInvalidDate = true;
- $this->valueYear = $epoch->getValueYear();
- $this->valueMonth = $epoch->getValueMonth();
- $this->valueDay = $epoch->getValueDay();
+ $this->valueDate = $epoch->getValueDate();
$this->valueTime = $epoch->getValueTime();
$this->allowNull = $epoch->getOptional();
$this->isDisabled = $epoch->isDisabled();
@@ -113,42 +111,18 @@ public function setValue($epoch) {
$readable = $this->formatTime($epoch, 'Y!m!d!g:i A');
$readable = explode('!', $readable, 4);
- $this->valueYear = $readable[0];
- $this->valueMonth = $readable[1];
- $this->valueDay = $readable[2];
+ $year = $readable[0];
+ $month = $readable[1];
+ $day = $readable[2];
+
+ $this->valueDate = $month.'/'.$day.'/'.$year;
$this->valueTime = $readable[3];
return $result;
}
- private function getMinYear() {
- $cur_year = $this->formatTime(
- time(),
- 'Y');
- $val_year = $this->getYearInputValue();
-
- return min($cur_year, $val_year) - 3;
- }
-
- private function getMaxYear() {
- $cur_year = $this->formatTime(
- time(),
- 'Y');
- $val_year = $this->getYearInputValue();
-
- return max($cur_year, $val_year) + 3;
- }
-
- private function getDayInputValue() {
- return $this->valueDay;
- }
-
- private function getMonthInputValue() {
- return $this->valueMonth;
- }
-
- private function getYearInputValue() {
- return $this->valueYear;
+ private function getDateInputValue() {
+ return $this->valueDate;
}
private function getTimeInputValue() {
@@ -162,18 +136,10 @@ private function formatTime($epoch, $fmt) {
$fmt);
}
- private function getDayInputName() {
+ private function getDateInputName() {
return $this->getName().'_d';
}
- private function getMonthInputName() {
- return $this->getName().'_m';
- }
-
- private function getYearInputName() {
- return $this->getName().'_y';
- }
-
private function getTimeInputName() {
return $this->getName().'_t';
}
@@ -196,27 +162,6 @@ protected function renderInput() {
$disabled = 'disabled';
}
- $min_year = $this->getMinYear();
- $max_year = $this->getMaxYear();
-
- $days = range(1, 31);
- $days = array_fuse($days);
-
- $months = array(
- 1 => pht('Jan'),
- 2 => pht('Feb'),
- 3 => pht('Mar'),
- 4 => pht('Apr'),
- 5 => pht('May'),
- 6 => pht('Jun'),
- 7 => pht('Jul'),
- 8 => pht('Aug'),
- 9 => pht('Sep'),
- 10 => pht('Oct'),
- 11 => pht('Nov'),
- 12 => pht('Dec'),
- );
-
$checkbox = null;
if ($this->allowNull) {
$checkbox = javelin_tag(
@@ -231,32 +176,24 @@ protected function renderInput() {
));
}
- $years = range($this->getMinYear(), $this->getMaxYear());
- $years = array_fuse($years);
-
- $days_sel = AphrontFormSelectControl::renderSelectTag(
- $this->getDayInputValue(),
- $days,
- array(
- 'name' => $this->getDayInputName(),
- 'sigil' => 'day-input',
- ));
-
- $months_sel = AphrontFormSelectControl::renderSelectTag(
- $this->getMonthInputValue(),
- $months,
+ $date_sel = javelin_tag(
+ 'input',
array(
- 'name' => $this->getMonthInputName(),
- 'sigil' => 'month-input',
- ));
+ 'autocomplete' => 'off',
+ 'name' => $this->getDateInputName(),
+ 'sigil' => 'date-input',
+ 'value' => $this->getDateInputValue(),
+ 'type' => 'text',
+ 'class' => 'aphront-form-date-input',
+ ),
+ '');
- $years_sel = AphrontFormSelectControl::renderSelectTag(
- $this->getYearInputValue(),
- $years,
+ $date_div = javelin_tag(
+ 'div',
array(
- 'name' => $this->getYearInputName(),
- 'sigil' => 'year-input',
- ));
+ 'class' => 'aphront-form-date-input-container',
+ ),
+ $date_sel);
$cicon = id(new PHUIIconView())
->setIconFont('fa-calendar');
@@ -270,17 +207,36 @@ protected function renderInput() {
),
$cicon);
+ $values = $this->getTimeTypeaheadValues();
+
+ $time_id = celerity_generate_unique_node_id();
+ Javelin::initBehavior('time-typeahead', array(
+ 'startTimeID' => $time_id,
+ 'endTimeID' => $this->endDateID,
+ 'timeValues' => $values,
+ ));
+
+
$time_sel = javelin_tag(
'input',
array(
+ 'autocomplete' => 'off',
'name' => $this->getTimeInputName(),
'sigil' => 'time-input',
'value' => $this->getTimeInputValue(),
'type' => 'text',
- 'class' => 'aphront-form-date-time-input',
+ 'class' => 'aphront-form-time-input',
),
'');
+ $time_div = javelin_tag(
+ 'div',
+ array(
+ 'id' => $time_id,
+ 'class' => 'aphront-form-time-input-container',
+ ),
+ $time_sel);
+
Javelin::initBehavior('fancy-datepicker', array());
$classes = array();
@@ -304,11 +260,9 @@ protected function renderInput() {
),
array(
$checkbox,
- $days_sel,
- $months_sel,
- $years_sel,
+ $date_div,
$cal_icon,
- $time_sel,
+ $time_div,
));
}
@@ -319,7 +273,7 @@ private function getTimezone() {
$user = $this->getUser();
if (!$this->getUser()) {
- throw new Exception('Call setUser() before getTimezone()!');
+ throw new PhutilInvalidStateException('setUser');
}
$user_zone = $user->getTimezoneIdentifier();
@@ -359,4 +313,22 @@ private function getInitialValue() {
return $value;
}
+ private function getTimeTypeaheadValues() {
+ $times = array();
+ $am_pm_list = array('AM', 'PM');
+
+ foreach ($am_pm_list as $am_pm) {
+ for ($hour = 0; $hour < 12; $hour++) {
+ $actual_hour = ($hour == 0) ? 12 : $hour;
+ $times[] = $actual_hour.':00 '.$am_pm;
+ $times[] = $actual_hour.':30 '.$am_pm;
+ }
+ }
+
+ foreach ($times as $key => $time) {
+ $times[$key] = array($key, $time);
+ }
+ return $times;
+ }
+
}
diff --git a/src/view/form/control/AphrontFormDateControlValue.php b/src/view/form/control/AphrontFormDateControlValue.php
index 3fb6a07fb4..43fb42664e 100644
--- a/src/view/form/control/AphrontFormDateControlValue.php
+++ b/src/view/form/control/AphrontFormDateControlValue.php
@@ -2,9 +2,7 @@
final class AphrontFormDateControlValue extends Phobject {
- private $valueDay;
- private $valueMonth;
- private $valueYear;
+ private $valueDate;
private $valueTime;
private $valueEnabled;
@@ -12,16 +10,8 @@ final class AphrontFormDateControlValue extends Phobject {
private $zone;
private $optional;
- public function getValueDay() {
- return $this->valueDay;
- }
-
- public function getValueMonth() {
- return $this->valueMonth;
- }
-
- public function getValueYear() {
- return $this->valueYear;
+ public function getValueDate() {
+ return $this->valueDate;
}
public function getValueTime() {
@@ -36,15 +26,7 @@ public function isValid() {
}
public function isEmpty() {
- if ($this->valueDay) {
- return false;
- }
-
- if ($this->valueMonth) {
- return false;
- }
-
- if ($this->valueYear) {
+ if ($this->valueDate) {
return false;
}
@@ -83,9 +65,7 @@ public static function newFromParts(
$value = new AphrontFormDateControlValue();
$value->viewer = $viewer;
- $value->valueYear = $year;
- $value->valueMonth = $month;
- $value->valueDay = $day;
+ $value->valueDate = $month.'/'.$day.'/'.$year;
$value->valueTime = coalesce($time, '12:00 AM');
$value->valueEnabled = $enabled;
@@ -95,10 +75,7 @@ public static function newFromParts(
public static function newFromRequest(AphrontRequest $request, $key) {
$value = new AphrontFormDateControlValue();
$value->viewer = $request->getViewer();
-
- $value->valueDay = $request->getInt($key.'_d');
- $value->valueMonth = $request->getInt($key.'_m');
- $value->valueYear = $request->getInt($key.'_y');
+ $value->valueDate = $request->getStr($key.'_d');
$value->valueTime = $request->getStr($key.'_t');
$value->valueEnabled = $request->getStr($key.'_e');
@@ -111,11 +88,14 @@ public static function newFromEpoch(PhabricatorUser $viewer, $epoch) {
$readable = $value->formatTime($epoch, 'Y!m!d!g:i A');
$readable = explode('!', $readable, 4);
- $value->valueYear = $readable[0];
- $value->valueMonth = $readable[1];
- $value->valueDay = $readable[2];
+ $year = $readable[0];
+ $month = $readable[1];
+ $day = $readable[2];
+
+ $value->valueDate = $month.'/'.$day.'/'.$year;
$value->valueTime = $readable[3];
+
return $value;
}
@@ -125,9 +105,7 @@ public static function newFromDictionary(
$value = new AphrontFormDateControlValue();
$value->viewer = $viewer;
- $value->valueYear = idx($dictionary, 'y');
- $value->valueMonth = idx($dictionary, 'm');
- $value->valueDay = idx($dictionary, 'd');
+ $value->valueDate = idx($dictionary, 'd');
$value->valueTime = idx($dictionary, 't');
$value->valueEnabled = idx($dictionary, 'e');
@@ -149,9 +127,7 @@ public static function newFromWild(PhabricatorUser $viewer, $wild) {
public function getDictionary() {
return array(
- 'y' => $this->valueYear,
- 'm' => $this->valueMonth,
- 'd' => $this->valueDay,
+ 'd' => $this->valueDate,
't' => $this->valueTime,
'e' => $this->valueEnabled,
);
@@ -176,9 +152,7 @@ public function getEpoch() {
return null;
}
- $year = $this->valueYear;
- $month = $this->valueMonth;
- $day = $this->valueDay;
+ $date = $this->valueDate;
$time = $this->valueTime;
$zone = $this->getTimezone();
@@ -203,14 +177,27 @@ public function getEpoch() {
}
try {
- $date = new DateTime("{$year}-{$month}-{$day} {$time}", $zone);
- $value = $date->format('U');
+ $datetime = new DateTime("{$date} {$time}", $zone);
+ $value = $datetime->format('U');
} catch (Exception $ex) {
$value = null;
}
return $value;
}
+ public function getDateTime() {
+ $epoch = $this->getEpoch();
+ $date = null;
+
+ if ($epoch) {
+ $zone = $this->getTimezone();
+ $date = new DateTime('@'.$epoch);
+ $date->setTimeZone($zone);
+ }
+
+ return $date;
+ }
+
private function getTimezone() {
if ($this->zone) {
return $this->zone;
diff --git a/src/view/form/control/AphrontFormPasswordControl.php b/src/view/form/control/AphrontFormPasswordControl.php
index 9e37d7aa20..081628c332 100644
--- a/src/view/form/control/AphrontFormPasswordControl.php
+++ b/src/view/form/control/AphrontFormPasswordControl.php
@@ -17,12 +17,12 @@ protected function renderInput() {
return phutil_tag(
'input',
array(
- 'type' => 'password',
- 'name' => $this->getName(),
- 'value' => $this->getValue(),
- 'disabled' => $this->getDisabled() ? 'disabled' : null,
+ 'type' => 'password',
+ 'name' => $this->getName(),
+ 'value' => $this->getValue(),
+ 'disabled' => $this->getDisabled() ? 'disabled' : null,
'autocomplete' => ($this->disableAutocomplete ? 'off' : null),
- 'id' => $this->getID(),
+ 'id' => $this->getID(),
));
}
diff --git a/src/view/form/control/PHUIFormMultiSubmitControl.php b/src/view/form/control/PHUIFormMultiSubmitControl.php
index af234919d8..4c7454bd6d 100644
--- a/src/view/form/control/PHUIFormMultiSubmitControl.php
+++ b/src/view/form/control/PHUIFormMultiSubmitControl.php
@@ -6,7 +6,7 @@ final class PHUIFormMultiSubmitControl extends AphrontFormControl {
public function addBackButton($label = null) {
if ($label === null) {
- $label = pht("\xC2\xAB Back");
+ $label = "\xC2\xAB ".pht('Back');
}
return $this->addButton('__back__', $label, 'grey');
}
diff --git a/src/view/layout/AphrontMoreView.php b/src/view/layout/AphrontMoreView.php
index 0bd1b82d80..9fe9389ed5 100644
--- a/src/view/layout/AphrontMoreView.php
+++ b/src/view/layout/AphrontMoreView.php
@@ -27,7 +27,7 @@ public function render() {
$content[] = $this->some;
if ($this->more && $this->more != $this->some) {
- $text = "(Show More\xE2\x80\xA6)";
+ $text = "(".pht('Show More')."\xE2\x80\xA6)";
if ($this->expandtext !== null) {
$text = $this->expandtext;
}
diff --git a/src/view/layout/AphrontMultiColumnView.php b/src/view/layout/AphrontMultiColumnView.php
index 6705b89126..dfd5f81764 100644
--- a/src/view/layout/AphrontMultiColumnView.php
+++ b/src/view/layout/AphrontMultiColumnView.php
@@ -67,7 +67,7 @@ public function render() {
if ($this->fluidishLayout || $this->fluidLayout) {
// we only support seven columns for now for fluid views; see T4054
if (count($this->columns) > 7) {
- throw new Exception('No more than 7 columns per view.');
+ throw new Exception(pht('No more than 7 columns per view.'));
}
}
diff --git a/src/view/layout/PhabricatorActionView.php b/src/view/layout/PhabricatorActionView.php
index 65dd5f146f..43f84495c7 100644
--- a/src/view/layout/PhabricatorActionView.php
+++ b/src/view/layout/PhabricatorActionView.php
@@ -139,7 +139,9 @@ public function render() {
if ($this->renderAsForm) {
if (!$this->user) {
throw new Exception(
- 'Call setUser() when rendering an action as a form.');
+ pht(
+ 'Call %s when rendering an action as a form.',
+ 'setUser()'));
}
$item = javelin_tag(
@@ -155,7 +157,7 @@ public function render() {
'action' => $this->getHref(),
'method' => 'POST',
'sigil' => $sigils,
- 'meta' => $this->metadata,
+ 'meta' => $this->metadata,
),
$item);
} else {
diff --git a/src/view/page/PhabricatorStandardPageView.php b/src/view/page/PhabricatorStandardPageView.php
index 7c5dcaf1cb..8033ef3c72 100644
--- a/src/view/page/PhabricatorStandardPageView.php
+++ b/src/view/page/PhabricatorStandardPageView.php
@@ -159,7 +159,8 @@ protected function willRenderPage() {
if (!$this->getRequest()) {
throw new Exception(
pht(
- 'You must set the Request to render a %s.',
+ 'You must set the %s to render a %s.',
+ 'Request',
__CLASS__));
}
diff --git a/src/view/phui/PHUIHeaderView.php b/src/view/phui/PHUIHeaderView.php
index 14159e500c..c87f1c4868 100644
--- a/src/view/phui/PHUIHeaderView.php
+++ b/src/view/phui/PHUIHeaderView.php
@@ -239,7 +239,7 @@ protected function getTagContent() {
$property_list[] = $property;
break;
default:
- throw new Exception('Incorrect Property Passed');
+ throw new Exception(pht('Incorrect Property Passed'));
break;
}
}
diff --git a/src/view/phui/PHUIObjectItemView.php b/src/view/phui/PHUIObjectItemView.php
index cc2753e26c..812fa993c2 100644
--- a/src/view/phui/PHUIObjectItemView.php
+++ b/src/view/phui/PHUIObjectItemView.php
@@ -189,7 +189,7 @@ public function setEpoch($epoch, $age = self::AGE_FRESH) {
$this->addIcon('fa-clock-o red', $date, $attr);
break;
default:
- throw new Exception("Unknown age '{$age}'!");
+ throw new Exception(pht("Unknown age '%s'!", $age));
}
return $this;
@@ -197,7 +197,7 @@ public function setEpoch($epoch, $age = self::AGE_FRESH) {
public function addAction(PHUIListItemView $action) {
if (count($this->actions) >= 3) {
- throw new Exception('Limit 3 actions per item.');
+ throw new Exception(pht('Limit 3 actions per item.'));
}
$this->actions[] = $action;
return $this;
@@ -686,6 +686,4 @@ private function renderHandleIcon(PhabricatorObjectHandle $handle, $label) {
'');
}
-
-
}
diff --git a/src/view/phui/calendar/PHUICalendarDayView.php b/src/view/phui/calendar/PHUICalendarDayView.php
index 337ef50738..844cd31222 100644
--- a/src/view/phui/calendar/PHUICalendarDayView.php
+++ b/src/view/phui/calendar/PHUICalendarDayView.php
@@ -8,8 +8,8 @@ final class PHUICalendarDayView extends AphrontView {
private $month;
private $year;
private $browseURI;
+ private $query;
private $events = array();
- private $todayEvents = array();
private $allDayEvents = array();
@@ -26,6 +26,14 @@ private function getBrowseURI() {
return $this->browseURI;
}
+ public function setQuery($query) {
+ $this->query = $query;
+ return $this;
+ }
+ private function getQuery() {
+ return $this->query;
+ }
+
public function __construct(
$range_start,
$range_end,
@@ -44,13 +52,22 @@ public function __construct(
public function render() {
require_celerity_resource('phui-calendar-day-css');
+ $viewer = $this->getUser();
+
$hours = $this->getHoursOfDay();
- $hourly_events = array();
+ $js_hours = array();
+ $js_today_events = array();
- $first_event_hour = null;
+ foreach ($hours as $hour) {
+ $js_hours[] = array(
+ 'hour' => $hour->format('G'),
+ 'hour_meridian' => $hour->format('g A'),
+ );
+ }
+ $first_event_hour = null;
+ $js_today_all_day_events = array();
$all_day_events = $this->getAllDayEvents();
- $today_all_day_events = array();
$day_start = $this->getDateTime();
$day_end = id(clone $day_start)->modify('+1 day');
@@ -63,123 +80,101 @@ public function render() {
$all_day_end = $all_day_event->getEpochEnd();
if ($all_day_start < $day_end_epoch && $all_day_end > $day_start_epoch) {
- $today_all_day_events[] = $all_day_event;
+ $js_today_all_day_events[] = array(
+ 'name' => $all_day_event->getName(),
+ 'id' => $all_day_event->getEventID(),
+ 'viewerIsInvited' => $all_day_event->getViewerIsInvited(),
+ 'uri' => $all_day_event->getURI(),
+ );
}
}
- foreach ($hours as $hour) {
- $current_hour_events = array();
- $hour_start = $hour->format('U');
- $hour_end = id(clone $hour)->modify('+1 hour')->format('U');
+ $this->events = msort($this->events, 'getEpochStart');
+ $first_event_hour = $this->getDateTime()->setTime(8, 0, 0);
+ $midnight = $this->getDateTime()->setTime(0, 0, 0);
- foreach ($this->events as $event) {
- if ($event->getIsAllDay()) {
- continue;
+ foreach ($this->events as $event) {
+ if ($event->getIsAllDay()) {
+ continue;
+ }
+ if ($event->getEpochStart() <= $day_end_epoch &&
+ $event->getEpochEnd() > $day_start_epoch) {
+
+ if ($event->getEpochStart() < $midnight->format('U') &&
+ $event->getEpochEnd() > $midnight->format('U')) {
+ $first_event_hour = clone $midnight;
}
- if (($hour == $day_start &&
- $event->getEpochStart() <= $hour_start &&
- $event->getEpochEnd() > $day_start_epoch) ||
- ($event->getEpochStart() >= $hour_start
- && $event->getEpochStart() < $hour_end)) {
- $current_hour_events[] = $event;
- $this->todayEvents[] = $event;
+
+ if ($event->getEpochStart() < $first_event_hour->format('U') &&
+ $event->getEpochStart() > $midnight->format('U')) {
+ $first_event_hour = PhabricatorTime::getDateTimeFromEpoch(
+ $event->getEpochStart(),
+ $viewer);
+ $first_event_hour->setTime($first_event_hour->format('h'), 0, 0);
}
- }
- foreach ($current_hour_events as $event) {
- $day_start_epoch = $this->getDateTime()->format('U');
+
$event_start = max($event->getEpochStart(), $day_start_epoch);
$event_end = min($event->getEpochEnd(), $day_end_epoch);
- $top = (($event_start - $hour_start) / ($hour_end - $hour_start))
- * 100;
- $top = max(0, $top);
-
- $height = (($event_end - $event_start) / ($hour_end - $hour_start))
- * 100;
- $height = min(2400, $height);
+ $day_duration = ($day_end_epoch - $first_event_hour->format('U')) / 60;
- if ($first_event_hour === null) {
- $first_event_hour = $hour;
- }
+ $top = (($event_start - $first_event_hour->format('U'))
+ / ($day_end_epoch - $first_event_hour->format('U')))
+ * $day_duration;
+ $top = max(0, $top);
- $hourly_events[$event->getEventID()] = array(
- 'hour' => $hour,
- 'event' => $event,
+ $height = (($event_end - $event_start)
+ / ($day_end_epoch - $first_event_hour->format('U')))
+ * $day_duration;
+ $height = min($day_duration, $height);
+
+ $js_today_events[] = array(
+ 'eventStartEpoch' => $event->getEpochStart(),
+ 'eventEndEpoch' => $event->getEpochEnd(),
+ 'eventName' => $event->getName(),
+ 'eventID' => $event->getEventID(),
+ 'viewerIsInvited' => $event->getViewerIsInvited(),
+ 'uri' => $event->getURI(),
'offset' => '0',
'width' => '100%',
- 'top' => $top.'%',
- 'height' => $height.'%',
+ 'top' => $top.'px',
+ 'height' => $height.'px',
+ 'canEdit' => $event->getCanEdit(),
);
}
}
- $clusters = $this->findTodayClusters();
- foreach ($clusters as $cluster) {
- $hourly_events = $this->updateEventsFromCluster(
- $cluster,
- $hourly_events);
- }
-
- $rows = array();
-
- foreach ($hours as $hour) {
- $early_hours = array(8);
- if ($first_event_hour) {
- $early_hours[] = $first_event_hour->format('G');
- }
- if ($hour->format('G') < min($early_hours)) {
- continue;
- }
-
- $drawn_hourly_events = array();
- $cell_time = phutil_tag(
- 'td',
- array('class' => 'phui-calendar-day-hour'),
- $hour->format('g A'));
-
- foreach ($hourly_events as $hourly_event) {
- if ($hourly_event['hour'] == $hour) {
-
- $drawn_hourly_events[] = $this->drawEvent(
- $hourly_event['event'],
- $hourly_event['offset'],
- $hourly_event['width'],
- $hourly_event['top'],
- $hourly_event['height']);
- }
- }
- $cell_event = phutil_tag(
- 'td',
- array('class' => 'phui-calendar-day-events'),
- $drawn_hourly_events);
-
- $row = phutil_tag(
- 'tr',
- array(),
- array($cell_time, $cell_event));
-
- $rows[] = $row;
- }
-
- $table = phutil_tag(
- 'table',
- array('class' => 'phui-calendar-day-view'),
- $rows);
-
- $all_day_event_box = new PHUIBoxView();
- foreach ($today_all_day_events as $all_day_event) {
- $all_day_event_box->appendChild(
- $this->drawAllDayEvent($all_day_event));
- }
-
$header = $this->renderDayViewHeader();
$sidebar = $this->renderSidebar();
$warnings = $this->getQueryRangeWarning();
+ $table_id = celerity_generate_unique_node_id();
+
+ $table_wrapper = phutil_tag(
+ 'div',
+ array(
+ 'id' => $table_id,
+ ),
+ '');
+
+ Javelin::initBehavior(
+ 'day-view',
+ array(
+ 'year' => $first_event_hour->format('Y'),
+ 'month' => $first_event_hour->format('m'),
+ 'day' => $first_event_hour->format('d'),
+ 'query' => $this->getQuery(),
+ 'allDayEvents' => $js_today_all_day_events,
+ 'todayEvents' => $js_today_events,
+ 'hours' => $js_hours,
+ 'firstEventHour' => $first_event_hour->format('G'),
+ 'firstEventHourEpoch' => $first_event_hour->format('U'),
+ 'tableID' => $table_id,
+ ));
+
$table_box = id(new PHUIObjectBoxView())
->setHeader($header)
- ->appendChild($all_day_event_box)
- ->appendChild($table)
+ ->appendChild($table_wrapper)
->setFormErrors($warnings)
->setFlush(true);
@@ -391,75 +386,6 @@ private function updateEventsFromCluster($cluster, $hourly_events) {
return $hourly_events;
}
- private function drawAllDayEvent(AphrontCalendarEventView $event) {
- $class = 'day-view-all-day';
- if ($event->getViewerIsInvited()) {
- $class = $class.' viewer-invited-day-event';
- }
-
- $name = phutil_tag(
- 'a',
- array(
- 'class' => $class,
- 'href' => $event->getURI(),
- ),
- $event->getName());
-
- $all_day_label = phutil_tag(
- 'span',
- array(
- 'class' => 'phui-calendar-all-day-label',
- ),
- pht('All Day'));
-
- $div = phutil_tag(
- 'div',
- array(
- 'class' => 'phui-calendar-day-event',
- ),
- array(
- $all_day_label,
- $name,
- ));
-
- return $div;
- }
-
- private function drawEvent(
- AphrontCalendarEventView $event,
- $offset,
- $width,
- $top,
- $height) {
-
- $class = 'phui-calendar-day-event-link';
- if ($event->getViewerIsInvited()) {
- $class = $class.' viewer-invited-day-event';
- }
-
- $name = phutil_tag(
- 'a',
- array(
- 'class' => $class,
- 'href' => $event->getURI(),
- ),
- $event->getName());
-
- $div = phutil_tag(
- 'div',
- array(
- 'class' => 'phui-calendar-day-event',
- 'style' => 'left: '.$offset
- .'; width: '.$width
- .'; top: '.$top
- .'; height: '.$height
- .';',
- ),
- $name);
-
- return $div;
- }
-
// returns DateTime of each hour in the day
private function getHoursOfDay() {
$included_datetimes = array();
diff --git a/src/view/phui/calendar/PHUICalendarListView.php b/src/view/phui/calendar/PHUICalendarListView.php
index e1f37fa1ae..fa998f11a6 100644
--- a/src/view/phui/calendar/PHUICalendarListView.php
+++ b/src/view/phui/calendar/PHUICalendarListView.php
@@ -150,8 +150,11 @@ private function getEventTooltip(AphrontCalendarEventView $event) {
$this->getUser(),
$event->getEpochEnd()));
+ $start_date = $start->getDateTime()->format('m d Y');
+ $end_date = $end->getDateTime()->format('m d Y');
+
if ($event->getIsAllDay()) {
- if ($start->getValueDay() == $end->getValueDay()) {
+ if ($start_date == $end_date) {
$tip = pht('All day');
} else {
$tip = pht(
@@ -160,9 +163,7 @@ private function getEventTooltip(AphrontCalendarEventView $event) {
$end->getValueAsFormat('M j, Y'));
}
} else {
- if ($start->getValueDay() == $end->getValueDay() &&
- $start->getValueMonth() == $end->getValueMonth() &&
- $start->getValueYear() == $end->getValueYear()) {
+ if ($start->getValueDate() == $end->getValueDate()) {
$tip = pht(
'%s - %s',
$start->getValueAsFormat('g:i A'),
diff --git a/src/view/phui/calendar/PHUICalendarMonthView.php b/src/view/phui/calendar/PHUICalendarMonthView.php
index 806ecad719..3adbe5eae7 100644
--- a/src/view/phui/calendar/PHUICalendarMonthView.php
+++ b/src/view/phui/calendar/PHUICalendarMonthView.php
@@ -117,8 +117,10 @@ public function render() {
foreach ($cell_lists_by_week as $week_of_cell_lists) {
$cells = array();
+ $max_count = $this->getMaxDailyEventsForWeek($week_of_cell_lists);
+
foreach ($week_of_cell_lists as $cell_list) {
- $cells[] = $this->getEventListCell($cell_list);
+ $cells[] = $this->getEventListCell($cell_list, $max_count);
}
$rows[] = phutil_tag('tr', array(), $cells);
@@ -153,7 +155,19 @@ public function render() {
return $box;
}
- private function getEventListCell($event_list) {
+ private function getMaxDailyEventsForWeek($week_of_cell_lists) {
+ $max_count = 0;
+
+ foreach ($week_of_cell_lists as $cell_list) {
+ if ($cell_list['count'] > $max_count) {
+ $max_count = $cell_list['count'];
+ }
+ }
+
+ return $max_count;
+ }
+
+ private function getEventListCell($event_list, $max_count = 0) {
$list = $event_list['list'];
$class = $event_list['class'];
$uri = $event_list['uri'];
@@ -162,7 +176,7 @@ private function getEventListCell($event_list) {
$viewer_is_invited = $list->getIsViewerInvitedOnList();
$event_count_badge = $this->getEventCountBadge($count, $viewer_is_invited);
- $cell_day_secret_link = $this->getHiddenDayLink($uri);
+ $cell_day_secret_link = $this->getHiddenDayLink($uri, $max_count, 125);
$cell_data_div = phutil_tag(
'div',
@@ -191,7 +205,7 @@ private function getDayNumberCell($event_list) {
if ($date) {
$uri = $event_list['uri'];
- $cell_day_secret_link = $this->getHiddenDayLink($uri);
+ $cell_day_secret_link = $this->getHiddenDayLink($uri, 0, 25);
$cell_day = phutil_tag(
'a',
@@ -291,11 +305,16 @@ private function getEventCountBadge($count, $viewer_is_invited) {
$event_count);
}
- private function getHiddenDayLink($uri) {
+ private function getHiddenDayLink($uri, $count, $max_height) {
+ // approximately the height of the tallest cell
+ $height = 18 * $count + 5;
+ $height = ($height > $max_height) ? $height : $max_height;
+ $height_style = 'height: '.$height.'px';
return phutil_tag(
'a',
array(
'class' => 'phui-calendar-month-secret-link',
+ 'style' => $height_style,
'href' => $uri,
),
null);
diff --git a/src/view/widget/hovercard/PhabricatorHovercardView.php b/src/view/widget/hovercard/PhabricatorHovercardView.php
index 58131a6a6b..e342feccee 100644
--- a/src/view/widget/hovercard/PhabricatorHovercardView.php
+++ b/src/view/widget/hovercard/PhabricatorHovercardView.php
@@ -2,7 +2,7 @@
/**
* The default one-for-all hovercard. We may derive from this one to create
- * more specialized ones
+ * more specialized ones.
*/
final class PhabricatorHovercardView extends AphrontView {
diff --git a/support/aphlict/server/aphlict_launcher.php b/support/aphlict/server/aphlict_launcher.php
index 4af50a778b..8a550265bf 100755
--- a/support/aphlict/server/aphlict_launcher.php
+++ b/support/aphlict/server/aphlict_launcher.php
@@ -7,7 +7,7 @@
PhabricatorAphlictManagementWorkflow::requireExtensions();
$args = new PhutilArgumentParser($argv);
-$args->setTagline('manage Aphlict notification server');
+$args->setTagline(pht('manage Aphlict notification server'));
$args->setSynopsis(<< compare_event_start) {
+ destination_cluster_index = j;
+ break;
+ }
+ }
+
+ if (destination_cluster_index !== null) {
+ break;
+ }
+ }
+
+ if (destination_cluster_index !== null) {
+ clusters[destination_cluster_index].push(today_event);
+ destination_cluster_index = null;
+ } else {
+ var next_cluster = [];
+ next_cluster.push(today_event);
+ clusters.push(next_cluster);
+ }
+ }
+
+ return clusters;
+ }
+
+ function updateEventsFromCluster(cluster) {
+ var cluster_size = cluster.length;
+ var n = 0;
+ for(var i=0; i < cluster.length; i++) {
+ var cluster_member = cluster[i];
+
+ var event_id = cluster_member.eventID;
+ var offset = ((n / cluster_size) * 100) + '%';
+ var width = ((1 / cluster_size) * 100) + '%';
+
+ for (var j=0; j < today_events.length; j++) {
+ if (today_events[j].eventID == event_id) {
+
+ today_events[j]['offset'] = offset;
+ today_events[j]['width'] = width;
+ }
+ }
+ n++;
+ }
+
+ return today_events;
+ }
+
+ function drawEvent(e) {
+ var name = e['eventName'];
+ var eventID = e['eventID'];
+ var viewerIsInvited = e['viewerIsInvited'];
+ var offset = e['offset'];
+ var width = e['width'];
+ var top = e['top'];
+ var height = e['height'];
+ var uri = e['uri'];
+
+ var sigil = 'phui-calendar-day-event';
+ var link_class = 'phui-calendar-day-event-link';
+
+ if (viewerIsInvited) {
+ link_class = link_class + ' viewer-invited-day-event';
+ }
+
+ var name_link = JX.$N(
+ 'a',
+ {
+ className : link_class,
+ href: uri
+ },
+ name);
+
+ var class_name = 'phui-calendar-day-event';
+ if (e.canEdit) {
+ class_name = class_name + ' can-drag';
+ }
+
+ var div = JX.$N(
+ 'div',
+ {
+ className: class_name,
+ sigil: sigil,
+ meta: {eventID: eventID, record: e, uri: uri},
+ style: {
+ left: offset,
+ width: width,
+ top: top,
+ height: height
+ }
+ },
+ name_link);
+
+ return div;
+ }
+
+ function drawAllDayEvent(
+ viewerIsInvited,
+ uri,
+ name) {
+ var class_name = 'day-view-all-day';
+ if (viewerIsInvited) {
+ class_name = class_name + ' viewer-invited-day-event';
+ }
+
+ name = JX.$N(
+ 'a',
+ {
+ className: class_name,
+ href: uri
+ },
+ name);
+
+ var all_day_label = JX.$N(
+ 'span',
+ {className: 'phui-calendar-all-day-label'},
+ 'All Day');
+
+ var div_all_day = JX.$N(
+ 'div',
+ {className: 'phui-calendar-day-event all-day'},
+ [all_day_label, name]);
+
+ return div_all_day;
+ }
+
+ function drawRows() {
+ var rows = [];
+ var early_hours = [8];
+ if (first_event_hour) {
+ early_hours.push(first_event_hour);
+ }
+ var min_early_hour = Math.min(early_hours[0], early_hours[1]);
+
+
+ for(var i=0; i < hours.length; i++) {
+ if (hours[i]['hour'] < min_early_hour) {
+ continue;
+ }
+ var cell_time = JX.$N(
+ 'td',
+ {className: 'phui-calendar-day-hour'},
+ hours[i]['hour_meridian']);
+
+ var cell_event = JX.$N(
+ 'td',
+ {
+ meta: {
+ time: hours[i]['hour_meridian']
+ },
+ className: 'phui-calendar-day-events',
+ sigil: 'phui-calendar-day-event-cell'
+ });
+
+ var row = JX.$N(
+ 'tr',
+ {},
+ [cell_time, cell_event]);
+ rows.push(row);
+ }
+ return rows;
+ }
+
+ function clusterAndDrawEvents() {
+ var today_clusters = findTodayClusters();
+ for(var i=0; i < today_clusters.length; i++) {
+ today_events = updateEventsFromCluster(today_clusters[i]);
+ }
+ var drawn_hourly_events = [];
+ for (i=0; i < today_events.length; i++) {
+ drawn_hourly_events.push(drawEvent(today_events[i]));
+ }
+
+ JX.DOM.setContent(hourly_events_wrapper, drawn_hourly_events);
+
+ }
+
+ var year = config.year;
+ var month = config.month;
+ var day = config.day;
+ var query = config.query;
+
+ var hours = config.hours;
+ var first_event_hour = config.firstEventHour;
+ var first_event_hour_epoch = parseInt(config.firstEventHourEpoch, 10);
+ var today_events = config.todayEvents;
+ var today_all_day_events = config.allDayEvents;
+ var table_wrapper = JX.$(config.tableID);
+ var rows = drawRows();
+
+ var all_day_events = [];
+ for(i=0; i < today_all_day_events.length; i++) {
+ var all_day_event = today_all_day_events[i];
+ all_day_events.push(drawAllDayEvent(
+ all_day_event['viewerIsInvited'],
+ all_day_event['uri'],
+ all_day_event['name']));
+ }
+
+ var table = JX.$N(
+ 'table',
+ {className: 'phui-calendar-day-view'},
+ rows);
+
+ var dragging = false;
+ var origin = null;
+
+ var offset_top = null;
+ var new_top = null;
+
+ var click_time = null;
+
+ JX.DOM.listen(
+ table_wrapper,
+ 'mousedown',
+ 'phui-calendar-day-event',
+ function(e){
+
+ if (!e.isNormalMouseEvent()) {
+ return;
+ }
+ var data = e.getNodeData('phui-calendar-day-event');
+ if (!data.record.canEdit) {
+ return;
+ }
+ e.kill();
+ dragging = e.getNode('phui-calendar-day-event');
+ JX.DOM.alterClass(dragging, 'phui-drag', true);
+
+ click_time = new Date();
+
+ origin = JX.$V(e);
+
+ var outer = JX.Vector.getPos(table);
+ var inner = JX.Vector.getPos(dragging);
+
+ offset_top = inner.y - outer.y;
+ new_top = offset_top;
+
+ dragging.style.top = offset_top + 'px';
+ });
+ JX.Stratcom.listen('mousemove', null, function(e){
+ if (!dragging) {
+ return;
+ }
+ var cursor = JX.$V(e);
+
+ new_top = cursor.y - origin.y + offset_top;
+ new_top = Math.min(new_top, 1320);
+ new_top = Math.max(new_top, 0);
+ new_top = Math.floor(new_top/15) * 15;
+
+ dragging.style.top = new_top + 'px';
+ });
+ JX.Stratcom.listen('mouseup', null, function(){
+ if (!dragging) {
+ return;
+ }
+
+ var data = JX.Stratcom.getData(dragging);
+ var record = data.record;
+
+ if (new_top == offset_top) {
+ var now = new Date();
+ if (now.getTime() - click_time.getTime() < 250) {
+ JX.$U(record.uri).go();
+ }
+
+ JX.DOM.alterClass(dragging, 'phui-drag', false);
+ dragging = false;
+ return;
+ }
+ var new_time = first_event_hour_epoch + (new_top * 60);
+ var id = data.eventID;
+ var duration = record.eventEndEpoch - record.eventStartEpoch;
+ record.eventStartEpoch = new_time;
+ record.eventEndEpoch = new_time + duration;
+ record.top = new_top + 'px';
+
+ new JX.Workflow(
+ '/calendar/event/drag/' + id + '/',
+ {start: new_time})
+ .start();
+
+ JX.DOM.alterClass(dragging, 'phui-drag', false);
+ dragging = false;
+
+ clusterAndDrawEvents();
+ });
+
+ JX.DOM.listen(table_wrapper, 'click', 'phui-calendar-day-event', function(e){
+ if (e.isNormalClick()) {
+ e.kill();
+ }
+ });
+
+ JX.DOM.listen(table, 'click', 'phui-calendar-day-event-cell', function(e){
+ if (!e.isNormalClick()) {
+ return;
+ }
+ var data = e.getNodeData('phui-calendar-day-event-cell');
+ var time = data.time;
+ new JX.Workflow(
+ '/calendar/event/create/',
+ {
+ year: year,
+ month: month,
+ day: day,
+ time: time,
+ next: 'day',
+ query: query
+ })
+ .start();
+ });
+
+ var hourly_events_wrapper = JX.$N(
+ 'div',
+ {style: {
+ position: 'absolute',
+ left: '69px',
+ right: 0
+ }});
+
+ clusterAndDrawEvents();
+
+ var daily_wrapper = JX.$N(
+ 'div',
+ {style: {position: 'relative'}},
+ [hourly_events_wrapper, table]);
+
+ JX.DOM.setContent(table_wrapper, [all_day_events, daily_wrapper]);
+
+});
diff --git a/webroot/rsrc/js/application/calendar/event-all-day.js b/webroot/rsrc/js/application/calendar/behavior-event-all-day.js
similarity index 100%
rename from webroot/rsrc/js/application/calendar/event-all-day.js
rename to webroot/rsrc/js/application/calendar/behavior-event-all-day.js
diff --git a/webroot/rsrc/js/application/config/behavior-reorder-fields.js b/webroot/rsrc/js/application/config/behavior-reorder-fields.js
index 948b248afe..1c041e85f8 100644
--- a/webroot/rsrc/js/application/config/behavior-reorder-fields.js
+++ b/webroot/rsrc/js/application/config/behavior-reorder-fields.js
@@ -54,4 +54,5 @@ JX.behavior('config-reorder-fields', function(config) {
JX.$(config.inputID).value = JX.JSON.stringify(order);
};
+ write_state_to_form();
});
diff --git a/webroot/rsrc/js/application/differential/behavior-comment-preview.js b/webroot/rsrc/js/application/differential/behavior-comment-preview.js
index 3cf50535fd..283e6ea12c 100644
--- a/webroot/rsrc/js/application/differential/behavior-comment-preview.js
+++ b/webroot/rsrc/js/application/differential/behavior-comment-preview.js
@@ -21,10 +21,25 @@ JX.behavior('differential-feedback-preview', function(config) {
var callback = function(r) {
var preview = JX.$(config.preview);
- JX.DOM.setContent(preview, JX.$H(r));
- JX.Stratcom.invoke('differential-preview-update', null, {
- container: preview
- });
+ var data = getdata();
+ var hide = true;
+ for (var field in data) {
+ if (field == 'action') {
+ continue;
+ }
+ if (data[field]) {
+ hide = false;
+ }
+ }
+ if (hide) {
+ JX.DOM.hide(preview);
+ } else {
+ JX.DOM.setContent(preview, JX.$H(r));
+ JX.Stratcom.invoke('differential-preview-update', null, {
+ container: preview
+ });
+ JX.DOM.show(preview);
+ }
};
var getdata = function() {
diff --git a/webroot/rsrc/js/application/differential/behavior-edit-inline-comments.js b/webroot/rsrc/js/application/differential/behavior-edit-inline-comments.js
index 0a572a999a..821d279f50 100644
--- a/webroot/rsrc/js/application/differential/behavior-edit-inline-comments.js
+++ b/webroot/rsrc/js/application/differential/behavior-edit-inline-comments.js
@@ -395,4 +395,87 @@ JX.behavior('differential-edit-inline-comments', function(config) {
handle_inline_action(data.node, data.op);
});
+ // Respond to the user clicking the "Hide Inline" button on an inline
+ // comment.
+ JX.Stratcom.listen('click', 'hide-inline', function(e) {
+ e.kill();
+
+ var row = e.getNode('inline-row');
+ JX.DOM.hide(row);
+
+ var prev = row.previousSibling;
+ while (prev && JX.Stratcom.hasSigil(prev, 'inline-row')) {
+ prev = prev.previousSibling;
+ }
+
+ if (!prev) {
+ return;
+ }
+
+ var comment = e.getNodeData('differential-inline-comment');
+
+ var slots = [];
+ for (var ii = 0; ii < prev.childNodes.length; ii++) {
+ if (JX.DOM.isType(prev.childNodes[ii], 'th')) {
+ slots.push(prev.childNodes[ii]);
+ }
+ }
+
+ // Select the right-hand side if the comment is on the right.
+ var slot = (comment.on_right && slots[1]) || slots[0];
+
+ var reveal = JX.DOM.scry(slot, 'a', 'reveal-inlines')[0];
+ if (!reveal) {
+ reveal = JX.$N(
+ 'a',
+ {
+ className: 'reveal-inlines',
+ sigil: 'reveal-inlines'
+ },
+ JX.$H(config.revealIcon));
+
+ JX.DOM.prependContent(slot, reveal);
+ }
+
+ new JX.Workflow(config.uri, {op: 'hide', ids: comment.id})
+ .setHandler(JX.bag)
+ .start();
+ });
+
+ JX.Stratcom.listen('click', 'reveal-inlines', function(e) {
+ e.kill();
+
+ var row = e.getNode('tag:tr');
+ var next = row.nextSibling;
+
+ var ids = [];
+ var ii;
+
+ // Show any hidden inline comment rows directly below this one.
+ while (next && JX.Stratcom.hasSigil(next, 'inline-row')) {
+ JX.DOM.show(next);
+
+ var comments = JX.DOM.scry(next, 'div', 'differential-inline-comment');
+ for (ii = 0; ii < comments.length; ii++) {
+ var id = JX.Stratcom.getData(comments[ii]).id;
+ if (id) {
+ ids.push(id);
+ }
+ }
+
+ next = next.nextSibling;
+ }
+
+ // Remove any "reveal" icons on the row.
+ var reveals = JX.DOM.scry(row, 'a', 'reveal-inlines');
+ for (ii = 0; ii < reveals.length; ii++) {
+ JX.DOM.remove(reveals[ii]);
+ }
+
+ new JX.Workflow(config.uri, {op: 'show', ids: ids.join(',')})
+ .setHandler(JX.bag)
+ .start();
+ });
+
+
});
diff --git a/webroot/rsrc/js/application/herald/HeraldRuleEditor.js b/webroot/rsrc/js/application/herald/HeraldRuleEditor.js
index abf645ba29..e7300528d6 100644
--- a/webroot/rsrc/js/application/herald/HeraldRuleEditor.js
+++ b/webroot/rsrc/js/application/herald/HeraldRuleEditor.js
@@ -220,7 +220,6 @@ JX.install('HeraldRuleEditor', {
case 'buildplan':
case 'taskpriority':
case 'taskstatus':
- case 'arcanistprojects':
case 'legaldocuments':
case 'applicationemail':
var tokenizer = this._newTokenizer(type);
diff --git a/webroot/rsrc/js/application/maniphest/behavior-transaction-preview.js b/webroot/rsrc/js/application/maniphest/behavior-transaction-preview.js
index ca18eb69d4..66b58b1f4b 100644
--- a/webroot/rsrc/js/application/maniphest/behavior-transaction-preview.js
+++ b/webroot/rsrc/js/application/maniphest/behavior-transaction-preview.js
@@ -14,7 +14,23 @@ JX.behavior('maniphest-transaction-preview', function(config) {
var action = JX.$(config.action);
var callback = function(r) {
- JX.DOM.setContent(JX.$(config.preview), JX.$H(r));
+ var panel = JX.$(config.preview);
+ var data = getdata();
+ var hide = true;
+ for (var field in data) {
+ if (field == 'action') {
+ continue;
+ }
+ if (data[field]) {
+ hide = false;
+ }
+ }
+ if (hide) {
+ JX.DOM.hide(panel);
+ } else {
+ JX.DOM.setContent(panel, JX.$H(r));
+ JX.DOM.show(panel);
+ }
};
var getdata = function() {
diff --git a/webroot/rsrc/js/core/behavior-fancy-datepicker.js b/webroot/rsrc/js/core/behavior-fancy-datepicker.js
index f2d092faee..d00f6cc77f 100644
--- a/webroot/rsrc/js/core/behavior-fancy-datepicker.js
+++ b/webroot/rsrc/js/core/behavior-fancy-datepicker.js
@@ -64,7 +64,9 @@ JX.behavior('fancy-datepicker', function() {
JX.DOM.remove(picker);
picker = null;
JX.DOM.alterClass(root, 'picker-open', false);
- e.kill();
+ if (e) {
+ e.kill();
+ }
root = null;
};
@@ -78,25 +80,23 @@ JX.behavior('fancy-datepicker', function() {
var get_inputs = function() {
return {
- y: JX.DOM.find(root, 'select', 'year-input'),
- m: JX.DOM.find(root, 'select', 'month-input'),
- d: JX.DOM.find(root, 'select', 'day-input'),
+ d: JX.DOM.find(root, 'input', 'date-input'),
t: JX.DOM.find(root, 'input', 'time-input')
};
};
var read_date = function() {
var i = get_inputs();
- value_y = +i.y.value;
- value_m = +i.m.value;
- value_d = +i.d.value;
+ var date = i.d.value;
+ var parts = date.split('/');
+ value_y = +parts[2];
+ value_m = +parts[0];
+ value_d = +parts[1];
};
var write_date = function() {
var i = get_inputs();
- i.y.value = value_y;
- i.m.value = value_m;
- i.d.value = value_d;
+ i.d.value = value_m + '/' + value_d + '/' + value_y;
};
var render = function() {
@@ -133,9 +133,12 @@ JX.behavior('fancy-datepicker', function() {
return JX.$N('td', {meta: {value: value}, className: class_name}, label);
};
-
// Render the top bar which allows you to pick a month and year.
var render_month = function() {
+ var valid_date = getValidDate();
+ var month = valid_date.getMonth();
+ var year = valid_date.getYear() + 1900;
+
var months = [
'January',
'February',
@@ -152,7 +155,7 @@ JX.behavior('fancy-datepicker', function() {
var buttons = [
cell('\u25C0', 'm:-1', false, 'lrbutton'),
- cell(months[value_m - 1] + ' ' + value_y, null),
+ cell(months[month] + ' ' + year, null),
cell('\u25B6', 'm:1', false, 'lrbutton')];
return JX.$N(
@@ -161,9 +164,26 @@ JX.behavior('fancy-datepicker', function() {
JX.$N('tr', {}, buttons));
};
+ function getValidDate() {
+ var written_date = new Date(value_y, value_m-1, value_d);
+ if (isNaN(written_date.getTime())) {
+ return new Date();
+ } else {
+ //year 01 should be 2001, not 1901
+ if (written_date.getYear() < 70) {
+ value_y += 2000;
+ written_date = new Date(value_y, value_m-1, value_d);
+ }
+ return written_date;
+ }
+ }
+
// Render the day-of-week and calendar views.
var render_day = function() {
+ var today = new Date();
+ var valid_date = getValidDate();
+
var weeks = [];
// First, render the weekday names.
@@ -179,16 +199,21 @@ JX.behavior('fancy-datepicker', function() {
// Render the calendar itself. NOTE: Javascript uses 0-based month indexes
// while we use 1-based month indexes, so we have to adjust for that.
var days = [];
- var start = new Date(value_y, value_m - 1, 1).getDay();
+ var start = new Date(
+ valid_date.getYear() + 1900,
+ valid_date.getMonth(),
+ 1).getDay();
+
while (start--) {
days.push(cell('', null, false, 'day-placeholder'));
}
- var today = new Date();
-
for (ii = 1; ii <= 31; ii++) {
- var date = new Date(value_y, value_m - 1, ii);
- if (date.getMonth() != (value_m - 1)) {
+ var date = new Date(
+ valid_date.getYear() + 1900,
+ valid_date.getMonth(),
+ ii);
+ if (date.getMonth() != (valid_date.getMonth())) {
// We've spilled over into the next month, so stop rendering.
break;
}
@@ -206,7 +231,11 @@ JX.behavior('fancy-datepicker', function() {
classes.push('weekend');
}
- days.push(cell(ii, 'd:'+ii, value_d == ii, classes.join(' ')));
+ days.push(cell(
+ ii,
+ 'd:'+ii,
+ valid_date.getDate() == ii,
+ classes.join(' ')));
}
// Slice the days into weeks.
@@ -232,6 +261,11 @@ JX.behavior('fancy-datepicker', function() {
return;
}
+ var valid_date = getValidDate();
+ value_y = valid_date.getYear() + 1900;
+ value_m = valid_date.getMonth() + 1;
+ value_d = valid_date.getDate();
+
var p = data.value.split(':');
switch (p[0]) {
case 'm':
@@ -263,4 +297,11 @@ JX.behavior('fancy-datepicker', function() {
render();
});
+ JX.Stratcom.listen('click', null, function(e){
+ if (e.getNode('phabricator-datepicker')) {
+ return;
+ }
+ onclose();
+ });
+
});
diff --git a/webroot/rsrc/js/core/behavior-time-typeahead.js b/webroot/rsrc/js/core/behavior-time-typeahead.js
new file mode 100644
index 0000000000..381eea7f36
--- /dev/null
+++ b/webroot/rsrc/js/core/behavior-time-typeahead.js
@@ -0,0 +1,123 @@
+/**
+ * @provides javelin-behavior-time-typeahead
+ * @requires javelin-behavior
+ * javelin-util
+ * javelin-dom
+ * javelin-stratcom
+ * javelin-vector
+ * javelin-typeahead-static-source
+ */
+
+JX.behavior('time-typeahead', function(config) {
+ var start_date_control = JX.$(config.startTimeID);
+ var end_date_control = config.endTimeID ? JX.$(config.endTimeID) : null;
+
+ var end_date_tampered = false;
+
+ var datasource = new JX.TypeaheadStaticSource(config.timeValues);
+ datasource.setTransformer(function(v) {
+ var attributes = {'className' : 'phui-time-typeahead-value'};
+ var display = JX.$N('div', attributes, v[1]);
+ var object = {
+ 'id' : v[0],
+ 'name' : v[1],
+ 'display' : display,
+ 'uri' : null
+ };
+ return object;
+ });
+ datasource.setSortHandler(function(value, list) {
+ list.sort(function(u,v){
+ return (u.id > v.id) ? 1 : -1;
+ });
+ });
+ datasource.setMaximumResultCount(24);
+ var typeahead = new JX.Typeahead(
+ start_date_control,
+ JX.DOM.find(start_date_control, 'input', null));
+ typeahead.setDatasource(datasource);
+
+ if (!end_date_control) {
+ typeahead.start();
+ return;
+ }
+
+ var start_time_control = JX.DOM.find(
+ start_date_control,
+ 'input',
+ 'time-input');
+ var end_time_control = JX.DOM.find(
+ end_date_control,
+ 'input',
+ 'time-input');
+
+ JX.DOM.listen(start_time_control, 'input', null, function() {
+ if (end_date_tampered) {
+ return;
+ }
+ var time = start_time_control.value;
+ var end_value = getNewValue(time);
+ if (end_value) {
+ end_time_control.value = end_value;
+ }
+ });
+
+ typeahead.listen('choose', function(e) {
+ if (end_date_tampered) {
+ return;
+ }
+ var time = e.name;
+ var end_value = getNewValue(time);
+ if (end_value) {
+ end_time_control.value = end_value;
+ }
+ });
+
+ JX.DOM.listen(end_date_control, 'input', null, function() {
+ end_date_tampered = true;
+ });
+
+
+ function getNewValue(time) {
+ var regex = /^([01]?\d)(?::([0-5]\d))?\s*((am|pm))?$/i;
+
+ if (!regex.test(time)) {
+ return null;
+ }
+
+ var results = regex.exec(time);
+ var hours = parseInt(results[1], 10);
+ var minutes = parseInt(results[2], 10) ? parseInt(results[2], 10) : 0;
+
+ var real_time = 0;
+
+ if (/pm/i.test(results[3])) {
+ real_time = 12*60;
+ } else if (/am/i.test(results[3]) && hours == 12) {
+ hours = 0;
+ }
+
+ real_time = real_time + (hours * 60) + minutes;
+
+ var end_time = real_time + 60;
+
+ var end_meridian = 'AM';
+ var end_hours = Math.floor(end_time / 60);
+
+ if (end_hours == 12) {
+ end_meridian = 'PM';
+ } else if (end_hours > 12 && end_hours < 24) {
+ end_hours = end_hours - 12;
+ end_meridian = 'PM';
+ } else if (end_hours == 24) {
+ end_hours = end_hours - 12;
+ }
+
+ var end_minutes = end_time%60;
+ end_minutes = (end_minutes > 9) ? end_minutes : ('0' + end_minutes);
+ var end_value = end_hours + ':' + end_minutes + ' ' + end_meridian;
+ return end_value;
+ }
+
+ typeahead.start();
+});