Skip to content

Commit dfef9b6

Browse files
Added gettext (.po) language support (#3369)
1 parent d17e376 commit dfef9b6

14 files changed

+119
-3
lines changed

components.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,11 @@
484484
"title": "GEDCOM",
485485
"owner": "Golmote"
486486
},
487+
"gettext": {
488+
"title": "gettext",
489+
"alias": "po",
490+
"owner": "RunDevelopment"
491+
},
487492
"gherkin": {
488493
"title": "Gherkin",
489494
"owner": "hason"

components/prism-gettext.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
Prism.languages.gettext = {
2+
'comment': [
3+
{
4+
pattern: /# .*/,
5+
greedy: true,
6+
alias: 'translator-comment'
7+
},
8+
{
9+
pattern: /#\..*/,
10+
greedy: true,
11+
alias: 'extracted-comment'
12+
},
13+
{
14+
pattern: /#:.*/,
15+
greedy: true,
16+
alias: 'reference-comment'
17+
},
18+
{
19+
pattern: /#,.*/,
20+
greedy: true,
21+
alias: 'flag-comment'
22+
},
23+
{
24+
pattern: /#\|.*/,
25+
greedy: true,
26+
alias: 'previously-untranslated-comment'
27+
},
28+
{
29+
pattern: /#.*/,
30+
greedy: true
31+
},
32+
],
33+
'string': {
34+
pattern: /(^|[^\\])"(?:[^"\\]|\\.)*"/,
35+
lookbehind: true,
36+
greedy: true
37+
},
38+
'keyword': /^msg(?:ctxt|id|id_plural|str)\b/m,
39+
'number': /\b\d+\b/,
40+
'punctuation': /[\[\]]/
41+
};
42+
43+
Prism.languages.po = Prism.languages.gettext;

components/prism-gettext.min.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/prism-gettext.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<h2>Full example</h2>
2+
<pre><code># Source: https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html
3+
#: lib/error.c:116
4+
msgid "Unknown system error"
5+
msgstr "Error desconegut del sistema"
6+
</code></pre>

plugins/autoloader/prism-autoloader.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@
197197
"xlsx": "excel-formula",
198198
"xls": "excel-formula",
199199
"gamemakerlanguage": "gml",
200+
"po": "gettext",
200201
"gni": "gn",
201202
"go-mod": "go-module",
202203
"hbs": "handlebars",

plugins/autoloader/prism-autoloader.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/show-language/prism-show-language.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@
9797
"gcode": "G-code",
9898
"gdscript": "GDScript",
9999
"gedcom": "GEDCOM",
100+
"gettext": "gettext",
101+
"po": "gettext",
100102
"glsl": "GLSL",
101103
"gn": "GN",
102104
"gni": "GN",

0 commit comments

Comments
 (0)