mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 15:03:34 +00:00
makemessages: Call ‘formatjs extract’ for JavaScript extraction.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
4b4cea90a3
commit
810ba7fce1
@@ -36,6 +36,7 @@ import itertools
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
from argparse import ArgumentParser
|
||||
from typing import Any, Dict, Iterable, Iterator, List, Mapping
|
||||
|
||||
@@ -202,6 +203,19 @@ class Command(makemessages.Command):
|
||||
data = self.ignore_javascript_comments(data)
|
||||
translation_strings.extend(self.extract_strings(data))
|
||||
|
||||
extracted = subprocess.check_output(
|
||||
[
|
||||
"node_modules/.bin/formatjs",
|
||||
"extract",
|
||||
"--additional-function-names=$t,$t_html",
|
||||
"--format=simple",
|
||||
"--ignore=**/*.d.ts",
|
||||
"static/js/**/*.js",
|
||||
"static/js/**/*.ts",
|
||||
]
|
||||
)
|
||||
translation_strings.extend(json.loads(extracted).values())
|
||||
|
||||
return list(set(translation_strings))
|
||||
|
||||
def get_template_dir(self) -> str:
|
||||
|
||||
Reference in New Issue
Block a user