[gedit-plugins/translate] Show translation engine used



commit 5d829941d4206f2507e4ab62e7eb969a86a60963
Author: Jordi Mas <jmas softcatala org>
Date:   Tue Aug 8 22:40:42 2017 +0200

    Show translation engine used

 plugins/translate/translate.plugin.desktop.in.in |    2 +-
 plugins/translate/translate/__init__.py          |   12 +++++++++---
 2 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/plugins/translate/translate.plugin.desktop.in.in 
b/plugins/translate/translate.plugin.desktop.in.in
index be20b0f..76ecfb7 100644
--- a/plugins/translate/translate.plugin.desktop.in.in
+++ b/plugins/translate/translate.plugin.desktop.in.in
@@ -5,6 +5,6 @@ IAge=3
 _Name=Translate
 _Description=Translates text into different languages
 Authors=Jordi Mas i Hernàndez <jmas softcatala org>
-Copyright=Copyright @ 2017 Jordi Mas i Hernàndez
+Copyright=Copyright @ 2017 Jordi Mas i Hernàndez. Powered by Apertium and Yandex.Translate translation 
engines. 
 Website=http://www.gedit.org
 Version=@VERSION@
diff --git a/plugins/translate/translate/__init__.py b/plugins/translate/translate/__init__.py
index 2f0472d..8384382 100644
--- a/plugins/translate/translate/__init__.py
+++ b/plugins/translate/translate/__init__.py
@@ -67,7 +67,9 @@ class TranslateWindowActivatable(GObject.Object, Gedit.WindowActivatable, PeasGt
         g_console = TranslateView(namespace = {'__builtins__' : __builtins__,
                                                    'gedit' : Gedit,
                                                    'window' : self.window})
-        g_console.write(_('Welcome!'))
+
+        name = self._get_translation_service_name()
+        g_console.write(_('Translations powered by {0}'.format(name)))
         bottom = self.window.get_bottom_panel()
         g_console.show_all()
         bottom.add_titled(g_console, "GeditTranslateConsolePanel", _('Translate Console'))
@@ -83,7 +85,11 @@ class TranslateWindowActivatable(GObject.Object, Gedit.WindowActivatable, PeasGt
 
         self.window.lookup_action('translate').set_enabled(sensitive)
 
-
+    def _get_translation_service_name(self):
+        settings = Settings()
+        service_id = settings.get_service()
+        return Services.get_name(service_id)
+     
     def _get_translation_service(self):
         settings = Settings()
         service_id = settings.get_service()
@@ -97,7 +103,7 @@ class TranslateWindowActivatable(GObject.Object, Gedit.WindowActivatable, PeasGt
  
     def get_languages_names_codes(self, service_id):
         print("get_languages_names_codes. service_id: " + str(service_id))
-        service = self._get_translation_service();
+        service = self._get_translation_service()
         return service.get_language_names(), service.get_language_codes()
 
     def do_create_configure_widget(self):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]