Remove product literal strings in "pht()", part 4
[phabricator.git] / src / applications / config / option / PhabricatorSyntaxHighlightingConfigOptions.php
blob05303e2b961cb3d529bd7d24bc0e1d646c069c23
1 <?php
3 final class PhabricatorSyntaxHighlightingConfigOptions
4 extends PhabricatorApplicationConfigOptions {
6 public function getName() {
7 return pht('Syntax Highlighting');
10 public function getDescription() {
11 return pht('Options relating to syntax highlighting source code.');
14 public function getIcon() {
15 return 'fa-code';
18 public function getGroup() {
19 return 'core';
22 public function getOptions() {
23 $caches_href = PhabricatorEnv::getDoclink('Managing Caches');
25 return array(
26 $this->newOption(
27 'syntax-highlighter.engine',
28 'class',
29 'PhutilDefaultSyntaxHighlighterEngine')
30 ->setBaseClass('PhutilSyntaxHighlighterEngine')
31 ->setSummary(pht('Default non-pygments syntax highlighter engine.'))
32 ->setDescription(
33 pht(
34 'You can provide a custom highlighter engine by extending '.
35 'class %s.',
36 'PhutilSyntaxHighlighterEngine')),
37 $this->newOption('pygments.enabled', 'bool', false)
38 ->setSummary(
39 pht('Use Pygments to highlight code?'))
40 ->setBoolOptions(
41 array(
42 pht('Use Pygments'),
43 pht('Do Not Use Pygments'),
45 ->setDescription(
46 pht(
47 'Syntax highlighting a supported for a few languages by '.
48 'default, but you can install Pygments (a third-party syntax '.
49 'highlighting tool) to provide support for many more languages.'.
50 "\n\n".
51 'To install Pygments, visit '.
52 '[[ http://pygments.org | pygments.org ]] and follow the '.
53 'download and install instructions.'.
54 "\n\n".
55 'Once Pygments is installed, enable this option '.
56 '(`pygments.enabled`) to make use of Pygments when '.
57 'highlighting source code.'.
58 "\n\n".
59 'After you install and enable Pygments, newly created source '.
60 'code (like diffs and pastes) should highlight correctly. '.
61 'You may need to clear caches to get previously '.
62 'existing source code to highlight. For instructions on '.
63 'managing caches, see [[ %s | Managing Caches ]].',
64 $caches_href)),
65 $this->newOption(
66 'pygments.dropdown-choices',
67 'wild',
68 array(
69 'apacheconf' => 'Apache Configuration',
70 'bash' => 'Bash Scripting',
71 'brainfuck' => 'Brainf*ck',
72 'c' => 'C',
73 'coffee-script' => 'CoffeeScript',
74 'cpp' => 'C++',
75 'csharp' => 'C#',
76 'css' => 'CSS',
77 'd' => 'D',
78 'diff' => 'Diff',
79 'django' => 'Django Templating',
80 'docker' => 'Docker',
81 'erb' => 'Embedded Ruby/ERB',
82 'erlang' => 'Erlang',
83 'go' => 'Golang',
84 'groovy' => 'Groovy',
85 'haskell' => 'Haskell',
86 'html' => 'HTML',
87 'http' => 'HTTP',
88 'invisible' => 'Invisible',
89 'java' => 'Java',
90 'js' => 'Javascript',
91 'json' => 'JSON',
92 'make' => 'Makefile',
93 'mysql' => 'MySQL',
94 'nginx' => 'Nginx Configuration',
95 'objc' => 'Objective-C',
96 'perl' => 'Perl',
97 'php' => 'PHP',
98 'postgresql' => 'PostgreSQL',
99 'pot' => 'Gettext Catalog',
100 'puppet' => 'Puppet',
101 'python' => 'Python',
102 'rainbow' => 'Rainbow',
103 'remarkup' => 'Remarkup',
104 'rst' => 'reStructuredText',
105 'robotframework' => 'RobotFramework',
106 'ruby' => 'Ruby',
107 'sql' => 'SQL',
108 'tex' => 'LaTeX',
109 'text' => 'Plain Text',
110 'twig' => 'Twig',
111 'xml' => 'XML',
112 'yaml' => 'YAML',
114 ->setSummary(
115 pht('Set the language list which appears in dropdowns.'))
116 ->setDescription(
117 pht(
118 'In places that we display a dropdown to syntax-highlight code, '.
119 'this is where that list is defined.')),
120 $this->newOption(
121 'syntax.filemap',
122 'custom:PhabricatorConfigRegexOptionType',
123 array(
124 '@\.arcconfig$@' => 'json',
125 '@\.arclint$@' => 'json',
126 '@\.divinerconfig$@' => 'json',
128 ->setSummary(
129 pht('Override what language files (based on filename) highlight as.'))
130 ->setDescription(
131 pht(
132 'This is an override list of regular expressions which allows '.
133 'you to choose what language files are highlighted as. If your '.
134 'projects have certain rules about filenames or use unusual or '.
135 'ambiguous language extensions, you can create a mapping here. '.
136 'This is an ordered dictionary of regular expressions which will '.
137 'be tested against the filename. They should map to either an '.
138 'explicit language as a string value, or a numeric index into '.
139 'the captured groups as an integer.'))
140 ->addExample(
141 '{"@\\\.xyz$@": "php"}',
142 pht('Highlight %s as PHP.', '*.xyz'))
143 ->addExample(
144 '{"@/httpd\\\.conf@": "apacheconf"}',
145 pht('Highlight httpd.conf as "apacheconf".'))
146 ->addExample(
147 '{"@\\\.([^.]+)\\\.bak$@": 1}',
148 pht(
149 "Treat all '*.x.bak' file as '.x'. NOTE: We map to capturing group ".
150 "1 by specifying the mapping as '1'")),