Skip to content

Commit aa364b1

Browse files
committed
feat(translationtool): add Python support for translations
1 parent be6eee5 commit aa364b1

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

translations/translationtool/src/translationtool.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function createPotFile() {
6767
$this->createFakeFileForVueFiles();
6868
$this->createFakeFileForLocale();
6969
$translatableFiles = $this->findTranslatableFiles(
70-
['.php', '.js', '.jsx', '.mjs', '.html', '.ts', '.tsx'],
70+
['.php', '.js', '.jsx', '.mjs', '.html', '.ts', '.tsx', '.py'],
7171
['.min.js']
7272
);
7373

@@ -79,13 +79,17 @@ public function createPotFile() {
7979
$keywords = '';
8080
if (substr($entry, -4) === '.php') {
8181
$keywords = '--keyword=t --keyword=n:1,2';
82+
} else if (substr($entry, -3) === '.py') {
83+
$keywords = '--keyword=_ --keyword=_n:1,2';
8284
} else {
8385
$keywords = '--keyword=t:2 --keyword=n:2,3';
8486
}
8587

8688
$language = '--language=';
8789
if (substr($entry, -4) === '.php') {
8890
$language .= 'PHP';
91+
} else if (substr($entry, -3) === '.py') {
92+
$language .= 'Python';
8993
} else {
9094
$language .= 'Javascript';
9195
}
922 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)