Skip to content

Commit b08fe7d

Browse files
authored
Remove defunct i18n support
1 parent 571377f commit b08fe7d

File tree

2 files changed

+1
-33
lines changed

2 files changed

+1
-33
lines changed

lib/adapter/question.py

Lines changed: 1 addition & 29 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
@@ -81,32 +78,7 @@ def _get_page(self, topic, request_options=None):
8178
topic_words = topic.split()
8279

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

11183
cmd = [CONFIG["path.internal.bin.upstream"]] + topic
11284
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)