Skip to content

Commit 562a5bd

Browse files
authored
Add xlf as xml highlighting (#1159)
* Add xlf as xml highlighting * Add xlf as xml highlighting
1 parent d8eb4be commit 562a5bd

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

src/Service/CodeHighlight/FilenameToLanguageTranslator.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,23 @@ public function translate(string $filename): ?string
1515
$filename = (string)preg_replace('/\.(example|dist|local)$/', '', $filename);
1616

1717
return match (strtolower(pathinfo($filename, PATHINFO_EXTENSION))) {
18-
"css" => "css",
19-
"env", "ini" => "ini",
20-
"js" => "javascript",
21-
"json", "json5" => "json",
22-
"htaccess" => "apache",
23-
"less" => "less",
24-
"md" => "markdown",
25-
"php" => "php",
26-
"py" => "python",
27-
"scss", "sass" => "scss",
28-
"sh" => "bash",
29-
"sql" => "sql",
30-
"ts" => "typescript",
31-
"twig" => "twig",
32-
"xml", "html" => "xml",
33-
"yaml", "yml" => "yaml",
34-
default => null,
18+
"css" => "css",
19+
"env", "ini" => "ini",
20+
"js" => "javascript",
21+
"json", "json5" => "json",
22+
"htaccess" => "apache",
23+
"less" => "less",
24+
"md" => "markdown",
25+
"php" => "php",
26+
"py" => "python",
27+
"scss", "sass" => "scss",
28+
"sh" => "bash",
29+
"sql" => "sql",
30+
"ts" => "typescript",
31+
"twig" => "twig",
32+
"xml", "html", "xlf" => "xml",
33+
"yaml", "yml" => "yaml",
34+
default => null,
3535
};
3636
}
3737
}

tests/Unit/Service/CodeHighlight/FilenameToLanguageTranslatorTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public static function dataProvider(): array
4848
"xml.dist" => ["/path/to/file.xml.dist", "xml"],
4949
"xml.local" => ["/path/to/file.xml.local", "xml"],
5050
"xml.example" => ["/path/to/file.xml.example", "xml"],
51+
"xlf" => ["/path/to/file.xlf", "xml"],
5152
"yaml" => ["/path/to/file.yaml", "yaml"],
5253
"yml" => ["/path/to/file.yml", "yaml"],
5354
"foobar" => ["/path/to/file.foobar", null]

0 commit comments

Comments
 (0)