@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Modernize People

Summary: Adds Crumbs, pht's, and checkout out mobile.

Test Plan: Added, removed people. Changed roles, checked iOS and Chrome.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D5052

+261 -196
+15 -10
src/applications/people/controller/PhabricatorEmailVerificationController.php
··· 29 29 array( 30 30 'href' => '/', 31 31 ), 32 - 'Continue to Phabricator'); 32 + pht('Continue to Phabricator')); 33 33 $home_link = hsprintf( 34 34 '<br /><p><strong>%s</strong></p>', 35 35 $home_link); ··· 39 39 array( 40 40 'href' => '/settings/panel/email/', 41 41 ), 42 - 'Return to Email Settings'); 42 + pht('Return to Email Settings')); 43 43 $settings_link = hsprintf( 44 44 '<br /><p><strong>%s</strong></p>', 45 45 $settings_link); 46 46 47 47 if (!$email) { 48 48 $content = id(new AphrontErrorView()) 49 - ->setTitle('Unable To Verify') 49 + ->setTitle(pht('Unable To Verify')) 50 50 ->appendChild(phutil_tag( 51 51 'p', 52 52 array(), 53 - 'The verification code is incorrect, the email address has been '. 53 + pht('The verification code is incorrect, the email address has been '. 54 54 'removed, or the email address is owned by another user. Make '. 55 - 'sure you followed the link in the email correctly.')); 55 + 'sure you followed the link in the email correctly.'))); 56 56 } else if ($email->getIsVerified()) { 57 + $inst = pht('This email address has already been verified.'); 57 58 $content = id(new AphrontErrorView()) 58 59 ->setSeverity(AphrontErrorView::SEVERITY_NOTICE) 59 - ->setTitle('Address Already Verified') 60 + ->setTitle(pht('Address Already Verified')) 60 61 ->appendChild(hsprintf( 61 - '<p>This email address has already been verified.</p>%s', 62 + '<p>%s</p>%s', 63 + $inst, 62 64 $settings_link)); 63 65 } else { 64 66 ··· 67 69 $email->save(); 68 70 unset($guard); 69 71 72 + $inst = pht('This email address has now been verified. Thanks!'); 70 73 $content = id(new AphrontErrorView()) 71 74 ->setSeverity(AphrontErrorView::SEVERITY_NOTICE) 72 - ->setTitle('Address Verified') 75 + ->setTitle(pht('Address Verified')) 73 76 ->appendChild(hsprintf( 74 - '<p>This email address has now been verified. Thanks!</p>%s%s', 77 + '<p>%s</p>%s%s', 78 + $inst, 75 79 $home_link, 76 80 $settings_link)); 77 81 } ··· 79 83 return $this->buildApplicationPage( 80 84 $content, 81 85 array( 82 - 'title' => 'Verify Email', 86 + 'title' => pht('Verify Email'), 87 + 'device' => true, 83 88 )); 84 89 } 85 90
+27 -7
src/applications/people/controller/PhabricatorPeopleController.php
··· 9 9 $is_admin = $this->getRequest()->getUser()->getIsAdmin(); 10 10 11 11 if ($is_admin) { 12 - $nav->addLabel('Create Users'); 13 - $nav->addFilter('edit', 'Create New User'); 12 + $nav->addLabel(pht('User Administration')); 13 + $nav->addFilter('edit', pht('Create New User')); 14 14 if (PhabricatorEnv::getEnvConfig('ldap.auth-enabled') === true) { 15 - $nav->addFilter('ldap', 'Import from LDAP'); 15 + $nav->addFilter('ldap', pht('Import from LDAP')); 16 16 } 17 17 } 18 18 19 - $nav->addLabel('Directory'); 20 - $nav->addFilter('people', 'User Directory', $this->getApplicationURI()); 19 + $nav->addFilter('people', 20 + pht('User Directory'), 21 + $this->getApplicationURI()); 21 22 22 23 if ($is_admin) { 23 - $nav->addLabel('Logs'); 24 - $nav->addFilter('logs', 'Activity Logs'); 24 + $nav->addFilter('logs', pht('Activity Logs')); 25 25 } 26 26 27 27 return $nav; 28 + } 29 + 30 + public function buildApplicationMenu() { 31 + return $this->buildSideNavView()->getMenu(); 32 + } 33 + 34 + public function buildApplicationCrumbs() { 35 + $crumbs = parent::buildApplicationCrumbs(); 36 + // I'm sure this copypasty is wrong. 37 + $is_admin = $this->getRequest()->getUser()->getIsAdmin(); 38 + 39 + if ($is_admin) { 40 + $crumbs->addAction( 41 + id(new PhabricatorMenuItemView()) 42 + ->setName(pht('Create New User')) 43 + ->setHref($this->getApplicationURI('edit')) 44 + ->setIcon('create')); 45 + } 46 + 47 + return $crumbs; 28 48 } 29 49 30 50 }
+149 -117
src/applications/people/controller/PhabricatorPeopleEditController.php
··· 20 20 $request = $this->getRequest(); 21 21 $admin = $request->getUser(); 22 22 23 + $crumbs = $this->buildApplicationCrumbs($this->buildSideNavView()); 23 24 if ($this->id) { 24 25 $user = id(new PhabricatorUser())->load($this->id); 25 26 if (!$user) { 26 27 return new Aphront404Response(); 27 28 } 28 29 $base_uri = '/people/edit/'.$user->getID().'/'; 30 + $crumbs->addCrumb( 31 + id(new PhabricatorCrumbView()) 32 + ->setName(pht('Edit User')) 33 + ->setHref('/people/edit/')); 34 + $crumbs->addCrumb( 35 + id(new PhabricatorCrumbView()) 36 + ->setName($user->getFullName()) 37 + ->setHref($base_uri)); 29 38 } else { 30 39 $user = new PhabricatorUser(); 31 40 $base_uri = '/people/edit/'; 41 + $crumbs->addCrumb( 42 + id(new PhabricatorCrumbView()) 43 + ->setName(pht('Create New User')) 44 + ->setHref($base_uri)); 32 45 } 33 46 34 47 $nav = new AphrontSideNavFilterView(); 35 48 $nav->setBaseURI(new PhutilURI($base_uri)); 36 - $nav->addLabel('User Information'); 37 - $nav->addFilter('basic', 'Basic Information'); 38 - $nav->addFilter('role', 'Edit Roles'); 39 - $nav->addFilter('cert', 'Conduit Certificate'); 40 - $nav->addFilter('profile', 'View Profile', '/p/'.$user->getUsername().'/'); 41 - $nav->addLabel('Special'); 42 - $nav->addFilter('rename', 'Change Username'); 43 - $nav->addFilter('delete', 'Delete User'); 49 + $nav->addLabel(pht('User Information')); 50 + $nav->addFilter('basic', pht('Basic Information')); 51 + $nav->addFilter('role', pht('Edit Roles')); 52 + $nav->addFilter('cert', pht('Conduit Certificate')); 53 + $nav->addFilter('profile', 54 + pht('View Profile'), '/p/'.$user->getUsername().'/'); 55 + $nav->addLabel(pht('Special')); 56 + $nav->addFilter('rename', pht('Change Username')); 57 + $nav->addFilter('delete', pht('Delete User')); 44 58 45 59 if (!$user->getID()) { 46 60 $this->view = 'basic'; ··· 53 67 if ($request->getStr('saved')) { 54 68 $notice = new AphrontErrorView(); 55 69 $notice->setSeverity(AphrontErrorView::SEVERITY_NOTICE); 56 - $notice->setTitle('Changes Saved'); 70 + $notice->setTitle(pht('Changes Saved')); 57 71 $notice->appendChild( 58 - phutil_tag('p', array(), 'Your changes were saved.')); 72 + phutil_tag('p', array(), pht('Your changes were saved.'))); 59 73 $content[] = $notice; 60 74 } 61 75 ··· 93 107 $nav->appendChild($content); 94 108 } 95 109 110 + $nav->setCrumbs($crumbs); 96 111 return $this->buildApplicationPage( 97 112 $nav, 98 113 array( 99 - 'title' => 'Edit User', 114 + 'title' => pht('Edit User'), 115 + 'device' => true, 100 116 )); 101 117 } 102 118 ··· 123 139 124 140 $new_email = $request->getStr('email'); 125 141 if (!strlen($new_email)) { 126 - $errors[] = 'Email is required.'; 127 - $e_email = 'Required'; 142 + $errors[] = pht('Email is required.'); 143 + $e_email = pht('Required'); 128 144 } else if (!PhabricatorUserEmail::isAllowedAddress($new_email)) { 129 - $e_email = 'Invalid'; 145 + $e_email = pht('Invalid'); 130 146 $errors[] = PhabricatorUserEmail::describeAllowedAddresses(); 131 147 } else { 132 148 $e_email = null; ··· 136 152 $user->setRealName($request->getStr('realname')); 137 153 138 154 if (!strlen($user->getUsername())) { 139 - $errors[] = "Username is required."; 140 - $e_username = 'Required'; 155 + $errors[] = pht("Username is required."); 156 + $e_username = pht('Required'); 141 157 } else if (!PhabricatorUser::validateUsername($user->getUsername())) { 142 158 $errors[] = PhabricatorUser::describeValidUsername(); 143 - $e_username = 'Invalid'; 159 + $e_username = pht('Invalid'); 144 160 } else { 145 161 $e_username = null; 146 162 } 147 163 148 164 if (!strlen($user->getRealName())) { 149 - $errors[] = 'Real name is required.'; 150 - $e_realname = 'Required'; 165 + $errors[] = pht('Real name is required.'); 166 + $e_realname = pht('Required'); 151 167 } else { 152 168 $e_realname = null; 153 169 } ··· 184 200 ->setURI('/people/edit/'.$user->getID().'/?saved=true'); 185 201 return $response; 186 202 } catch (AphrontQueryDuplicateKeyException $ex) { 187 - $errors[] = 'Username and email must be unique.'; 203 + $errors[] = pht('Username and email must be unique.'); 188 204 189 205 $same_username = id(new PhabricatorUser()) 190 206 ->loadOneWhere('username = %s', $user->getUsername()); ··· 192 208 ->loadOneWhere('address = %s', $new_email); 193 209 194 210 if ($same_username) { 195 - $e_username = 'Duplicate'; 211 + $e_username = pht('Duplicate'); 196 212 } 197 213 198 214 if ($same_email) { 199 - $e_email = 'Duplicate'; 215 + $e_email = pht('Duplicate'); 200 216 } 201 217 } 202 218 } ··· 205 221 $error_view = null; 206 222 if ($errors) { 207 223 $error_view = id(new AphrontErrorView()) 208 - ->setTitle('Form Errors') 224 + ->setTitle(pht('Form Errors')) 209 225 ->setErrors($errors); 210 226 } 211 227 ··· 226 242 $form 227 243 ->appendChild( 228 244 id(new AphrontFormTextControl()) 229 - ->setLabel('Username') 245 + ->setLabel(pht('Username')) 230 246 ->setName('username') 231 247 ->setValue($user->getUsername()) 232 248 ->setError($e_username) 233 249 ->setDisabled($is_immutable)) 234 250 ->appendChild( 235 251 id(new AphrontFormTextControl()) 236 - ->setLabel('Real Name') 252 + ->setLabel(pht('Real Name')) 237 253 ->setName('realname') 238 254 ->setValue($user->getRealName()) 239 255 ->setError($e_realname)); ··· 241 257 if (!$user->getID()) { 242 258 $form->appendChild( 243 259 id(new AphrontFormTextControl()) 244 - ->setLabel('Email') 260 + ->setLabel(pht('Email')) 245 261 ->setName('email') 246 262 ->setDisabled($is_immutable) 247 263 ->setValue($new_email) ··· 250 266 } else { 251 267 $email = $user->loadPrimaryEmail(); 252 268 if ($email) { 253 - $status = $email->getIsVerified() ? 'Verified' : 'Unverified'; 269 + $status = $email->getIsVerified() ? 270 + pht('Verified') : pht('Unverified'); 254 271 } else { 255 - $status = 'No Email Address'; 272 + $status = pht('No Email Address'); 256 273 } 257 274 258 275 $form->appendChild( 259 276 id(new AphrontFormStaticControl()) 260 - ->setLabel('Email') 277 + ->setLabel(pht('Email')) 261 278 ->setValue($status)); 262 279 263 280 $form->appendChild( ··· 265 282 ->addCheckbox( 266 283 'welcome', 267 284 1, 268 - 'Re-send "Welcome to Phabricator" email.', 285 + pht('Re-send "Welcome to Phabricator" email.'), 269 286 false)); 270 287 271 288 } ··· 276 293 $form 277 294 ->appendChild( 278 295 id(new AphrontFormSelectControl()) 279 - ->setLabel('Role') 296 + ->setLabel(pht('Role')) 280 297 ->setName('role') 281 298 ->setValue('user') 282 299 ->setOptions( 283 300 array( 284 - 'user' => 'Normal User', 285 - 'agent' => 'System Agent', 301 + 'user' => pht('Normal User'), 302 + 'agent' => pht('System Agent'), 286 303 )) 287 304 ->setCaption( 288 - 'You can create a "system agent" account for bots, scripts, '. 289 - 'etc.')) 305 + pht('You can create a "system agent" account for bots, '. 306 + 'scripts, etc.'))) 290 307 ->appendChild( 291 308 id(new AphrontFormCheckboxControl()) 292 309 ->addCheckbox( 293 310 'welcome', 294 311 1, 295 - 'Send "Welcome to Phabricator" email.', 312 + pht('Send "Welcome to Phabricator" email.'), 296 313 $welcome_checked)); 297 314 } else { 298 315 $roles = array(); 299 316 300 317 if ($user->getIsSystemAgent()) { 301 - $roles[] = 'System Agent'; 318 + $roles[] = pht('System Agent'); 302 319 } 303 320 if ($user->getIsAdmin()) { 304 - $roles[] = 'Admin'; 321 + $roles[] = pht('Admin'); 305 322 } 306 323 if ($user->getIsDisabled()) { 307 - $roles[] = 'Disabled'; 324 + $roles[] = pht('Disabled'); 308 325 } 309 326 310 327 if (!$roles) { 311 - $roles[] = 'Normal User'; 328 + $roles[] = pht('Normal User'); 312 329 } 313 330 314 331 $roles = implode(', ', $roles); ··· 322 339 $form 323 340 ->appendChild( 324 341 id(new AphrontFormSubmitControl()) 325 - ->setValue('Save')); 342 + ->setValue(pht('Save'))); 326 343 327 344 $panel = new AphrontPanelView(); 328 345 if ($user->getID()) { 329 - $panel->setHeader('Edit User'); 346 + $panel->setHeader(pht('Edit User')); 330 347 } else { 331 - $panel->setHeader('Create New User'); 348 + $panel->setHeader(pht('Create New User')); 332 349 } 333 350 334 351 $panel->appendChild($form); 352 + $panel->setNoBackground(); 335 353 $panel->setWidth(AphrontPanelView::WIDTH_FORM); 336 354 337 355 return array($error_view, $panel); ··· 355 373 $logs = array(); 356 374 357 375 if ($is_self) { 358 - $errors[] = "You can not edit your own role."; 376 + $errors[] = pht("You can not edit your own role."); 359 377 } else { 360 378 $new_admin = (bool)$request->getBool('is_admin'); 361 379 $old_admin = (bool)$user->getIsAdmin(); ··· 383 401 $error_view = null; 384 402 if ($errors) { 385 403 $error_view = id(new AphrontErrorView()) 386 - ->setTitle('Form Errors') 404 + ->setTitle(pht('Form Errors')) 387 405 ->setErrors($errors); 388 406 } 389 407 ··· 393 411 ->setAction($request->getRequestURI()->alter('saved', null)); 394 412 395 413 if ($is_self) { 414 + $inst = pht('NOTE: You can not edit your own role.'); 396 415 $form->appendChild(hsprintf( 397 - '<p class="aphront-form-instructions">NOTE: You can not edit your own '. 398 - 'role.</p>')); 416 + '<p class="aphront-form-instructions">%s</p>', $inst)); 399 417 } 400 418 401 419 $form ··· 405 423 ->addCheckbox( 406 424 'is_admin', 407 425 1, 408 - 'Administrator', 426 + pht('Administrator'), 409 427 $user->getIsAdmin()) 410 428 ->setDisabled($is_self)) 411 429 ->appendChild( ··· 413 431 ->addCheckbox( 414 432 'is_disabled', 415 433 1, 416 - 'Disabled', 434 + pht('Disabled'), 417 435 $user->getIsDisabled()) 418 436 ->setDisabled($is_self)) 419 437 ->appendChild( ··· 421 439 ->addCheckbox( 422 440 'is_agent', 423 441 1, 424 - 'System Agent (Bot/Script User)', 442 + pht('System Agent (Bot/Script User)'), 425 443 $user->getIsSystemAgent()) 426 444 ->setDisabled(true)); 427 445 ··· 429 447 $form 430 448 ->appendChild( 431 449 id(new AphrontFormSubmitControl()) 432 - ->setValue('Edit Role')); 450 + ->setValue(pht('Edit Role'))); 433 451 } 434 452 435 453 $panel = new AphrontPanelView(); 436 - $panel->setHeader('Edit Role'); 454 + $panel->setHeader(pht('Edit Role')); 437 455 $panel->setWidth(AphrontPanelView::WIDTH_FORM); 456 + $panel->setNoBackground(); 438 457 $panel->appendChild($form); 439 458 440 459 return array($error_view, $panel); ··· 444 463 $request = $this->getRequest(); 445 464 $admin = $request->getUser(); 446 465 466 + $inst = pht('You can use this certificate '. 467 + 'to write scripts or bots which interface with Phabricator over '. 468 + 'Conduit.'); 447 469 $form = new AphrontFormView(); 448 470 $form 449 471 ->setUser($admin) 450 472 ->setAction($request->getRequestURI()) 451 473 ->appendChild(hsprintf( 452 - '<p class="aphront-form-instructions">You can use this certificate '. 453 - 'to write scripts or bots which interface with Phabricator over '. 454 - 'Conduit.</p>')); 474 + '<p class="aphront-form-instructions">%s</p>', $inst)); 455 475 456 476 if ($user->getIsSystemAgent()) { 457 477 $form 458 478 ->appendChild( 459 479 id(new AphrontFormTextControl()) 460 - ->setLabel('Username') 480 + ->setLabel(pht('Username')) 461 481 ->setValue($user->getUsername())) 462 482 ->appendChild( 463 483 id(new AphrontFormTextAreaControl()) 464 - ->setLabel('Certificate') 484 + ->setLabel(pht('Certificate')) 465 485 ->setValue($user->getConduitCertificate())); 466 486 } else { 467 487 $form->appendChild( 468 488 id(new AphrontFormStaticControl()) 469 - ->setLabel('Certificate') 489 + ->setLabel(pht('Certificate')) 470 490 ->setValue( 471 - 'You may only view the certificates of System Agents.')); 491 + pht('You may only view the certificates of System Agents.'))); 472 492 } 473 493 474 494 $panel = new AphrontPanelView(); 475 - $panel->setHeader('Conduit Certificate'); 495 + $panel->setHeader(pht('Conduit Certificate')); 476 496 $panel->setWidth(AphrontPanelView::WIDTH_FORM); 477 - 497 + $panel->setNoBackground(); 478 498 $panel->appendChild($form); 479 499 480 500 return array($panel); ··· 492 512 493 513 $username = $request->getStr('username'); 494 514 if (!strlen($username)) { 495 - $e_username = 'Required'; 496 - $errors[] = 'New username is required.'; 515 + $e_username = pht('Required'); 516 + $errors[] = pht('New username is required.'); 497 517 } else if ($username == $user->getUsername()) { 498 - $e_username = 'Invalid'; 499 - $errors[] = 'New username must be different from old username.'; 518 + $e_username = pht('Invalid'); 519 + $errors[] = pht('New username must be different from old username.'); 500 520 } else if (!PhabricatorUser::validateUsername($username)) { 501 - $e_username = 'Invalid'; 521 + $e_username = pht('Invalid'); 502 522 $errors[] = PhabricatorUser::describeValidUsername(); 503 523 } 504 524 ··· 512 532 return id(new AphrontRedirectResponse()) 513 533 ->setURI($request->getRequestURI()->alter('saved', true)); 514 534 } catch (AphrontQueryDuplicateKeyException $ex) { 515 - $e_username = 'Not Unique'; 516 - $errors[] = 'Another user already has that username.'; 535 + $e_username = pht('Not Unique'); 536 + $errors[] = pht('Another user already has that username.'); 517 537 } 518 538 } 519 539 } 520 540 521 541 if ($errors) { 522 542 $errors = id(new AphrontErrorView()) 523 - ->setTitle('Form Errors') 543 + ->setTitle(pht('Form Errors')) 524 544 ->setErrors($errors); 525 545 } else { 526 546 $errors = null; 527 547 } 528 548 549 + $inst1 = pht('Be careful when renaming users!'); 550 + $inst2 = pht('The old username will no longer be tied to the user, so '. 551 + 'anything which uses it (like old commit messages) will no longer '. 552 + 'associate correctly. And if you give a user a username which some '. 553 + 'other user used to have, username lookups will begin returning '. 554 + 'the wrong user.'); 555 + $inst3 = pht('It is generally safe to rename newly created users (and '. 556 + 'test users and so on), but less safe to rename established users '. 557 + 'and unsafe to reissue a username.'); 558 + $inst4 = pht('Users who rely on password auth will need to reset their '. 559 + 'passwordafter their username is changed (their username is part '. 560 + 'of the salt in the password hash). They will receive an email '. 561 + 'with instructions on how to do this.'); 562 + 529 563 $form = new AphrontFormView(); 530 564 $form 531 565 ->setUser($admin) 532 566 ->setAction($request->getRequestURI()) 533 567 ->appendChild(hsprintf( 534 568 '<p class="aphront-form-instructions">'. 535 - '<strong>Be careful when renaming users!</strong> '. 536 - 'The old username will no longer be tied to the user, so anything '. 537 - 'which uses it (like old commit messages) will no longer associate '. 538 - 'correctly. And if you give a user a username which some other user '. 539 - 'used to have, username lookups will begin returning the wrong '. 540 - 'user.'. 569 + '<strong>%s</strong> '. 570 + '%s'. 541 571 '</p>'. 542 572 '<p class="aphront-form-instructions">'. 543 - 'It is generally safe to rename newly created users (and test users '. 544 - 'and so on), but less safe to rename established users and unsafe '. 545 - 'to reissue a username.'. 573 + '%s'. 546 574 '</p>'. 547 575 '<p class="aphront-form-instructions">'. 548 - 'Users who rely on password auth will need to reset their password '. 549 - 'after their username is changed (their username is part of the '. 550 - 'salt in the password hash). They will receive an email with '. 551 - 'instructions on how to do this.'. 552 - '</p>')) 576 + '%s'. 577 + '</p>', $inst1, $inst2, $inst3, $inst4)) 553 578 ->appendChild( 554 579 id(new AphrontFormStaticControl()) 555 - ->setLabel('Old Username') 580 + ->setLabel(pht('Old Username')) 556 581 ->setValue($user->getUsername())) 557 582 ->appendChild( 558 583 id(new AphrontFormTextControl()) 559 - ->setLabel('New Username') 584 + ->setLabel(pht('New Username')) 560 585 ->setValue($username) 561 586 ->setName('username') 562 587 ->setError($e_username)) 563 588 ->appendChild( 564 589 id(new AphrontFormSubmitControl()) 565 - ->setValue('Change Username')); 590 + ->setValue(pht('Change Username'))); 566 591 567 592 $panel = new AphrontPanelView(); 568 - $panel->setHeader('Change Username'); 593 + $panel->setHeader(pht('Change Username')); 569 594 $panel->setWidth(AphrontPanelView::WIDTH_FORM); 595 + $panel->setNoBackground(); 570 596 $panel->appendChild($form); 571 597 572 598 return array($errors, $panel); ··· 576 602 $request = $this->getRequest(); 577 603 $admin = $request->getUser(); 578 604 605 + $far1 = pht('As you stare into the gaping maw of the abyss, something '. 606 + 'hold you back.'); 607 + $far2 = pht('You can not delete your own account.'); 608 + 579 609 if ($user->getPHID() == $admin->getPHID()) { 580 610 $error = new AphrontErrorView(); 581 - $error->setTitle('You Shall Journey No Farther'); 611 + $error->setTitle(pht('You Shall Journey No Farther')); 582 612 $error->appendChild(hsprintf( 583 - '<p>As you stare into the gaping maw of the abyss, something holds '. 584 - 'you back.</p>'. 585 - '<p>You can not delete your own account.</p>')); 613 + '<p>%s</p><p>%s</p>', $far1, $far2)); 586 614 return $error; 587 615 } 588 616 ··· 594 622 595 623 $username = $request->getStr('username'); 596 624 if (!strlen($username)) { 597 - $e_username = 'Required'; 598 - $errors[] = 'You must type the username to confirm deletion.'; 625 + $e_username = pht('Required'); 626 + $errors[] = pht('You must type the username to confirm deletion.'); 599 627 } else if ($username != $user->getUsername()) { 600 - $e_username = 'Invalid'; 601 - $errors[] = 'You must type the username correctly.'; 628 + $e_username = pht('Invalid'); 629 + $errors[] = pht('You must type the username correctly.'); 602 630 } 603 631 604 632 if (!$errors) { ··· 612 640 613 641 if ($errors) { 614 642 $errors = id(new AphrontErrorView()) 615 - ->setTitle('Form Errors') 643 + ->setTitle(pht('Form Errors')) 616 644 ->setErrors($errors); 617 645 } else { 618 646 $errors = null; 619 647 } 620 648 649 + $str1 = pht('Be careful when deleting users!'); 650 + $str2 = pht('If this user interacted with anything, it is generally '. 651 + 'better to disable them, not delete them. If you delete them, it will '. 652 + 'no longer be possible to search for their objects, for example, '. 653 + 'and you will lose other information about their history. Disabling '. 654 + 'them instead will prevent them from logging in but not destroy '. 655 + 'any of their data.'); 656 + $str3 = pht('It is generally safe to delete newly created users (and '. 657 + 'test users and so on), but less safe to delete established users. '. 658 + 'If possible, disable them instead.'); 659 + 621 660 $form = new AphrontFormView(); 622 661 $form 623 662 ->setUser($admin) 624 663 ->setAction($request->getRequestURI()) 625 664 ->appendChild(hsprintf( 626 665 '<p class="aphront-form-instructions">'. 627 - '<strong>Be careful when deleting users!</strong> '. 628 - 'If this user interacted with anything, it is generally better '. 629 - 'to disable them, not delete them. If you delete them, it will '. 630 - 'no longer be possible to search for their objects, for example, '. 631 - 'and you will lose other information about their history. Disabling '. 632 - 'them instead will prevent them from logging in but not destroy '. 633 - 'any of their data.'. 666 + '<strong>%s</strong> %s'. 634 667 '</p>'. 635 668 '<p class="aphront-form-instructions">'. 636 - 'It is generally safe to delete newly created users (and test users '. 637 - 'and so on), but less safe to delete established users. If '. 638 - 'possible, disable them instead.'. 639 - '</p>')) 669 + '%s'. 670 + '</p>', $str1, $str2, $str3)) 640 671 ->appendChild( 641 672 id(new AphrontFormStaticControl()) 642 - ->setLabel('Username') 673 + ->setLabel(pht('Username')) 643 674 ->setValue($user->getUsername())) 644 675 ->appendChild( 645 676 id(new AphrontFormTextControl()) 646 - ->setLabel('Confirm') 677 + ->setLabel(pht('Confirm')) 647 678 ->setValue($username) 648 679 ->setName('username') 649 - ->setCaption("Type the username again to confirm deletion.") 680 + ->setCaption(pht("Type the username again to confirm deletion.")) 650 681 ->setError($e_username)) 651 682 ->appendChild( 652 683 id(new AphrontFormSubmitControl()) 653 - ->setValue('Delete User')); 684 + ->setValue(pht('Delete User'))); 654 685 655 686 $panel = new AphrontPanelView(); 656 - $panel->setHeader('Delete User'); 687 + $panel->setHeader(pht('Delete User')); 657 688 $panel->setWidth(AphrontPanelView::WIDTH_FORM); 689 + $panel->setNoBackground(); 658 690 $panel->appendChild($form); 659 691 660 692 return array($errors, $panel); ··· 668 700 'article/User_Guide_Account_Roles.html'), 669 701 'target' => '_blank', 670 702 ), 671 - 'User Guide: Account Roles'); 703 + pht('User Guide: Account Roles')); 672 704 673 - return hsprintf( 674 - '<p class="aphront-form-instructions">'. 675 - 'For a detailed explanation of account roles, see %s.'. 676 - '</p>', 705 + $inst = pht('For a detailed explanation of account roles, see %s.', 677 706 $roles_link); 707 + return hsprintf( 708 + '<p class="aphront-form-instructions">%s</p>', 709 + $inst); 678 710 } 679 711 680 712 }
+18 -17
src/applications/people/controller/PhabricatorPeopleLdapController.php
··· 22 22 ->setUser($admin) 23 23 ->appendChild( 24 24 id(new AphrontFormTextControl()) 25 - ->setLabel('LDAP username') 25 + ->setLabel(pht('LDAP username')) 26 26 ->setName('username')) 27 27 ->appendChild( 28 28 id(new AphrontFormPasswordControl()) 29 - ->setLabel('Password') 29 + ->setLabel(pht('Password')) 30 30 ->setName('password')) 31 31 ->appendChild( 32 32 id(new AphrontFormTextControl()) 33 - ->setLabel('LDAP query') 34 - ->setCaption('A filter such as (objectClass=*)') 33 + ->setLabel(pht('LDAP query')) 34 + ->setCaption(pht('A filter such as (objectClass=*)')) 35 35 ->setName('query')) 36 36 ->appendChild( 37 37 id(new AphrontFormSubmitControl()) 38 - ->setValue('Search')); 38 + ->setValue(pht('Search'))); 39 39 40 40 $panel = new AphrontPanelView(); 41 - $panel->setHeader('Import LDAP Users'); 41 + $panel->setHeader(pht('Import LDAP Users')); 42 42 $panel->appendChild($form); 43 43 44 44 ··· 59 59 return $this->buildApplicationPage( 60 60 $nav, 61 61 array( 62 - 'title' => 'Import Ldap Users', 62 + 'title' => pht('Import Ldap Users'), 63 + 'device' => true, 63 64 )); 64 65 } 65 66 ··· 71 72 72 73 $panel = new AphrontErrorView(); 73 74 $panel->setSeverity(AphrontErrorView::SEVERITY_NOTICE); 74 - $panel->setTitle("Import Successful"); 75 - $errors = array("Successfully imported users from LDAP"); 75 + $panel->setTitle(pht("Import Successful")); 76 + $errors = array(pht("Successfully imported users from LDAP")); 76 77 77 78 78 79 foreach ($usernames as $username) { ··· 92 93 $ldap_info->setLDAPUsername($username); 93 94 $ldap_info->setUserID($user->getID()); 94 95 $ldap_info->save(); 95 - $errors[] = 'Successfully added ' . $username; 96 + $errors[] = pht('Successfully added %s', $username); 96 97 } catch (Exception $ex) { 97 - $errors[] = 'Failed to add ' . $username . ' ' . $ex->getMessage(); 98 + $errors[] = pht('Failed to add %s %s', $username, $ex->getMessage()); 98 99 } 99 100 } 100 101 ··· 127 128 $table = new AphrontTableView($results); 128 129 $table->setHeaders( 129 130 array( 130 - 'Username', 131 - 'Email', 132 - 'RealName', 133 - 'Import?', 131 + pht('Username'), 132 + pht('Email'), 133 + pht('Real Name'), 134 + pht('Import?'), 134 135 )); 135 136 $form->appendChild($table); 136 137 $form->setAction($request->getRequestURI() 137 138 ->alter('import', 'true')->alter('search', null)) 138 139 ->appendChild( 139 140 id(new AphrontFormSubmitControl()) 140 - ->setValue('Import')); 141 + ->setValue(pht('Import'))); 141 142 142 143 143 144 $panel->appendChild($form); 144 145 } catch (Exception $ex) { 145 146 $error_view = new AphrontErrorView(); 146 - $error_view->setTitle('LDAP Search Failed'); 147 + $error_view->setTitle(pht('LDAP Search Failed')); 147 148 $error_view->setErrors(array($ex->getMessage())); 148 149 return $error_view; 149 150 }
+23 -23
src/applications/people/controller/PhabricatorPeopleListController.php
··· 29 29 foreach ($users as $user) { 30 30 $primary_email = $user->loadPrimaryEmail(); 31 31 if ($primary_email && $primary_email->getIsVerified()) { 32 - $email = 'Verified'; 32 + $email = pht('Verified'); 33 33 } else { 34 - $email = 'Unverified'; 34 + $email = pht('Unverified'); 35 35 } 36 36 37 37 $status = array(); 38 38 if ($user->getIsDisabled()) { 39 - $status[] = 'Disabled'; 39 + $status[] = pht('Disabled'); 40 40 } 41 41 if ($user->getIsAdmin()) { 42 - $status[] = 'Admin'; 42 + $status[] = pht('Admin'); 43 43 } 44 44 if ($user->getIsSystemAgent()) { 45 - $status[] = 'System Agent'; 45 + $status[] = pht('System Agent'); 46 46 } 47 47 $status = implode(', ', $status); 48 48 ··· 64 64 'class' => 'button grey small', 65 65 'href' => '/people/edit/'.$user->getID().'/', 66 66 ), 67 - 'Administrate User'), 67 + pht('Administrate User')), 68 68 ); 69 69 } 70 70 71 71 $table = new AphrontTableView($rows); 72 72 $table->setHeaders( 73 73 array( 74 - 'Join Date', 75 - 'Time', 76 - 'Username', 77 - 'Real Name', 78 - 'Roles', 79 - 'Email', 74 + pht('Join Date'), 75 + pht('Time'), 76 + pht('Username'), 77 + pht('Real Name'), 78 + pht('Roles'), 79 + pht('Email'), 80 80 '', 81 81 )); 82 82 $table->setColumnClasses( ··· 101 101 )); 102 102 103 103 $panel = new AphrontPanelView(); 104 - $panel->setHeader('People ('.number_format($count).')'); 104 + $panel->setHeader(pht('People (%d)', number_format($count))); 105 + $panel->setNoBackground(); 105 106 $panel->appendChild($table); 106 107 $panel->appendChild($pager); 107 108 108 109 if ($is_admin) { 109 - $panel->addButton( 110 - phutil_tag( 111 - 'a', 112 - array( 113 - 'href' => '/people/edit/', 114 - 'class' => 'button green', 115 - ), 116 - 'Create New Account')); 117 110 if (PhabricatorEnv::getEnvConfig('ldap.auth-enabled')) { 118 111 $panel->addButton( 119 112 phutil_tag( ··· 122 115 'href' => '/people/ldap/', 123 116 'class' => 'button green' 124 117 ), 125 - 'Import from LDAP')); 118 + pht('Import from LDAP'))); 126 119 } 127 120 } 121 + $crumbs = $this->buildApplicationCrumbs($this->buildSideNavView()); 122 + $crumbs->addCrumb( 123 + id(new PhabricatorCrumbView()) 124 + ->setName(pht('User Directory')) 125 + ->setHref('/people/')); 128 126 129 127 $nav = $this->buildSideNavView(); 130 128 $nav->selectFilter('people'); 131 129 $nav->appendChild($panel); 130 + $nav->setCrumbs($crumbs); 132 131 133 132 return $this->buildApplicationPage( 134 133 $nav, 135 134 array( 136 - 'title' => 'People', 135 + 'title' => pht('People'), 136 + 'device' => true, 137 137 )); 138 138 } 139 139 }
+29 -22
src/applications/people/controller/PhabricatorPeopleLogsController.php
··· 44 44 ->setUser($user) 45 45 ->appendChild( 46 46 id(new AphrontFormTokenizerControl()) 47 - ->setLabel('Filter Actor') 47 + ->setLabel(pht('Filter Actor')) 48 48 ->setName('actor') 49 49 ->setLimit(1) 50 50 ->setValue($actor_value) 51 51 ->setDatasource('/typeahead/common/accounts/')) 52 52 ->appendChild( 53 53 id(new AphrontFormTokenizerControl()) 54 - ->setLabel('Filter User') 54 + ->setLabel(pht('Filter User')) 55 55 ->setName('user') 56 56 ->setLimit(1) 57 57 ->setValue($user_value) 58 58 ->setDatasource('/typeahead/common/accounts/')) 59 59 ->appendChild( 60 60 id(new AphrontFormSelectControl()) 61 - ->setLabel('Show Activity') 61 + ->setLabel(pht('Show Activity')) 62 62 ->setName('activity') 63 63 ->setValue($filter_activity) 64 64 ->setOptions( 65 65 array( 66 - '' => 'All Activity', 67 - 'admin' => 'Admin Activity', 66 + '' => pht('All Activity'), 67 + 'admin' => pht('Admin Activity'), 68 68 ))) 69 69 ->appendChild( 70 70 id(new AphrontFormTextControl()) 71 - ->setLabel('Filter IP') 71 + ->setLabel(pht('Filter IP')) 72 72 ->setName('ip') 73 73 ->setValue($filter_ip) 74 74 ->setCaption( 75 - 'Enter an IP (or IP prefix) to show only activity by that remote '. 76 - 'address.')) 75 + pht('Enter an IP (or IP prefix) to show only activity by that '. 76 + 'remote address.'))) 77 77 ->appendChild( 78 78 id(new AphrontFormTextControl()) 79 - ->setLabel('Filter Session') 79 + ->setLabel(pht('Filter Session')) 80 80 ->setName('session') 81 81 ->setValue($filter_session)) 82 82 ->appendChild( 83 83 id(new AphrontFormSubmitControl()) 84 - ->setValue('Filter Logs')); 84 + ->setValue(pht('Filter Logs'))); 85 85 86 86 $log_table = new PhabricatorUserLog(); 87 87 $conn_r = $log_table->establishConnection('r'); ··· 183 183 $table = new AphrontTableView($rows); 184 184 $table->setHeaders( 185 185 array( 186 - 'Date', 187 - 'Time', 188 - 'Action', 189 - 'Actor', 190 - 'User', 191 - 'Old', 192 - 'New', 193 - 'IP', 194 - 'Session', 186 + pht('Date'), 187 + pht('Time'), 188 + pht('Action'), 189 + pht('Actor'), 190 + pht('User'), 191 + pht('Old'), 192 + pht('New'), 193 + pht('IP'), 194 + pht('Session'), 195 195 )); 196 196 $table->setColumnClasses( 197 197 array( ··· 207 207 )); 208 208 209 209 $panel = new AphrontPanelView(); 210 - $panel->setHeader('Activity Logs'); 210 + $panel->setHeader(pht('Activity Logs')); 211 + $panel->setNoBackground(); 211 212 $panel->appendChild($table); 212 213 $panel->appendChild($pager); 213 214 214 215 $filter = new AphrontListFilterView(); 215 216 $filter->appendChild($form); 217 + $crumbs = $this->buildApplicationCrumbs($this->buildSideNavView()); 218 + $crumbs->addCrumb( 219 + id(new PhabricatorCrumbView()) 220 + ->setName(pht('Activity Logs')) 221 + ->setHref('/people/logs/')); 216 222 217 223 $nav = $this->buildSideNavView(); 218 224 $nav->selectFilter('logs'); ··· 221 227 $filter, 222 228 $panel, 223 229 )); 224 - 230 + $nav->setCrumbs($crumbs); 225 231 226 232 return $this->buildApplicationPage( 227 233 $nav, 228 234 array( 229 - 'title' => 'Activity Logs', 235 + 'title' => pht('Activity Logs'), 236 + 'device' => true, 230 237 )); 231 238 } 232 239 }