[gedit-plugins/gnome-3-32] Translate plugin: cache _fetch_remote_language_names values per session since names of languages wil
- From: Jordi Mas <jmas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit-plugins/gnome-3-32] Translate plugin: cache _fetch_remote_language_names values per session since names of languages wil
- Date: Mon, 6 May 2019 18:53:21 +0000 (UTC)
commit 5ed8abac1dbc9f28fcccb2783b303f422b1e0936
Author: Jordi Mas <jmas softcatala org>
Date: Fri May 3 22:21:11 2019 +0200
Translate plugin: cache _fetch_remote_language_names values per session since names of languages will
unlike to change. Prevents a http request everytime that we use the contextual menu with Yandex engine
plugins/translate/translate/services/yandex.py | 5 +++++
1 file changed, 5 insertions(+)
---
diff --git a/plugins/translate/translate/services/yandex.py b/plugins/translate/translate/services/yandex.py
index ae4ee1c..c50065d 100644
--- a/plugins/translate/translate/services/yandex.py
+++ b/plugins/translate/translate/services/yandex.py
@@ -103,6 +103,11 @@ class Yandex(Service):
if len(self._key) == 0:
return
+ if (len(Yandex.g_locales_names) > 0 and
+ len(Yandex.g_language_names) > 0 and
+ len(Yandex.g_language_codes) > 0):
+ return
+
url = "{0}/getLangs?ui=en&key={1}".format(self.SERVER, self._key)
response = urllib.request.urlopen(url)
payload = json.loads(response.read().decode("utf-8"))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]