1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-30 09:20:58 +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',
'delete/(?P<id>[1-9]\d*)/' => 'PhrictionDeleteController',
'new/' => 'PhrictionNewController',
'move/(?P<id>[1-9]\d*)/' => 'PhrictionMoveController',
'preview/' => 'PhrictionDocumentPreviewController',
'diff/(?P<id>[1-9]\d*)/' => 'PhrictionDiffController',

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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