diff --git a/README.md b/README.md index f8fe95c..ac98a3d 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # nvda-translate Make NVDA translate any spoken text to the desired language. ## Download -- Stable: [translate-2019.09.3](http://www.mtyp.fr/nvda/translate-2019.09.3.nvda-addon). -- Stable (NVDA 2019.3+): [translate-2020.01](http://www.mtyp.fr/nvda/translate-2020.05.nvda-addon). +- Stable: [translate-2019.09.3](http://www.mtyp.fr/nvda/translate/translate-2019.09.3.nvda-addon). +- Stable (NVDA 2019.3+): [translate-2020.06](http://www.mtyp.fr/nvda/translate/translate-2020.06.nvda-addon). ## Installation diff --git a/addon/globalPlugins/translate/__init__.py b/addon/globalPlugins/translate/__init__.py index a9e7d6b..6a534ac 100644 --- a/addon/globalPlugins/translate/__init__.py +++ b/addon/globalPlugins/translate/__init__.py @@ -66,17 +66,17 @@ def translate(text): if appTable is None: _translationCache[appName] = {} translated = _translationCache[appName].get(text, None) - if translated is not None: + if translated is not None and translated != text: return translated try: prepared = text.encode('utf8', ':/') translated = mtranslate.translate(prepared, _gpObject.language) except Exception as e: - _translationCache[appName][text] = text return text if translated is None or len(translated) == 0: translated = text - _translationCache[appName][text] = translated + else: + _translationCache[appName][text] = translated return translated @@ -98,7 +98,7 @@ def speak(speechSequence: SpeechSequence, else: newSpeechSequence.append(val) _nvdaSpeak(speechSequence=newSpeechSequence, priority=priority) - _lastTranslatedText = " ".join(x if isinstance(x, str) else "" for x in newSpeechSequence) + _lastTranslatedText = " ".join(x if isinstance(x, str) else "" for x in newSpeechSequence) # ## This is overloaded as well because the generated text may contain already translated text by diff --git a/buildVars.py b/buildVars.py index 9547389..3f28fb8 100644 --- a/buildVars.py +++ b/buildVars.py @@ -20,7 +20,7 @@ "addon_description" : _("""Uses the Google Translate API to translate each spoken text to the desired language, on the fly. This add-on requires an internet connection."""), # version - "addon_version" : "2020.05", + "addon_version" : "2020.06", # Author(s) "addon_author" : u"Yannick PLASSIARD ", # URL for the add-on documentation support