Skip to content

Commit

Permalink
feat(translationtool): add Python support for translations
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey Borysenko <[email protected]>
  • Loading branch information
andrey18106 committed Feb 20, 2024
1 parent be6eee5 commit 74f2b48
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion translations/translationtool/src/translationtool.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function createPotFile() {
$this->createFakeFileForVueFiles();
$this->createFakeFileForLocale();
$translatableFiles = $this->findTranslatableFiles(
['.php', '.js', '.jsx', '.mjs', '.html', '.ts', '.tsx'],
['.php', '.js', '.jsx', '.mjs', '.html', '.ts', '.tsx', '.py'],
['.min.js']
);

Expand All @@ -79,13 +79,17 @@ public function createPotFile() {
$keywords = '';
if (substr($entry, -4) === '.php') {
$keywords = '--keyword=t --keyword=n:1,2';
} else if (substr($entry, -3) === '.py') {
$keywords = '--keyword=_ --keyword=_n:1,2';
} else {
$keywords = '--keyword=t:2 --keyword=n:2,3';
}

$language = '--language=';
if (substr($entry, -4) === '.php') {
$language .= 'PHP';
} else if (substr($entry, -3) === '.py') {
$language .= 'Python';
} else {
$language .= 'Javascript';
}
Expand Down
Binary file modified translations/translationtool/translationtool.phar
Binary file not shown.

0 comments on commit 74f2b48

Please sign in to comment.