From eef7661b62cc74dbf51ee0206d444b661dc08b90 Mon Sep 17 00:00:00 2001 From: Konstantin Pastbin Date: Tue, 11 Jul 2023 15:07:05 +0300 Subject: [PATCH] [docs] Add python >= 3.7 requirement for translate.py Signed-off-by: Konstantin Pastbin --- docs/TRANSLATIONS.md | 3 +++ tools/python/translate.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/TRANSLATIONS.md b/docs/TRANSLATIONS.md index f0fb497810..f52c14a7de 100644 --- a/docs/TRANSLATIONS.md +++ b/docs/TRANSLATIONS.md @@ -49,6 +49,8 @@ By default, it searches `strings.txt`, to check `types_strings.txt` add a `-t` o There are many more other options, e.g. print various translation statistics, validate and re-format translation files. Check `tools/python/strings_utils.py -h` to see all of them. +## Automatic translations + In some cases automatically translated strings are better than no translation at all. There are two scripts to automate given string's translation into multiple languages. Please [install Translate Shell](https://www.soimort.org/translate-shell/#installation) first to be able to run them. @@ -58,6 +60,7 @@ Please [install Translate Shell](https://www.soimort.org/translate-shell/#instal The first one uses free DeepL API where possible and provides a significantly better quality translations. It requires registering a [DeepL account](https://www.deepl.com/pro#developer) and [getting API key](https://www.deepl.com/account/summary). You may be asked for a credit card for verification, but it won't be charged. +Requires Python version >= 3.7. ```bash export DEEPL_FREE_API_KEY= diff --git a/tools/python/translate.py b/tools/python/translate.py index eea55086e9..771dc2258b 100755 --- a/tools/python/translate.py +++ b/tools/python/translate.py @@ -82,7 +82,7 @@ def google_translate(text): fromTo = fromTo[:-1] res = subprocess.run([TRANS_CMD, '-b', '-no-bidi', fromTo, text], text=True, capture_output=True) if res.returncode != 0: - print('Error running trans program:') + print(f'Error running {TRANS_CMD} program:') print(res.stderr) exit(1)