Remove product literal strings in "pht()", part 15
[phabricator.git] / src / applications / config / check / PhabricatorPygmentSetupCheck.php
blob74dfe5a324028a3490af94be33829989f3d5fe0f
1 <?php
3 final class PhabricatorPygmentSetupCheck extends PhabricatorSetupCheck {
5 public function getDefaultGroup() {
6 return self::GROUP_OTHER;
9 protected function executeChecks() {
10 $pygment = PhabricatorEnv::getEnvConfig('pygments.enabled');
12 if ($pygment) {
13 if (!Filesystem::binaryExists('pygmentize')) {
14 $summary = pht(
15 'You enabled pygments but the %s script is not '.
16 'actually available, your %s is probably broken.',
17 'pygmentize',
18 '$PATH');
20 $message = pht(
21 'The environmental variable %s does not contain %s. '.
22 'You have enabled pygments, which requires '.
23 '%s to be available in your %s variable.',
24 '$PATH',
25 'pygmentize',
26 'pygmentize',
27 '$PATH');
29 $this
30 ->newIssue('pygments.enabled')
31 ->setName(pht('%s Not Found', 'pygmentize'))
32 ->setSummary($summary)
33 ->setMessage($message)
34 ->addRelatedPhabricatorConfig('pygments.enabled')
35 ->addPhabricatorConfig('environment.append-paths');
36 } else {
37 list($err) = exec_manual('pygmentize -h');
38 if ($err) {
39 $summary = pht(
40 'You have enabled pygments and the %s script is '.
41 'available, but does not seem to work.',
42 'pygmentize');
44 $message = pht(
45 'This server has %s available in %s, but the binary '.
46 'exited with an error code when run as %s. Check that it is '.
47 'installed correctly.',
48 phutil_tag('tt', array(), 'pygmentize'),
49 phutil_tag('tt', array(), '$PATH'),
50 phutil_tag('tt', array(), 'pygmentize -h'));
52 $this
53 ->newIssue('pygments.failed')
54 ->setName(pht('%s Not Working', 'pygmentize'))
55 ->setSummary($summary)
56 ->setMessage($message)
57 ->addRelatedPhabricatorConfig('pygments.enabled')
58 ->addPhabricatorConfig('environment.append-paths');
61 } else {
62 $summary = pht(
63 'Pygments should be installed and enabled '.
64 'to provide advanced syntax highlighting.');
66 $message = pht(
67 'This software can highlight a few languages by default, '.
68 'but installing and enabling Pygments (a third-party highlighting '.
69 "tool) will add syntax highlighting for many more languages. \n\n".
70 'For instructions on installing and enabling Pygments, see the '.
71 '%s configuration option.'."\n\n".
72 'If you do not want to install Pygments, you can ignore this issue.',
73 phutil_tag('tt', array(), 'pygments.enabled'));
75 $this
76 ->newIssue('pygments.noenabled')
77 ->setName(pht('Install Pygments to Improve Syntax Highlighting'))
78 ->setSummary($summary)
79 ->setMessage($message)
80 ->addRelatedPhabricatorConfig('pygments.enabled');