Skip to content

Commit 3ff6de7

Browse files
committed
Remove defunct i18n support
1 parent bae856b commit 3ff6de7

File tree

2 files changed

+1
-41
lines changed

2 files changed

+1
-41
lines changed

lib/adapter/question.py

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
import re
1313
from subprocess import Popen, PIPE
1414

15-
from polyglot.detect import Detector
16-
from polyglot.detect.base import UnknownLanguage
17-
1815
from config import CONFIG
1916
from languages_data import SO_NAME
2017
from .upstream import UpstreamAdapter
@@ -83,40 +80,7 @@ def _get_page(self, topic, request_options=None):
8380
topic_words = topic.split()
8481

8582
topic = " ".join(topic_words)
86-
87-
lang = "en"
88-
try:
89-
query_text = topic # " ".join(topic)
90-
query_text = re.sub("^[^/]*/+", "", query_text.rstrip("/"))
91-
query_text = re.sub("/[0-9]+$", "", query_text)
92-
query_text = re.sub("/[0-9]+$", "", query_text)
93-
detector = Detector(query_text)
94-
supposed_lang = detector.languages[0].code
95-
if len(topic_words) > 2 or supposed_lang in [
96-
"az",
97-
"ru",
98-
"uk",
99-
"de",
100-
"fr",
101-
"es",
102-
"it",
103-
"nl",
104-
]:
105-
lang = supposed_lang
106-
if supposed_lang.startswith("zh_") or supposed_lang == "zh":
107-
lang = "zh"
108-
elif supposed_lang.startswith("pt_"):
109-
lang = "pt"
110-
if supposed_lang in ["ja", "ko"]:
111-
lang = supposed_lang
112-
113-
except UnknownLanguage:
114-
print("Unknown language (%s)" % query_text)
115-
116-
if lang != "en":
117-
topic = ["--human-language", lang, topic]
118-
else:
119-
topic = [topic]
83+
topic = [topic]
12084

12185
cmd = [CONFIG["path.internal.bin.upstream"]] + topic
12286
proc = Popen(cmd, stdin=open(os.devnull, "r"), stdout=PIPE, stderr=PIPE)

requirements.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@ dateutils
77
fuzzywuzzy
88
redis
99
colored<1.4.3
10-
langdetect
1110
cffi
12-
polyglot
13-
PyICU
14-
pycld2
1511
colorama
1612
pyyaml
1713
python-Levenshtein

0 commit comments

Comments
 (0)