1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-30 17:30:59 +01:00

pht() for Settings

Test Plan:
did a run with ALL CAPS through `/settings/` and subpages. This includes changing (and forgetting) my password.

Did not test the following:

 - LDAP

Reviewers: epriestley, btrahan, chad

Reviewed By: chad

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D5174
This commit is contained in:
Anh Nhan Nguyen 2013-03-03 06:52:42 -08:00 committed by epriestley
parent e82a066287
commit c9b96f82bf
14 changed files with 270 additions and 252 deletions

View file

@ -43,6 +43,7 @@ final class PhabricatorApplicationPhriction extends PhabricatorApplication {
'edit/(?:(?P<id>[1-9]\d*)/)?' => 'PhrictionEditController', 'edit/(?:(?P<id>[1-9]\d*)/)?' => 'PhrictionEditController',
'delete/(?P<id>[1-9]\d*)/' => 'PhrictionDeleteController', 'delete/(?P<id>[1-9]\d*)/' => 'PhrictionDeleteController',
'new/' => 'PhrictionNewController', 'new/' => 'PhrictionNewController',
'move/(?P<id>[1-9]\d*)/' => 'PhrictionMoveController',
'preview/' => 'PhrictionDocumentPreviewController', 'preview/' => 'PhrictionDocumentPreviewController',
'diff/(?P<id>[1-9]\d*)/' => 'PhrictionDiffController', 'diff/(?P<id>[1-9]\d*)/' => 'PhrictionDiffController',

View file

@ -54,9 +54,11 @@ final class PhabricatorSettingsMainController
continue; continue;
} }
if (!empty($result[$key])) { if (!empty($result[$key])) {
throw new Exception( throw new Exception(pht(
"Two settings panels share the same panel key ('{$key}'): ". "Two settings panels share the same panel key ('%s'): %s, %s.",
get_class($panel).', '.get_class($result[$key]).'.'); $key,
get_class($panel),
get_class($result[$key])));
} }
$result[$key] = $panel; $result[$key] = $panel;
} }

View file

@ -26,8 +26,8 @@ final class PhabricatorSettingsPanelAccount
if ($editable) { if ($editable) {
$user->setRealName($request->getStr('realname')); $user->setRealName($request->getStr('realname'));
if (!strlen($user->getRealName())) { if (!strlen($user->getRealName())) {
$errors[] = 'Real name must be nonempty.'; $errors[] = pht('Real name must be nonempty.');
$e_realname = 'Required'; $e_realname = pht('Required');
} }
} }
@ -35,7 +35,7 @@ final class PhabricatorSettingsPanelAccount
if (in_array($new_timezone, DateTimeZone::listIdentifiers(), true)) { if (in_array($new_timezone, DateTimeZone::listIdentifiers(), true)) {
$user->setTimezoneIdentifier($new_timezone); $user->setTimezoneIdentifier($new_timezone);
} else { } else {
$errors[] = 'The selected timezone is not a valid timezone.'; $errors[] = pht('The selected timezone is not a valid timezone.');
} }
if (!$errors) { if (!$errors) {
@ -50,14 +50,14 @@ final class PhabricatorSettingsPanelAccount
if ($request->getStr('saved')) { if ($request->getStr('saved')) {
$notice = new AphrontErrorView(); $notice = new AphrontErrorView();
$notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE); $notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE);
$notice->setTitle('Changes Saved'); $notice->setTitle(pht('Changes Saved'));
$notice->appendChild( $notice->appendChild(
phutil_tag('p', array(), 'Your changes have been saved.')); phutil_tag('p', array(), pht('Your changes have been saved.')));
$notice = $notice->render(); $notice = $notice->render();
} }
} else { } else {
$notice = new AphrontErrorView(); $notice = new AphrontErrorView();
$notice->setTitle('Form Errors'); $notice->setTitle(pht('Form Errors'));
$notice->setErrors($errors); $notice->setErrors($errors);
$notice = $notice->render(); $notice = $notice->render();
} }
@ -70,27 +70,27 @@ final class PhabricatorSettingsPanelAccount
->setUser($user) ->setUser($user)
->appendChild( ->appendChild(
id(new AphrontFormStaticControl()) id(new AphrontFormStaticControl())
->setLabel('Username') ->setLabel(pht('Username'))
->setValue($user->getUsername())) ->setValue($user->getUsername()))
->appendChild( ->appendChild(
id(new AphrontFormTextControl()) id(new AphrontFormTextControl())
->setLabel('Real Name') ->setLabel(pht('Real Name'))
->setName('realname') ->setName('realname')
->setError($e_realname) ->setError($e_realname)
->setValue($user->getRealName()) ->setValue($user->getRealName())
->setDisabled(!$editable)) ->setDisabled(!$editable))
->appendChild( ->appendChild(
id(new AphrontFormSelectControl()) id(new AphrontFormSelectControl())
->setLabel('Timezone') ->setLabel(pht('Timezone'))
->setName('timezone') ->setName('timezone')
->setOptions($timezone_id_map) ->setOptions($timezone_id_map)
->setValue($user->getTimezoneIdentifier())) ->setValue($user->getTimezoneIdentifier()))
->appendChild( ->appendChild(
id(new AphrontFormSubmitControl()) id(new AphrontFormSubmitControl())
->setValue('Save')); ->setValue(pht('Save')));
$panel = new AphrontPanelView(); $panel = new AphrontPanelView();
$panel->setHeader('Account Settings'); $panel->setHeader(pht('Account Settings'));
$panel->appendChild($form); $panel->appendChild($form);
$panel->setNoBackground(); $panel->setNoBackground();

View file

@ -22,9 +22,9 @@ final class PhabricatorSettingsPanelConduit
if (!$request->isDialogFormPost()) { if (!$request->isDialogFormPost()) {
$dialog = new AphrontDialogView(); $dialog = new AphrontDialogView();
$dialog->setUser($user); $dialog->setUser($user);
$dialog->setTitle('Really regenerate session?'); $dialog->setTitle(pht('Really regenerate session?'));
$dialog->setSubmitURI($this->getPanelURI()); $dialog->setSubmitURI($this->getPanelURI());
$dialog->addSubmitButton('Regenerate'); $dialog->addSubmitButton(pht('Regenerate'));
$dialog->addCancelbutton($this->getPanelURI()); $dialog->addCancelbutton($this->getPanelURI());
$dialog->appendChild(phutil_tag('p', array(), pht( $dialog->appendChild(phutil_tag('p', array(), pht(
'Really destroy the old certificate? Any established '. 'Really destroy the old certificate? Any established '.
@ -52,13 +52,13 @@ final class PhabricatorSettingsPanelConduit
if ($request->getStr('regenerated')) { if ($request->getStr('regenerated')) {
$notice = new AphrontErrorView(); $notice = new AphrontErrorView();
$notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE); $notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE);
$notice->setTitle('Certificate Regenerated'); $notice->setTitle(pht('Certificate Regenerated'));
$notice->appendChild(phutil_tag( $notice->appendChild(phutil_tag(
'p', 'p',
array(), array(),
'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 '. 'a new certificate. Sessions established under the old certificate '.
'are no longer valid.')); 'are no longer valid.')));
$notice = $notice->render(); $notice = $notice->render();
} else { } else {
$notice = null; $notice = null;
@ -68,35 +68,37 @@ final class PhabricatorSettingsPanelConduit
$cert_form $cert_form
->setUser($user) ->setUser($user)
->appendChild(hsprintf( ->appendChild(hsprintf(
'<p class="aphront-form-instructions">This certificate allows you to '. '<p class="aphront-form-instructions">%s</p>',
'authenticate over Conduit, the Phabricator API. Normally, you just '. pht('This certificate allows you to authenticate over Conduit, '.
'run <tt>arc install-certificate</tt> to install it.')) 'the Phabricator API. Normally, you just run %s to install it.',
hsprintf('<tt>%s</tt>', 'arc install-certificate'))))
->appendChild( ->appendChild(
id(new AphrontFormTextAreaControl()) id(new AphrontFormTextAreaControl())
->setLabel('Certificate') ->setLabel(pht('Certificate'))
->setHeight(AphrontFormTextAreaControl::HEIGHT_SHORT) ->setHeight(AphrontFormTextAreaControl::HEIGHT_SHORT)
->setValue($user->getConduitCertificate())); ->setValue($user->getConduitCertificate()));
$cert = new AphrontPanelView(); $cert = new AphrontPanelView();
$cert->setHeader('Arcanist Certificate'); $cert->setHeader(pht('Arcanist Certificate'));
$cert->appendChild($cert_form); $cert->appendChild($cert_form);
$cert->setNoBackground(); $cert->setNoBackground();
$regen_instruction = pht('You can regenerate this certificate, which '.
'will invalidate the old certificate and create a new one.');
$regen_form = new AphrontFormView(); $regen_form = new AphrontFormView();
$regen_form $regen_form
->setUser($user) ->setUser($user)
->setAction($this->getPanelURI()) ->setAction($this->getPanelURI())
->setWorkflow(true) ->setWorkflow(true)
->appendChild(hsprintf( ->appendChild(hsprintf(
'<p class="aphront-form-instructions">You can regenerate this '. '<p class="aphront-form-instructions">%s</p>', $regen_instruction))
'certificate, which will invalidate the old certificate and create '.
'a new one.</p>'))
->appendChild( ->appendChild(
id(new AphrontFormSubmitControl()) id(new AphrontFormSubmitControl())
->setValue('Regenerate Certificate')); ->setValue(pht('Regenerate Certificate')));
$regen = new AphrontPanelView(); $regen = new AphrontPanelView();
$regen->setHeader('Regenerate Certificate'); $regen->setHeader(pht('Regenerate Certificate'));
$regen->appendChild($regen_form); $regen->appendChild($regen_form);
$regen->setNoBackground(); $regen->setNoBackground();

View file

@ -64,7 +64,7 @@ EXAMPLE;
'href' => PhabricatorEnv::getDoclink( 'href' => PhabricatorEnv::getDoclink(
'article/User_Guide_Configuring_an_External_Editor.html'), 'article/User_Guide_Configuring_an_External_Editor.html'),
), ),
'User Guide: Configuring an External Editor'); pht('User Guide: Configuring an External Editor'));
$font_default = PhabricatorEnv::getEnvConfig('style.monospace'); $font_default = PhabricatorEnv::getEnvConfig('style.monospace');
@ -78,46 +78,52 @@ EXAMPLE;
$pref_dark_console_value = 0; $pref_dark_console_value = 0;
} }
$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',
hsprintf('%s', $editor_doc_link));
$form = id(new AphrontFormView()) $form = id(new AphrontFormView())
->setUser($user) ->setUser($user)
->appendChild( ->appendChild(
id(new AphrontFormSelectControl()) id(new AphrontFormSelectControl())
->setLabel('Page Titles') ->setLabel(pht('Page Titles'))
->setName($pref_titles) ->setName($pref_titles)
->setValue($preferences->getPreference($pref_titles)) ->setValue($preferences->getPreference($pref_titles))
->setOptions( ->setOptions(
array( array(
'glyph' => 'glyph' =>
"In page titles, show Tool names as unicode glyphs: \xE2\x9A\x99", pht("In page titles, show Tool names as unicode glyphs: " .
"\xE2\x9A\x99"),
'text' => 'text' =>
'In page titles, show Tool names as plain text: [Differential]', pht('In page titles, show Tool names as plain text: ' .
'[Differential]'),
))) )))
->appendChild( ->appendChild(
id(new AphrontFormTextControl()) id(new AphrontFormTextControl())
->setLabel('Editor Link') ->setLabel(pht('Editor Link'))
->setName($pref_editor) ->setName($pref_editor)
->setCaption(hsprintf( // How to pht()
'Link to edit files in external editor. '. ->setCaption($editor_instructions)
'%%f is replaced by filename, %%l by line number, %%r by repository '.
'callsign, %%%% by literal %%. For documentation, see %s.',
$editor_doc_link))
->setValue($preferences->getPreference($pref_editor))) ->setValue($preferences->getPreference($pref_editor)))
->appendChild( ->appendChild(
id(new AphrontFormSelectControl()) id(new AphrontFormSelectControl())
->setLabel('Edit Multiple Files') ->setLabel(pht('Edit Multiple Files'))
->setName($pref_multiedit) ->setName($pref_multiedit)
->setOptions(array( ->setOptions(array(
'' => 'Supported (paths separated by spaces)', '' => pht('Supported (paths separated by spaces)'),
'disable' => 'Not Supported', 'disable' => pht('Not Supported'),
)) ))
->setValue($preferences->getPreference($pref_multiedit))) ->setValue($preferences->getPreference($pref_multiedit)))
->appendChild( ->appendChild(
id(new AphrontFormTextControl()) id(new AphrontFormTextControl())
->setLabel('Monospaced Font') ->setLabel(pht('Monospaced Font'))
->setName($pref_monospaced) ->setName($pref_monospaced)
// Check plz
->setCaption(hsprintf( ->setCaption(hsprintf(
'Overrides default fonts in tools like Differential.<br />'. '%s<br />(%s: %s)',
'(Default: %s)', pht('Overrides default fonts in tools like Differential.'),
pht('Default'),
$font_default)) $font_default))
->setValue($preferences->getPreference($pref_monospaced))) ->setValue($preferences->getPreference($pref_monospaced)))
->appendChild( ->appendChild(
@ -128,40 +134,40 @@ EXAMPLE;
$example_string))) $example_string)))
->appendChild( ->appendChild(
id(new AphrontFormRadioButtonControl()) id(new AphrontFormRadioButtonControl())
->setLabel('Monospaced Textareas') ->setLabel(pht('Monospaced Textareas'))
->setName($pref_monospaced_textareas) ->setName($pref_monospaced_textareas)
->setValue($pref_monospaced_textareas_value) ->setValue($pref_monospaced_textareas_value)
->addButton('enabled', 'Enabled', ->addButton('enabled', pht('Enabled'),
'Show all textareas using the monospaced font defined above.') pht('Show all textareas using the monospaced font defined above.'))
->addButton('disabled', 'Disabled', null)); ->addButton('disabled', pht('Disabled'), null));
if (PhabricatorEnv::getEnvConfig('darkconsole.enabled')) { if (PhabricatorEnv::getEnvConfig('darkconsole.enabled')) {
$form->appendChild( $form->appendChild(
id(new AphrontFormRadioButtonControl()) id(new AphrontFormRadioButtonControl())
->setLabel('Dark Console') ->setLabel(pht('Dark Console'))
->setName($pref_dark_console) ->setName($pref_dark_console)
->setValue($pref_dark_console_value ? ->setValue($pref_dark_console_value ?
$pref_dark_console_value : 0) $pref_dark_console_value : 0)
->addButton(1, 'Enabled', ->addButton(1, pht('Enabled'),
'Enabling and using the built-in debugging console.') pht('Enabling and using the built-in debugging console.'))
->addButton(0, 'Disabled', null)); ->addButton(0, pht('Disabled'), null));
} }
$form->appendChild( $form->appendChild(
id(new AphrontFormSubmitControl()) id(new AphrontFormSubmitControl())
->setValue('Save Preferences')); ->setValue(pht('Save Preferences')));
$panel = new AphrontPanelView(); $panel = new AphrontPanelView();
$panel->setHeader('Display Preferences'); $panel->setHeader(pht('Display Preferences'));
$panel->appendChild($form); $panel->appendChild($form);
$panel->setNoBackground(); $panel->setNoBackground();
$error_view = null; $error_view = null;
if ($request->getStr('saved') === 'true') { if ($request->getStr('saved') === 'true') {
$error_view = id(new AphrontErrorView()) $error_view = id(new AphrontErrorView())
->setTitle('Preferences Saved') ->setTitle(pht('Preferences Saved'))
->setSeverity(AphrontErrorView::SEVERITY_NOTICE) ->setSeverity(AphrontErrorView::SEVERITY_NOTICE)
->setErrors(array('Your preferences have been saved.')); ->setErrors(array(pht('Your preferences have been saved.')));
} }
return array( return array(

View file

@ -59,7 +59,7 @@ final class PhabricatorSettingsPanelEmailAddresses
'href' => $uri->alter('verify', $email->getID()), 'href' => $uri->alter('verify', $email->getID()),
'sigil' => 'workflow', 'sigil' => 'workflow',
), ),
'Verify'); pht('Verify'));
$button_make_primary = javelin_tag( $button_make_primary = javelin_tag(
'a', 'a',
@ -68,7 +68,7 @@ final class PhabricatorSettingsPanelEmailAddresses
'href' => $uri->alter('primary', $email->getID()), 'href' => $uri->alter('primary', $email->getID()),
'sigil' => 'workflow', 'sigil' => 'workflow',
), ),
'Make Primary'); pht('Make Primary'));
$button_remove = javelin_tag( $button_remove = javelin_tag(
'a', 'a',
@ -77,14 +77,14 @@ final class PhabricatorSettingsPanelEmailAddresses
'href' => $uri->alter('delete', $email->getID()), 'href' => $uri->alter('delete', $email->getID()),
'sigil' => 'workflow' 'sigil' => 'workflow'
), ),
'Remove'); pht('Remove'));
$button_primary = phutil_tag( $button_primary = phutil_tag(
'a', 'a',
array( array(
'class' => 'button small disabled', 'class' => 'button small disabled',
), ),
'Primary'); pht('Primary'));
if (!$email->getIsVerified()) { if (!$email->getIsVerified()) {
$action = $button_verify; $action = $button_verify;
@ -112,9 +112,9 @@ final class PhabricatorSettingsPanelEmailAddresses
$table = new AphrontTableView($rows); $table = new AphrontTableView($rows);
$table->setHeaders( $table->setHeaders(
array( array(
'Email', pht('Email'),
'Status', pht('Status'),
'Remove', pht('Remove'),
)); ));
$table->setColumnClasses( $table->setColumnClasses(
array( array(
@ -140,9 +140,9 @@ final class PhabricatorSettingsPanelEmailAddresses
'class' => 'green button', 'class' => 'green button',
'sigil' => 'workflow', 'sigil' => 'workflow',
), ),
'Add New Address')); pht('Add New Address')));
} }
$view->setHeader('Email Addresses'); $view->setHeader(pht('Email Addresses'));
$view->appendChild($table); $view->appendChild($table);
$view->setNoBackground(); $view->setNoBackground();
@ -167,10 +167,10 @@ final class PhabricatorSettingsPanelEmailAddresses
} }
if (!strlen($email)) { if (!strlen($email)) {
$e_email = 'Required'; $e_email = pht('Required');
$errors[] = 'Email is required.'; $errors[] = pht('Email is required.');
} else if (!PhabricatorUserEmail::isAllowedAddress($email)) { } else if (!PhabricatorUserEmail::isAllowedAddress($email)) {
$e_email = 'Invalid'; $e_email = pht('Invalid');
$errors[] = PhabricatorUserEmail::describeAllowedAddresses(); $errors[] = PhabricatorUserEmail::describeAllowedAddresses();
} }
@ -190,17 +190,17 @@ final class PhabricatorSettingsPanelEmailAddresses
$dialog = id(new AphrontDialogView()) $dialog = id(new AphrontDialogView())
->setUser($user) ->setUser($user)
->addHiddenInput('new', 'verify') ->addHiddenInput('new', 'verify')
->setTitle('Verification Email Sent') ->setTitle(pht('Verification Email Sent'))
->appendChild(phutil_tag('p', array(), pht( ->appendChild(phutil_tag('p', array(), pht(
'A verification email has been sent. Click the link in the '. 'A verification email has been sent. Click the link in the '.
'email to verify your address.'))) 'email to verify your address.')))
->setSubmitURI($uri) ->setSubmitURI($uri)
->addSubmitButton('Done'); ->addSubmitButton(pht('Done'));
return id(new AphrontDialogResponse())->setDialog($dialog); return id(new AphrontDialogResponse())->setDialog($dialog);
} catch (AphrontQueryDuplicateKeyException $ex) { } catch (AphrontQueryDuplicateKeyException $ex) {
$email = 'Duplicate'; $email = pht('Duplicate');
$errors[] = 'Another user already has this email.'; $errors[] = pht('Another user already has this email.');
} }
} }
} }
@ -213,7 +213,7 @@ final class PhabricatorSettingsPanelEmailAddresses
$form = id(new AphrontFormLayoutView()) $form = id(new AphrontFormLayoutView())
->appendChild( ->appendChild(
id(new AphrontFormTextControl()) id(new AphrontFormTextControl())
->setLabel('Email') ->setLabel(pht('Email'))
->setName('email') ->setName('email')
->setValue($request->getStr('email')) ->setValue($request->getStr('email'))
->setCaption(PhabricatorUserEmail::describeAllowedAddresses()) ->setCaption(PhabricatorUserEmail::describeAllowedAddresses())
@ -222,10 +222,10 @@ final class PhabricatorSettingsPanelEmailAddresses
$dialog = id(new AphrontDialogView()) $dialog = id(new AphrontDialogView())
->setUser($user) ->setUser($user)
->addHiddenInput('new', 'true') ->addHiddenInput('new', 'true')
->setTitle('New Address') ->setTitle(pht('New Address'))
->appendChild($errors) ->appendChild($errors)
->appendChild($form) ->appendChild($form)
->addSubmitButton('Save') ->addSubmitButton(pht('Save'))
->addCancelButton($uri); ->addCancelButton($uri);
return id(new AphrontDialogResponse())->setDialog($dialog); return id(new AphrontDialogResponse())->setDialog($dialog);
@ -263,11 +263,11 @@ final class PhabricatorSettingsPanelEmailAddresses
$dialog = id(new AphrontDialogView()) $dialog = id(new AphrontDialogView())
->setUser($user) ->setUser($user)
->addHiddenInput('delete', $email_id) ->addHiddenInput('delete', $email_id)
->setTitle("Really delete address '{$address}'?") ->setTitle(pht("Really delete address '%s'?", $address))
->appendChild(phutil_tag('p', array(), pht( ->appendChild(phutil_tag('p', array(), pht(
'Are you sure you want to delete this address? You will no '. '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.')))
->addSubmitButton('Delete') ->addSubmitButton(pht('Delete'))
->addCancelButton($uri); ->addCancelButton($uri);
return id(new AphrontDialogResponse())->setDialog($dialog); return id(new AphrontDialogResponse())->setDialog($dialog);
@ -300,11 +300,11 @@ final class PhabricatorSettingsPanelEmailAddresses
$dialog = id(new AphrontDialogView()) $dialog = id(new AphrontDialogView())
->setUser($user) ->setUser($user)
->addHiddenInput('verify', $email_id) ->addHiddenInput('verify', $email_id)
->setTitle("Send Another Verification Email?") ->setTitle(pht("Send Another Verification Email?"))
->appendChild(hsprintf( ->appendChild(hsprintf(
'<p>Send another copy of the verification email to %s?</p>', '<p>%s</p>',
$address)) pht('Send another copy of the verification email to %s?', $address)))
->addSubmitButton('Send Email') ->addSubmitButton(pht('Send Email'))
->addCancelButton($uri); ->addCancelButton($uri);
return id(new AphrontDialogResponse())->setDialog($dialog); return id(new AphrontDialogResponse())->setDialog($dialog);
@ -341,12 +341,12 @@ final class PhabricatorSettingsPanelEmailAddresses
$dialog = id(new AphrontDialogView()) $dialog = id(new AphrontDialogView())
->setUser($user) ->setUser($user)
->addHiddenInput('primary', $email_id) ->addHiddenInput('primary', $email_id)
->setTitle("Change primary email address?") ->setTitle(pht("Change primary email address?"))
->appendChild(hsprintf( ->appendChild(hsprintf(
'<p>If you change your primary address, Phabricator will send all '. '<p>If you change your primary address, Phabricator will send'.
'email to %s.</p>', ' all email to %s.</p>',
$address)) $address))
->addSubmitButton('Change Primary Address') ->addSubmitButton(pht('Change Primary Address'))
->addCancelButton($uri); ->addCancelButton($uri);
return id(new AphrontDialogResponse())->setDialog($dialog); return id(new AphrontDialogResponse())->setDialog($dialog);

View file

@ -71,23 +71,23 @@ final class PhabricatorSettingsPanelEmailPreferences
if ($request->getStr('saved')) { if ($request->getStr('saved')) {
$notice = new AphrontErrorView(); $notice = new AphrontErrorView();
$notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE); $notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE);
$notice->setTitle('Changes Saved'); $notice->setTitle(pht('Changes Saved'));
$notice->appendChild( $notice->appendChild(
phutil_tag('p', array(), 'Your changes have been saved.')); phutil_tag('p', array(), pht('Your changes have been saved.')));
} }
} else { } else {
$notice = new AphrontErrorView(); $notice = new AphrontErrorView();
$notice->setTitle('Form Errors'); $notice->setTitle(pht('Form Errors'));
$notice->setErrors($errors); $notice->setErrors($errors);
} }
$re_prefix_default = PhabricatorEnv::getEnvConfig('metamta.re-prefix') $re_prefix_default = PhabricatorEnv::getEnvConfig('metamta.re-prefix')
? 'Enabled' ? pht('Enabled')
: 'Disabled'; : pht('Disabled');
$vary_default = PhabricatorEnv::getEnvConfig('metamta.vary-subjects') $vary_default = PhabricatorEnv::getEnvConfig('metamta.vary-subjects')
? 'Vary' ? pht('Vary')
: 'Do Not Vary'; : pht('Do Not Vary');
$re_prefix_value = $preferences->getPreference($pref_re_prefix); $re_prefix_value = $preferences->getPreference($pref_re_prefix);
if ($re_prefix_value === null) { if ($re_prefix_value === null) {
@ -112,14 +112,14 @@ final class PhabricatorSettingsPanelEmailPreferences
->setUser($user) ->setUser($user)
->appendChild( ->appendChild(
id(new AphrontFormSelectControl()) id(new AphrontFormSelectControl())
->setLabel('Self Actions') ->setLabel(pht('Self Actions'))
->setName($pref_no_self_mail) ->setName($pref_no_self_mail)
->setOptions( ->setOptions(
array( array(
'0' => 'Send me an email when I take an action', '0' => pht('Send me an email when I take an action'),
'1' => 'Do not send me an email when I take an action', '1' => pht('Do not send me an email when I take an action'),
)) ))
->setCaption('You can disable email about your own actions.') ->setCaption(pht('You can disable email about your own actions.'))
->setValue($preferences->getPreference($pref_no_self_mail, 0))); ->setValue($preferences->getPreference($pref_no_self_mail, 0)));
if (PhabricatorMetaMTAMail::shouldMultiplexAllMail()) { if (PhabricatorMetaMTAMail::shouldMultiplexAllMail()) {
@ -127,9 +127,9 @@ final class PhabricatorSettingsPanelEmailPreferences
->setName($pref_re_prefix) ->setName($pref_re_prefix)
->setOptions( ->setOptions(
array( array(
'default' => 'Use Server Default ('.$re_prefix_default.')', 'default' => pht('Use Server Default (%s)', $re_prefix_default),
'true' => 'Enable "Re:" prefix', 'true' => pht('Enable "Re:" prefix'),
'false' => 'Disable "Re:" prefix', 'false' => pht('Disable "Re:" prefix'),
)) ))
->setValue($re_prefix_value); ->setValue($re_prefix_value);
@ -137,9 +137,9 @@ final class PhabricatorSettingsPanelEmailPreferences
->setName($pref_vary) ->setName($pref_vary)
->setOptions( ->setOptions(
array( array(
'default' => 'Use Server Default ('.$vary_default.')', 'default' => pht('Use Server Default (%s)', $vary_default),
'true' => 'Vary Subjects', 'true' => pht('Vary Subjects'),
'false' => 'Do Not Vary Subjects', 'false' => pht('Do Not Vary Subjects'),
)) ))
->setValue($vary_value); ->setValue($vary_value);
} else { } else {
@ -153,29 +153,29 @@ final class PhabricatorSettingsPanelEmailPreferences
$form $form
->appendChild( ->appendChild(
$re_control $re_control
->setLabel('Add "Re:" Prefix') ->setLabel(pht('Add "Re:" Prefix'))
->setCaption( ->setCaption(
'Enable this option to fix threading in Mail.app on OS X Lion, '. pht('Enable this option to fix threading in Mail.app on OS X Lion,'.
'or if you like "Re:" in your email subjects.')) ' or if you like "Re:" in your email subjects.')))
->appendChild( ->appendChild(
$vary_control $vary_control
->setLabel('Vary Subjects') ->setLabel(pht('Vary Subjects'))
->setCaption( ->setCaption(
'This option adds more information to email subjects, but may '. pht('This option adds more information to email subjects, but may '.
'break threading in some clients.')); 'break threading in some clients.')));
$form $form
->appendChild(hsprintf( ->appendChild(hsprintf(
'<br />'. '<br />'.
'<p class="aphront-form-instructions">%s</p>'.
'<p class="aphront-form-instructions">'. '<p class="aphront-form-instructions">'.
'You can customize what mail you receive from Phabricator here.'. '<strong>%s</strong> %s</p>',
'</p>'. pht('You can customize what mail you receive from Phabricator here.'),
'<p class="aphront-form-instructions">'. pht('NOTE:'),
'<strong>NOTE:</strong> If an update makes several changes (like '. pht('If an update makes several changes (like '.
'adding CCs to a task, closing it, and adding a comment) you will '. 'adding CCs to a task, closing it, and adding a comment) you will '.
'still receive an email as long as at least one of the changes '. 'still receive an email as long as at least one of the changes '.
'is set to notify you.'. 'is set to notify you.')));
'</p>'));
$mailtags = $preferences->getPreference('mailtags', array()); $mailtags = $preferences->getPreference('mailtags', array());
@ -184,23 +184,23 @@ final class PhabricatorSettingsPanelEmailPreferences
$this->buildMailTagCheckboxes( $this->buildMailTagCheckboxes(
$this->getDifferentialMailTags(), $this->getDifferentialMailTags(),
$mailtags) $mailtags)
->setLabel('Differential')); ->setLabel(pht('Differential')));
if (PhabricatorEnv::getEnvConfig('maniphest.enabled')) { if (PhabricatorEnv::getEnvConfig('maniphest.enabled')) {
$form->appendChild( $form->appendChild(
$this->buildMailTagCheckboxes( $this->buildMailTagCheckboxes(
$this->getManiphestMailTags(), $this->getManiphestMailTags(),
$mailtags) $mailtags)
->setLabel('Maniphest')); ->setLabel(pht('Maniphest')));
} }
$form $form
->appendChild( ->appendChild(
id(new AphrontFormSubmitControl()) id(new AphrontFormSubmitControl())
->setValue('Save Preferences')); ->setValue(pht('Save Preferences')));
$panel = new AphrontPanelView(); $panel = new AphrontPanelView();
$panel->setHeader('Email Preferences'); $panel->setHeader(pht('Email Preferences'));
$panel->appendChild($form); $panel->appendChild($form);
$panel->setNoBackground(); $panel->setNoBackground();

View file

@ -71,6 +71,7 @@ final class PhabricatorSettingsPanelHomePreferences
$full = PhabricatorApplication::TILE_FULL; $full = PhabricatorApplication::TILE_FULL;
$key = get_class($app); $key = get_class($app);
// Won't pht() for dynamic string (Applcation Name)
$form->appendChild( $form->appendChild(
id(new AphrontFormSelectControl()) id(new AphrontFormSelectControl())
->setLabel($app->getName()) ->setLabel($app->getName())
@ -88,14 +89,14 @@ final class PhabricatorSettingsPanelHomePreferences
$form $form
->appendChild( ->appendChild(
id(new AphrontFormSubmitControl()) id(new AphrontFormSubmitControl())
->setValue('Save Preferences')); ->setValue(pht('Save Preferences')));
$error_view = null; $error_view = null;
if ($request->getStr('saved') === 'true') { if ($request->getStr('saved') === 'true') {
$error_view = id(new AphrontErrorView()) $error_view = id(new AphrontErrorView())
->setTitle('Preferences Saved') ->setTitle(pht('Preferences Saved'))
->setSeverity(AphrontErrorView::SEVERITY_NOTICE) ->setSeverity(AphrontErrorView::SEVERITY_NOTICE)
->setErrors(array('Your preferences have been saved.')); ->setErrors(array(pht('Your preferences have been saved.')));
} }
return array( return array(

View file

@ -30,38 +30,38 @@ final class PhabricatorSettingsPanelLDAP
$forms = array(); $forms = array();
if (!$ldap_info) { if (!$ldap_info) {
$unlink = 'Link LDAP Account'; $unlink = pht('Link LDAP Account');
$unlink_form = new AphrontFormView(); $unlink_form = new AphrontFormView();
$unlink_form $unlink_form
->setUser($user) ->setUser($user)
->setAction('/ldap/login/') ->setAction('/ldap/login/')
->appendChild(hsprintf( ->appendChild(hsprintf(
'<p class="aphront-form-instructions">There is currently no '. '<p class="aphront-form-instructions">%s</p>',
'LDAP account linked to your Phabricator account. You can link an '. pht('There is currently no LDAP account linked to your Phabricator '.
'account, which will allow you to use it to log into Phabricator.'. 'account. You can link an account, which will allow you to use it '.
'</p>')) 'to log into Phabricator.')))
->appendChild( ->appendChild(
id(new AphrontFormTextControl()) id(new AphrontFormTextControl())
->setLabel('LDAP username') ->setLabel(pht('LDAP username'))
->setName('username')) ->setName('username'))
->appendChild( ->appendChild(
id(new AphrontFormPasswordControl()) id(new AphrontFormPasswordControl())
->setLabel('Password') ->setLabel(pht('Password'))
->setName('password')) ->setName('password'))
->appendChild( ->appendChild(
id(new AphrontFormSubmitControl()) id(new AphrontFormSubmitControl())
->setValue("Link LDAP Account \xC2\xBB")); ->setValue(pht("Link LDAP Account \xC2\xBB")));
$forms['Link Account'] = $unlink_form; $forms['Link Account'] = $unlink_form;
} else { } else {
$unlink = 'Unlink LDAP Account'; $unlink = pht('Unlink LDAP Account');
$unlink_form = new AphrontFormView(); $unlink_form = new AphrontFormView();
$unlink_form $unlink_form
->setUser($user) ->setUser($user)
->appendChild(hsprintf( ->appendChild(hsprintf(
'<p class="aphront-form-instructions">You may unlink this account '. '<p class="aphront-form-instructions">%s</p>',
'from your LDAP account. This will prevent you from logging in with '. pht('You may unlink this account from your LDAP account. This will '.
'your LDAP credentials.</p>')) 'prevent you from logging in with your LDAP credentials.')))
->appendChild( ->appendChild(
id(new AphrontFormSubmitControl()) id(new AphrontFormSubmitControl())
->addCancelButton('/ldap/unlink/', $unlink)); ->addCancelButton('/ldap/unlink/', $unlink));
@ -70,7 +70,7 @@ final class PhabricatorSettingsPanelLDAP
} }
$panel = new AphrontPanelView(); $panel = new AphrontPanelView();
$panel->setHeader('LDAP Account Settings'); $panel->setHeader(pht('LDAP Account Settings'));
$panel->setNoBackground(); $panel->setNoBackground();
foreach ($forms as $name => $form) { foreach ($forms as $name => $form) {

View file

@ -85,58 +85,59 @@ final class PhabricatorSettingsPanelOAuth
if (!$oauth_info) { if (!$oauth_info) {
$form $form
->appendChild(hsprintf( ->appendChild(hsprintf(
'<p class="aphront-form-instructions">There is currently no %s '. '<p class="aphront-form-instructions">%s</p>',
pht('There is currently no %s '.
'account linked to your Phabricator account. You can link an '. 'account linked to your Phabricator account. You can link an '.
'account, which will allow you to use it to log into Phabricator.'. 'account, which will allow you to use it to log into Phabricator.',
'</p>', $provider_name)));
$provider_name));
$this->prepareAuthForm($form); $this->prepareAuthForm($form);
$form $form
->appendChild( ->appendChild(
id(new AphrontFormSubmitControl()) id(new AphrontFormSubmitControl())
->setValue('Link '.$provider_name." Account \xC2\xBB")); ->setValue(pht('Link %s Account \xC2\xBB', $provider_name)));
} else { } else {
$expires = $oauth_info->getTokenExpires(); $expires = $oauth_info->getTokenExpires();
$form $form
->appendChild(hsprintf( ->appendChild(hsprintf(
'<p class="aphront-form-instructions">Your account is linked with '. '<p class="aphront-form-instructions">%s</p>',
pht('Your account is linked with '.
'a %s account. You may use your %s credentials to log into '. 'a %s account. You may use your %s credentials to log into '.
'Phabricator.</p>', 'Phabricator.',
$provider_name, $provider_name,
$provider_name)) $provider_name)))
->appendChild( ->appendChild(
id(new AphrontFormStaticControl()) id(new AphrontFormStaticControl())
->setLabel($provider_name.' ID') ->setLabel(pht('%s ID', $provider_name))
->setValue($oauth_info->getOAuthUID())) ->setValue($oauth_info->getOAuthUID()))
->appendChild( ->appendChild(
id(new AphrontFormStaticControl()) id(new AphrontFormStaticControl())
->setLabel($provider_name.' Name') ->setLabel(pht('%s Name', $provider_name))
->setValue($oauth_info->getAccountName())) ->setValue($oauth_info->getAccountName()))
->appendChild( ->appendChild(
id(new AphrontFormStaticControl()) id(new AphrontFormStaticControl())
->setLabel($provider_name.' URI') ->setLabel(pht('%s URI', $provider_name))
->setValue($oauth_info->getAccountURI())); ->setValue($oauth_info->getAccountURI()));
if (!$expires || $expires > time()) { if (!$expires || $expires > time()) {
$form->appendChild( $form->appendChild(
id(new AphrontFormSubmitControl()) id(new AphrontFormSubmitControl())
->setValue('Refresh Profile Image from '.$provider_name)); ->setValue(pht('Refresh Profile Image from %s', $provider_name)));
} }
if (!$provider->isProviderLinkPermanent()) { if (!$provider->isProviderLinkPermanent()) {
$unlink = 'Unlink '.$provider_name.' Account'; $unlink = pht('Unlink %s Account');
$unlink_form = new AphrontFormView(); $unlink_form = new AphrontFormView();
$unlink_form $unlink_form
->setUser($user) ->setUser($user)
->appendChild(hsprintf( ->appendChild(hsprintf(
'<p class="aphront-form-instructions">You may unlink this account '. '<p class="aphront-form-instructions">%s</p>',
'from your %s account. This will prevent you from logging in '. pht('You may unlink this account from your %s account. This will '.
'with your %s credentials.</p>', 'prevent you from logging in with your %s credentials.',
$provider_name, $provider_name,
$provider_name)) $provider_name)))
->appendChild( ->appendChild(
id(new AphrontFormSubmitControl()) id(new AphrontFormSubmitControl())
->addCancelButton('/oauth/'.$provider_key.'/unlink/', $unlink)); ->addCancelButton('/oauth/'.$provider_key.'/unlink/', $unlink));
@ -145,17 +146,17 @@ final class PhabricatorSettingsPanelOAuth
if ($expires) { if ($expires) {
if ($expires <= time()) { if ($expires <= time()) {
$expires_text = "Expired"; $expires_text = pht("Expired");
} else { } else {
$expires_text = phabricator_datetime($expires, $user); $expires_text = phabricator_datetime($expires, $user);
} }
} else { } else {
$expires_text = 'No Information Available'; $expires_text = pht('No Information Available');
} }
$scope = $oauth_info->getTokenScope(); $scope = $oauth_info->getTokenScope();
if (!$scope) { if (!$scope) {
$scope = 'No Information Available'; $scope = pht('No Information Available');
} }
$status = $oauth_info->getTokenStatus(); $status = $oauth_info->getTokenStatus();
@ -164,14 +165,17 @@ final class PhabricatorSettingsPanelOAuth
$rappable_status = PhabricatorUserOAuthInfo::getRappableTokenStatus( $rappable_status = PhabricatorUserOAuthInfo::getRappableTokenStatus(
$status); $status);
$beat = self::getBeat(); $beat = self::getBeat();
$rap = hsprintf(
"%s Yo yo yo<br />". // The plenty %2$s are supposed to point at the line break
'My name\'s DJ Token and I\'m here to say<br />'. $rap = pht(
'%1$s Yo yo yo %2$s'.
'My name\'s DJ Token and I\'m here to say %2$s'.
// pronounce as "dollar rappable status" for meter to work // pronounce as "dollar rappable status" for meter to work
"%s, hey hey hey hey<br />". '%3$s, hey hey hey hey %2$s'.
'I rap \'bout tokens, that might be why<br />'. 'I rap \'bout tokens, that might be why %2$s'.
'I\'m such a cool and popular guy', 'I\'m such a cool and popular guy',
$beat, $beat,
hsprintf('<br />'),
$rappable_status); $rappable_status);
$token_form = new AphrontFormView(); $token_form = new AphrontFormView();
@ -182,15 +186,15 @@ final class PhabricatorSettingsPanelOAuth
$rap)) $rap))
->appendChild( ->appendChild(
id(new AphrontFormStaticControl()) id(new AphrontFormStaticControl())
->setLabel('Token Status') ->setLabel(pht('Token Status'))
->setValue($readable_status)) ->setValue($readable_status))
->appendChild( ->appendChild(
id(new AphrontFormStaticControl()) id(new AphrontFormStaticControl())
->setLabel('Expires') ->setLabel(pht('Expires'))
->setValue($expires_text)) ->setValue($expires_text))
->appendChild( ->appendChild(
id(new AphrontFormStaticControl()) id(new AphrontFormStaticControl())
->setLabel('Scope') ->setLabel(pht('Scope'))
->setValue($scope)); ->setValue($scope));
if ($expires <= time()) { if ($expires <= time()) {
@ -198,14 +202,14 @@ final class PhabricatorSettingsPanelOAuth
$token_form $token_form
->appendChild( ->appendChild(
id(new AphrontFormSubmitControl()) id(new AphrontFormSubmitControl())
->setValue('Refresh '.$provider_name.' Token')); ->setValue(pht('Refresh %s Token', $provider_name)));
} }
$forms['Account Token Information'] = $token_form; $forms['Account Token Information'] = $token_form;
} }
$panel = new AphrontPanelView(); $panel = new AphrontPanelView();
$panel->setHeader($provider_name.' Account Settings'); $panel->setHeader(pht('%s Account Settings', $provider_name));
$panel->setNoBackground(); $panel->setNoBackground();
foreach ($forms as $name => $form) { foreach ($forms as $name => $form) {
@ -258,25 +262,26 @@ final class PhabricatorSettingsPanelOAuth
$user->setProfileImagePHID($small_xformed->getPHID()); $user->setProfileImagePHID($small_xformed->getPHID());
$user->save(); $user->save();
} else { } else {
$error = 'Unable to retrieve image.'; $error = pht('Unable to retrieve image.');
} }
} catch (Exception $e) { } catch (Exception $e) {
if ($e instanceof PhabricatorOAuthProviderException) { if ($e instanceof PhabricatorOAuthProviderException) {
$error = sprintf('Unable to retrieve image from %s', // Check plz
$error = pht('Unable to retrieve image from %s',
$provider->getProviderName()); $provider->getProviderName());
} else { } else {
$error = 'Unable to save image.'; $error = pht('Unable to save image.');
} }
} }
$notice = new AphrontErrorView(); $notice = new AphrontErrorView();
if ($error) { if ($error) {
$notice $notice
->setTitle('Error Refreshing Profile Picture') ->setTitle(pht('Error Refreshing Profile Picture'))
->setErrors(array($error)); ->setErrors(array($error));
} else { } else {
$notice $notice
->setSeverity(AphrontErrorView::SEVERITY_NOTICE) ->setSeverity(AphrontErrorView::SEVERITY_NOTICE)
->setTitle('Successfully Refreshed Profile Picture'); ->setTitle(pht('Successfully Refreshed Profile Picture'));
} }
return $notice; return $notice;
} }
@ -284,12 +289,12 @@ final class PhabricatorSettingsPanelOAuth
private static function getBeat() { private static function getBeat() {
// Gangsta's Paradise (karaoke version). // Gangsta's Paradise (karaoke version).
// Chosen because it's the only thing I listen to. // Chosen because it's the only thing I listen to.
$song_id = "Gangsta's Paradise"; $song_id = pht("Gangsta's Paradise");
// Make a musical note which you can click for the beat. // Make a musical note which you can click for the beat.
$beat = hsprintf( $beat = hsprintf(
'<a href="javascript:void(0);" onclick="%s">&#9835;</a>', '<a href="javascript:void(0);" onclick="%s">&#9835;</a>',
jsprintf('alert(%s); return 0;', "Think about {$song_id}.")); jsprintf('alert(%s); return 0;', pht("Think about %s.", $song_id)));
return $beat; return $beat;
} }
} }

View file

@ -64,8 +64,8 @@ final class PhabricatorSettingsPanelPassword
if (!$valid_token) { if (!$valid_token) {
$envelope = new PhutilOpaqueEnvelope($request->getStr('old_pw')); $envelope = new PhutilOpaqueEnvelope($request->getStr('old_pw'));
if (!$user->comparePassword($envelope)) { if (!$user->comparePassword($envelope)) {
$errors[] = 'The old password you entered is incorrect.'; $errors[] = pht('The old password you entered is incorrect.');
$e_old = 'Invalid'; $e_old = pht('Invalid');
} }
} }
@ -73,13 +73,13 @@ final class PhabricatorSettingsPanelPassword
$conf = $request->getStr('conf_pw'); $conf = $request->getStr('conf_pw');
if (strlen($pass) < $min_len) { if (strlen($pass) < $min_len) {
$errors[] = 'Your new password is too short.'; $errors[] = pht('Your new password is too short.');
$e_new = 'Too Short'; $e_new = pht('Too Short');
} }
if ($pass !== $conf) { if ($pass !== $conf) {
$errors[] = 'New password and confirmation do not match.'; $errors[] = pht('New password and confirmation do not match.');
$e_conf = 'Invalid'; $e_conf = pht('Invalid');
} }
if (!$errors) { if (!$errors) {
@ -113,19 +113,19 @@ final class PhabricatorSettingsPanelPassword
if ($request->getStr('saved')) { if ($request->getStr('saved')) {
$notice = new AphrontErrorView(); $notice = new AphrontErrorView();
$notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE); $notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE);
$notice->setTitle('Changes Saved'); $notice->setTitle(pht('Changes Saved'));
$notice->appendChild( $notice->appendChild(
phutil_tag('p', array(), 'Your password has been updated.')); phutil_tag('p', array(), pht('Your password has been updated.')));
} }
} else { } else {
$notice = new AphrontErrorView(); $notice = new AphrontErrorView();
$notice->setTitle('Error Changing Password'); $notice->setTitle(pht('Error Changing Password'));
$notice->setErrors($errors); $notice->setErrors($errors);
} }
$len_caption = null; $len_caption = null;
if ($min_len) { if ($min_len) {
$len_caption = 'Minimum password length: '.$min_len.' characters.'; $len_caption = pht('Minimum password length: %d characters.', $min_len);
} }
$form = new AphrontFormView(); $form = new AphrontFormView();
@ -136,7 +136,7 @@ final class PhabricatorSettingsPanelPassword
if (!$valid_token) { if (!$valid_token) {
$form->appendChild( $form->appendChild(
id(new AphrontFormPasswordControl()) id(new AphrontFormPasswordControl())
->setLabel('Old Password') ->setLabel(pht('Old Password'))
->setError($e_old) ->setError($e_old)
->setName('old_pw')); ->setName('old_pw'));
} }
@ -144,23 +144,23 @@ final class PhabricatorSettingsPanelPassword
$form $form
->appendChild( ->appendChild(
id(new AphrontFormPasswordControl()) id(new AphrontFormPasswordControl())
->setLabel('New Password') ->setLabel(pht('New Password'))
->setError($e_new) ->setError($e_new)
->setName('new_pw')); ->setName('new_pw'));
$form $form
->appendChild( ->appendChild(
id(new AphrontFormPasswordControl()) id(new AphrontFormPasswordControl())
->setLabel('Confirm Password') ->setLabel(pht('Confirm Password'))
->setCaption($len_caption) ->setCaption($len_caption)
->setError($e_conf) ->setError($e_conf)
->setName('conf_pw')); ->setName('conf_pw'));
$form $form
->appendChild( ->appendChild(
id(new AphrontFormSubmitControl()) id(new AphrontFormSubmitControl())
->setValue('Save')); ->setValue(pht('Save')));
$panel = new AphrontPanelView(); $panel = new AphrontPanelView();
$panel->setHeader('Change Password'); $panel->setHeader(pht('Change Password'));
$panel->appendChild($form); $panel->appendChild($form);
$panel->setNoBackground(); $panel->setNoBackground();

View file

@ -93,10 +93,10 @@ final class PhabricatorSettingsPanelProfile
$max_height = 50); $max_height = 50);
$user->setProfileImagePHID($small_xformed->getPHID()); $user->setProfileImagePHID($small_xformed->getPHID());
} else { } else {
$e_image = 'Not Supported'; $e_image = pht('Not Supported');
$errors[] = $errors[] =
'This server only supports these image formats: '. pht('This server only supports these image formats:').
implode(', ', $supported_formats).'.'; ' ' .implode(', ', $supported_formats);
} }
} }
@ -112,15 +112,15 @@ final class PhabricatorSettingsPanelProfile
$error_view = null; $error_view = null;
if ($errors) { if ($errors) {
$error_view = new AphrontErrorView(); $error_view = new AphrontErrorView();
$error_view->setTitle('Form Errors'); $error_view->setTitle(pht('Form Errors'));
$error_view->setErrors($errors); $error_view->setErrors($errors);
} else { } else {
if ($request->getStr('saved')) { if ($request->getStr('saved')) {
$error_view = new AphrontErrorView(); $error_view = new AphrontErrorView();
$error_view->setSeverity(AphrontErrorView::SEVERITY_NOTICE); $error_view->setSeverity(AphrontErrorView::SEVERITY_NOTICE);
$error_view->setTitle('Changes Saved'); $error_view->setTitle(pht('Changes Saved'));
$error_view->appendChild( $error_view->appendChild(
phutil_tag('p', array(), 'Your changes have been saved.')); phutil_tag('p', array(), pht('Your changes have been saved.')));
$error_view = $error_view->render(); $error_view = $error_view->render();
} }
} }
@ -129,9 +129,9 @@ final class PhabricatorSettingsPanelProfile
$profile_uri = PhabricatorEnv::getURI('/p/'.$user->getUsername().'/'); $profile_uri = PhabricatorEnv::getURI('/p/'.$user->getUsername().'/');
$sexes = array( $sexes = array(
PhutilPerson::SEX_UNKNOWN => 'Unknown', PhutilPerson::SEX_UNKNOWN => pht('Unknown'),
PhutilPerson::SEX_MALE => 'Male', PhutilPerson::SEX_MALE => pht('Male'),
PhutilPerson::SEX_FEMALE => 'Female', PhutilPerson::SEX_FEMALE => pht('Female'),
); );
$translations = array(); $translations = array();
@ -147,7 +147,7 @@ final class PhabricatorSettingsPanelProfile
asort($translations); asort($translations);
$default = PhabricatorEnv::newObjectFromConfig('translation.provider'); $default = PhabricatorEnv::newObjectFromConfig('translation.provider');
$translations = array( $translations = array(
'' => 'Server Default ('.$default->getName().')', '' => pht('Server Default (%s)', $default->getName()),
) + $translations; ) + $translations;
$form = new AphrontFormView(); $form = new AphrontFormView();
@ -156,25 +156,25 @@ final class PhabricatorSettingsPanelProfile
->setEncType('multipart/form-data') ->setEncType('multipart/form-data')
->appendChild( ->appendChild(
id(new AphrontFormTextControl()) id(new AphrontFormTextControl())
->setLabel('Title') ->setLabel(pht('Title'))
->setName('title') ->setName('title')
->setValue($profile->getTitle()) ->setValue($profile->getTitle())
->setCaption('Serious business title.')) ->setCaption(pht('Serious business title.')))
->appendChild( ->appendChild(
id(new AphrontFormSelectControl()) id(new AphrontFormSelectControl())
->setOptions($sexes) ->setOptions($sexes)
->setLabel('Sex') ->setLabel(pht('Sex'))
->setName('sex') ->setName('sex')
->setValue($user->getSex())) ->setValue($user->getSex()))
->appendChild( ->appendChild(
id(new AphrontFormSelectControl()) id(new AphrontFormSelectControl())
->setOptions($translations) ->setOptions($translations)
->setLabel('Translation') ->setLabel(pht('Translation'))
->setName('translation') ->setName('translation')
->setValue($user->getTranslation())) ->setValue($user->getTranslation()))
->appendChild( ->appendChild(
id(new AphrontFormMarkupControl()) id(new AphrontFormMarkupControl())
->setLabel('Profile URI') ->setLabel(pht('Profile URI'))
->setValue( ->setValue(
phutil_tag( phutil_tag(
'a', 'a',
@ -183,17 +183,18 @@ final class PhabricatorSettingsPanelProfile
), ),
$profile_uri))) $profile_uri)))
->appendChild(hsprintf( ->appendChild(hsprintf(
'<p class="aphront-form-instructions">Write something about yourself! '. '<p class="aphront-form-instructions">%s</p>',
'Make sure to include <strong>important information</strong> like '. pht('Write something about yourself! Make sure to include important ' .
'your favorite Pokemon and which Starcraft race you play.</p>')) 'information like your favorite Pokemon and which Starcraft race ' .
'you play.')))
->appendChild( ->appendChild(
id(new AphrontFormTextAreaControl()) id(new AphrontFormTextAreaControl())
->setLabel('Blurb') ->setLabel(pht('Blurb'))
->setName('blurb') ->setName('blurb')
->setValue($profile->getBlurb())) ->setValue($profile->getBlurb()))
->appendChild( ->appendChild(
id(new AphrontFormMarkupControl()) id(new AphrontFormMarkupControl())
->setLabel('Profile Image') ->setLabel(pht('Profile Image'))
->setValue( ->setValue(
phutil_tag( phutil_tag(
'img', 'img',
@ -202,28 +203,28 @@ final class PhabricatorSettingsPanelProfile
)))) ))))
->appendChild( ->appendChild(
id(new AphrontFormImageControl()) id(new AphrontFormImageControl())
->setLabel('Change Image') ->setLabel(pht('Change Image'))
->setName('image') ->setName('image')
->setError($e_image) ->setError($e_image)
->setCaption( ->setCaption(
'Supported formats: '.implode(', ', $supported_formats))); pht('Supported formats: %s', implode(', ', $supported_formats))));
if (PhabricatorEnv::getEnvConfig('security.allow-outbound-http')) { if (PhabricatorEnv::getEnvConfig('security.allow-outbound-http')) {
$form->appendChild( $form->appendChild(
id(new AphrontFormTextControl()) id(new AphrontFormTextControl())
->setLabel('Import Gravatar') ->setLabel(pht('Import Gravatar'))
->setName('gravatar') ->setName('gravatar')
->setError($e_image) ->setError($e_image)
->setCaption('Enter gravatar email address')); ->setCaption(pht('Enter gravatar email address')));
} }
$form->appendChild( $form->appendChild(
id(new AphrontFormSubmitControl()) id(new AphrontFormSubmitControl())
->setValue('Save') ->setValue(pht('Save'))
->addCancelButton('/p/'.$user->getUsername().'/')); ->addCancelButton('/p/'.$user->getUsername().'/'));
$panel = new AphrontPanelView(); $panel = new AphrontPanelView();
$panel->setHeader('Edit Profile Details'); $panel->setHeader(pht('Edit Profile Details'));
$panel->appendChild($form); $panel->appendChild($form);
$panel->setNoBackground(); $panel->setNoBackground();

View file

@ -58,8 +58,8 @@ final class PhabricatorSettingsPanelSSHKeys
$entire_key = $request->getStr('key'); $entire_key = $request->getStr('key');
if (!strlen($entire_key)) { if (!strlen($entire_key)) {
$errors[] = 'You must provide an SSH Public Key.'; $errors[] = pht('You must provide an SSH Public Key.');
$e_key = 'Required'; $e_key = pht('Required');
} else { } else {
$parts = str_replace("\n", '', trim($entire_key)); $parts = str_replace("\n", '', trim($entire_key));
$parts = preg_split('/\s+/', $parts); $parts = preg_split('/\s+/', $parts);
@ -71,19 +71,19 @@ final class PhabricatorSettingsPanelSSHKeys
if (preg_match('/private\s*key/i', $entire_key)) { if (preg_match('/private\s*key/i', $entire_key)) {
// Try to give the user a better error message if it looks like // Try to give the user a better error message if it looks like
// they uploaded a private key. // they uploaded a private key.
$e_key = 'Invalid'; $e_key = pht('Invalid');
$errors[] = 'Provide your public key, not your private key!'; $errors[] = pht('Provide your public key, not your private key!');
} else { } else {
$e_key = 'Invalid'; $e_key = pht('Invalid');
$errors[] = 'Provided public key is not properly formatted.'; $errors[] = pht('Provided public key is not properly formatted.');
} }
} }
if (!$errors) { if (!$errors) {
list($type, $body, $comment) = $parts; list($type, $body, $comment) = $parts;
if (!preg_match('/^ssh-dsa|ssh-rsa$/', $type)) { if (!preg_match('/^ssh-dsa|ssh-rsa$/', $type)) {
$e_key = 'Invalid'; $e_key = pht('Invalid');
$errors[] = 'Public key should be "ssh-dsa" or "ssh-rsa".'; $errors[] = pht('Public key should be "ssh-dsa" or "ssh-rsa".');
} else { } else {
$key->setKeyType($type); $key->setKeyType($type);
$key->setKeyBody($body); $key->setKeyBody($body);
@ -96,8 +96,8 @@ final class PhabricatorSettingsPanelSSHKeys
} }
if (!strlen($key->getName())) { if (!strlen($key->getName())) {
$errors[] = 'You must name this public key.'; $errors[] = pht('You must name this public key.');
$e_name = 'Required'; $e_name = pht('Required');
} else { } else {
$e_name = null; $e_name = null;
} }
@ -108,9 +108,9 @@ final class PhabricatorSettingsPanelSSHKeys
return id(new AphrontRedirectResponse()) return id(new AphrontRedirectResponse())
->setURI($this->getPanelURI()); ->setURI($this->getPanelURI());
} catch (AphrontQueryDuplicateKeyException $ex) { } catch (AphrontQueryDuplicateKeyException $ex) {
$e_key = 'Duplicate'; $e_key = pht('Duplicate');
$errors[] = 'This public key is already associated with a user '. $errors[] = pht('This public key is already associated with a user '.
'account.'; 'account.');
} }
} }
} }
@ -118,18 +118,18 @@ final class PhabricatorSettingsPanelSSHKeys
$error_view = null; $error_view = null;
if ($errors) { if ($errors) {
$error_view = new AphrontErrorView(); $error_view = new AphrontErrorView();
$error_view->setTitle('Form Errors'); $error_view->setTitle(pht('Form Errors'));
$error_view->setErrors($errors); $error_view->setErrors($errors);
} }
$is_new = !$key->getID(); $is_new = !$key->getID();
if ($is_new) { if ($is_new) {
$header = 'Add New SSH Public Key'; $header = pht('Add New SSH Public Key');
$save = 'Add Key'; $save = pht('Add Key');
} else { } else {
$header = 'Edit SSH Public Key'; $header = pht('Edit SSH Public Key');
$save = 'Save Changes'; $save = pht('Save Changes');
} }
$form = id(new AphrontFormView()) $form = id(new AphrontFormView())
@ -137,13 +137,13 @@ final class PhabricatorSettingsPanelSSHKeys
->addHiddenInput('edit', $is_new ? 'true' : $key->getID()) ->addHiddenInput('edit', $is_new ? 'true' : $key->getID())
->appendChild( ->appendChild(
id(new AphrontFormTextControl()) id(new AphrontFormTextControl())
->setLabel('Name') ->setLabel(pht('Name'))
->setName('name') ->setName('name')
->setValue($key->getName()) ->setValue($key->getName())
->setError($e_name)) ->setError($e_name))
->appendChild( ->appendChild(
id(new AphrontFormTextAreaControl()) id(new AphrontFormTextAreaControl())
->setLabel('Public Key') ->setLabel(pht('Public Key'))
->setName('key') ->setName('key')
->setValue($entire_key) ->setValue($entire_key)
->setError($e_key)) ->setError($e_key))
@ -193,19 +193,19 @@ final class PhabricatorSettingsPanelSSHKeys
'class' => 'small grey button', 'class' => 'small grey button',
'sigil' => 'workflow', 'sigil' => 'workflow',
), ),
'Delete'), pht('Delete')),
); );
} }
$table = new AphrontTableView($rows); $table = new AphrontTableView($rows);
$table->setNoDataString("You haven't added any SSH Public Keys."); $table->setNoDataString(pht("You haven't added any SSH Public Keys."));
$table->setHeaders( $table->setHeaders(
array( array(
'Name', pht('Name'),
'Comment', pht('Comment'),
'Type', pht('Type'),
'Created', pht('Created'),
'Time', pht('Time'),
'', '',
)); ));
$table->setColumnClasses( $table->setColumnClasses(
@ -226,8 +226,8 @@ final class PhabricatorSettingsPanelSSHKeys
'href' => $this->getPanelURI('?edit=true'), 'href' => $this->getPanelURI('?edit=true'),
'class' => 'green button', 'class' => 'green button',
), ),
'Add New Public Key')); pht('Add New Public Key')));
$panel->setHeader('SSH Public Keys'); $panel->setHeader(pht('SSH Public Keys'));
$panel->appendChild($table); $panel->appendChild($table);
$panel->setNoBackground(); $panel->setNoBackground();
@ -251,12 +251,12 @@ final class PhabricatorSettingsPanelSSHKeys
$dialog = id(new AphrontDialogView()) $dialog = id(new AphrontDialogView())
->setUser($user) ->setUser($user)
->addHiddenInput('delete', $key->getID()) ->addHiddenInput('delete', $key->getID())
->setTitle('Really delete SSH Public Key?') ->setTitle(pht('Really delete SSH Public Key?'))
->appendChild(phutil_tag('p', array(), pht( ->appendChild(phutil_tag('p', array(), pht(
'The key "%s" will be permanently deleted, and you will not longer be '. 'The key "%s" will be permanently deleted, and you will not longer be '.
'able to use the corresponding private key to authenticate.', 'able to use the corresponding private key to authenticate.',
$name))) $name)))
->addSubmitButton('Delete Public Key') ->addSubmitButton(pht('Delete Public Key'))
->addCancelButton($this->getPanelURI()); ->addCancelButton($this->getPanelURI());
return id(new AphrontDialogResponse()) return id(new AphrontDialogResponse())

View file

@ -40,27 +40,27 @@ final class PhabricatorSettingsPanelSearchPreferences
id(new AphrontFormCheckboxControl()) id(new AphrontFormCheckboxControl())
->addCheckbox($pref_jump, ->addCheckbox($pref_jump,
1, 1,
'Enable jump nav functionality in all search boxes.', pht('Enable jump nav functionality in all search boxes.'),
$preferences->getPreference($pref_jump, 1)) $preferences->getPreference($pref_jump, 1))
->addCheckbox($pref_shortcut, ->addCheckbox($pref_shortcut,
1, 1,
"Press '/' to focus the search input.", pht("Press '/' to focus the search input."),
$preferences->getPreference($pref_shortcut, 1))) $preferences->getPreference($pref_shortcut, 1)))
->appendChild( ->appendChild(
id(new AphrontFormSubmitControl()) id(new AphrontFormSubmitControl())
->setValue('Save')); ->setValue(pht('Save')));
$panel = new AphrontPanelView(); $panel = new AphrontPanelView();
$panel->setHeader('Search Preferences'); $panel->setHeader(pht('Search Preferences'));
$panel->appendChild($form); $panel->appendChild($form);
$panel->setNoBackground(); $panel->setNoBackground();
$error_view = null; $error_view = null;
if ($request->getStr('saved') === 'true') { if ($request->getStr('saved') === 'true') {
$error_view = id(new AphrontErrorView()) $error_view = id(new AphrontErrorView())
->setTitle('Preferences Saved') ->setTitle(pht('Preferences Saved'))
->setSeverity(AphrontErrorView::SEVERITY_NOTICE) ->setSeverity(AphrontErrorView::SEVERITY_NOTICE)
->setErrors(array('Your preferences have been saved.')); ->setErrors(array(pht('Your preferences have been saved.')));
} }
return array( return array(