mirror of
https://github.com/chubin/wttr.in
synced 2025-01-12 03:58:45 +00:00
parent
0b8ead03e6
commit
492f4f5e50
1 changed files with 9 additions and 3 deletions
12
bin/proxy.py
12
bin/proxy.py
|
@ -126,11 +126,17 @@ def _save_content_and_headers(path, query, content, headers):
|
|||
|
||||
def translate(text, lang):
|
||||
"""
|
||||
Translate `text` into `lang`
|
||||
Translate `text` into `lang`.
|
||||
If `text` is comma-separated, translate each term independently.
|
||||
If no translation found, leave it untouched.
|
||||
"""
|
||||
|
||||
if "," in text:
|
||||
terms = text.split(",")
|
||||
translated_terms = [translate(term.strip(), lang) for term in terms]
|
||||
return ", ".join(translated_terms)
|
||||
|
||||
translated = TRANSLATIONS.get(lang, {}).get(text.lower(), text)
|
||||
if text == translated:
|
||||
print("%s: %s" % (lang, text))
|
||||
return translated
|
||||
|
||||
def cyr(to_translate):
|
||||
|
|
Loading…
Reference in a new issue