[gedit-plugins/translate] Initial version
- From: Jordi Mas <jmas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit-plugins/translate] Initial version
- Date: Wed, 12 Jul 2017 05:43:20 +0000 (UTC)
commit b7ae3551578695a0ac60319999ac09fc4db4df32
Author: Jordi Mas <jmas softcatala org>
Date: Wed Jul 12 07:43:04 2017 +0200
Initial version
configure.ac | 3 +-
plugins/Makefile.am | 1 +
plugins/translate/Makefile.am | 15 ++
...rg.gnome.gedit.plugins.translate.gschema.xml.in | 18 ++
plugins/translate/translate.plugin.desktop.in.in | 10 +
plugins/translate/translate/__init__.py | 177 ++++++++++++++++++
plugins/translate/translate/apertium.py | 189 ++++++++++++++++++++
plugins/translate/translate/preferences.py | 112 ++++++++++++
plugins/translate/translate/translateview.py | 55 ++++++
plugins/translate/translate/ui/preferences.ui | 113 ++++++++++++
po/POTFILES.in | 4 +
11 files changed, 696 insertions(+), 1 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index db9353d..356631d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -69,7 +69,7 @@ GLIB_GSETTINGS
C_PLUGINS="bookmarks drawspaces wordcompletion"
# Python plugins that don't need special dependencies, besides Python
-PY_PLUGINS="bracketcompletion codecomment colorpicker colorschemer commander joinlines multiedit smartspaces
textsize"
+PY_PLUGINS="bracketcompletion codecomment colorpicker colorschemer commander joinlines multiedit smartspaces
textsize translate"
# Vala plugins that don't need special dependencies, besides Vala
VALA_PLUGINS="findinfiles"
@@ -327,6 +327,7 @@ plugins/synctex/synctex.plugin.desktop.in
plugins/terminal/org.gnome.gedit.plugins.terminal.gschema.xml.in
plugins/terminal/terminal.plugin.desktop.in
plugins/textsize/textsize.plugin.desktop.in
+plugins/translate/translate.plugin.desktop.in
plugins/wordcompletion/org.gnome.gedit.plugins.wordcompletion.gschema.xml.in
plugins/wordcompletion/wordcompletion.plugin.desktop.in
po/Makefile.in])
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index cb431e6..0be7135 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -30,6 +30,7 @@ include plugins/smartspaces/Makefile.am
include plugins/synctex/Makefile.am
include plugins/terminal/Makefile.am
include plugins/textsize/Makefile.am
+include plugins/translate/Makefile.am
include plugins/wordcompletion/Makefile.am
include plugins/zeitgeist/Makefile.am
diff --git a/plugins/translate/Makefile.am b/plugins/translate/Makefile.am
new file mode 100644
index 0000000..bd54971
--- /dev/null
+++ b/plugins/translate/Makefile.am
@@ -0,0 +1,15 @@
+if ENABLE_PYTHON
+plugins_translatedir = $(plugindir)/translate
+plugins_translate_PYTHON = \
+ plugins/translate/translate/apertium.py \
+ plugins/translate/translate/__init__.py \
+ plugins/translate/translate/preferences.py \
+ plugins/translate/translate/translateview.py
+
+plugins_preferences_uidir = $(GEDIT_PLUGINS_DATA_DIR)/translate/ui
+dist_plugins_preferences_ui_DATA = plugins/translate/translate/ui/preferences.ui
+
+plugin_in_files += plugins/translate/translate.plugin.desktop.in
+appstream_in_files += plugins/translate/gedit-translate.metainfo.xml.in
+gsettings_SCHEMAS += plugins/translate/org.gnome.gedit.plugins.translate.gschema.xml
+endif
diff --git a/plugins/translate/org.gnome.gedit.plugins.translate.gschema.xml.in
b/plugins/translate/org.gnome.gedit.plugins.translate.gschema.xml.in
new file mode 100644
index 0000000..2eb63ff
--- /dev/null
+++ b/plugins/translate/org.gnome.gedit.plugins.translate.gschema.xml.in
@@ -0,0 +1,18 @@
+<schemalist>
+ <schema gettext-domain="@GETTEXT_PACKAGE@" id="org.gnome.gedit.plugins.translate"
path="/org/gnome/gedit/plugins/translate/">
+ <key name="output-to-document" type="b">
+ <default>true</default>
+ <summary>Where translation output is shown</summary>
+ <description>
+ If true, output of the translation is inserted in the document window if not in the Output Translate
Window.
+ </description>
+ </key>
+ <key name="language-pair" type="s">
+ <default>'spa-eng'</default>
+ <summary>Language pair used</summary>
+ <description>
+ Language pair used to translate from one language to another
+ </description>
+ </key>
+ </schema>
+</schemalist>
diff --git a/plugins/translate/translate.plugin.desktop.in.in
b/plugins/translate/translate.plugin.desktop.in.in
new file mode 100644
index 0000000..be20b0f
--- /dev/null
+++ b/plugins/translate/translate.plugin.desktop.in.in
@@ -0,0 +1,10 @@
+[Plugin]
+Loader=python3
+Module=translate
+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
+Website=http://www.gedit.org
+Version=@VERSION@
diff --git a/plugins/translate/translate/__init__.py b/plugins/translate/translate/__init__.py
new file mode 100644
index 0000000..e6a84e3
--- /dev/null
+++ b/plugins/translate/translate/__init__.py
@@ -0,0 +1,177 @@
+# -*- coding: utf-8 -*-
+#
+# Copyrignt (C) 2017 Jordi Mas <jmas softcatala org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+import gi
+gi.require_version('Gtk', '3.0')
+gi.require_version('GtkSource', '3.0')
+gi.require_version('PeasGtk', '1.0')
+
+from gi.repository import GObject, Gio, Gtk, Gedit, PeasGtk
+from .apertium import Apertium
+from .translateview import TranslateView
+from .preferences import Preferences
+import gettext
+from gpdefs import *
+
+try:
+ gettext.bindtextdomain(GETTEXT_PACKAGE, GP_LOCALEDIR)
+ _ = lambda s: gettext.dgettext(GETTEXT_PACKAGE, s);
+except:
+ _ = lambda s: s
+
+class TranslateAppActivatable(GObject.Object, Gedit.AppActivatable):
+
+ app = GObject.Property(type=Gedit.App)
+
+ def __init__(self):
+ GObject.Object.__init__(self)
+
+ def do_activate(self):
+ self.app.add_accelerator("<Primary>M", "win.translate", None)
+
+ def do_deactivate(self):
+ self.app.remove_accelerator("win.translate", None)
+
+class TranslateWindowActivatable(GObject.Object, Gedit.WindowActivatable, PeasGtk.Configurable):
+
+ __gtype_name__ = "TranslateWindowActivatable"
+ window = GObject.Property(type=Gedit.Window)
+
+ def __init__(self):
+ GObject.Object.__init__(self)
+
+ def do_activate(self):
+ action = Gio.SimpleAction(name="translate")
+ action.connect('activate', lambda a, p: self.do_translate())
+ self.window.add_action(action)
+
+ global g_console
+ g_console = TranslateView(namespace = {'__builtins__' : __builtins__,
+ 'gedit' : Gedit,
+ 'window' : self.window})
+ g_console.write(_('Welcome!'))
+ bottom = self.window.get_bottom_panel()
+ g_console.show_all()
+ bottom.add_titled(g_console, "GeditPythonConsolePanel", 'Translate Console')
+
+ def do_deactivate(self):
+ self.window.remove_action("translate")
+
+ def do_update_state(self):
+ sensitive = False
+ view = self.window.get_active_view()
+ if view and hasattr(view, "translate_view_activatable"):
+ sensitive = True
+
+ self.window.lookup_action('translate').set_enabled(sensitive)
+
+ def do_create_configure_widget(self):
+ print("called do_create_configure_widget")
+ apertium = Apertium()
+ config_widget = Preferences(self.plugin_info.get_data_dir(),
+ apertium.get_language_names(),
+ apertium.get_language_codes())
+ widget = config_widget.configure_widget()
+ print("called do_create_configure_widget return:" + str(type(widget)))
+ return widget
+
+ '''Entry point when user uses keyboard shortcut'''
+ def do_translate(self, unindent=False):
+ view = self.window.get_active_view()
+ if view and view.translate_view_activatable:
+ view.translate_view_activatable.do_translate(view.get_buffer(), unindent)
+
+
+class TranslateViewActivatable(GObject.Object, Gedit.ViewActivatable):
+
+ TRANSLATE_KEY_BASE = 'org.gnome.gedit.plugins.translate'
+ OUTPUT_TO_DOCUMENT = 'output-to-document'
+ LANGUAGE_PAIR = 'language-pair'
+
+ view = GObject.Property(type=Gedit.View)
+
+ def __init__(self):
+ GObject.Object.__init__(self)
+ self._settings = Gio.Settings.new(self.TRANSLATE_KEY_BASE)
+
+ def do_activate(self):
+ self.view.translate_view_activatable = self
+ self.view.connect('populate-popup', self.populate_popup)
+
+ def do_deactivate(self):
+ delattr(self.view, "translate_view_activatable")
+
+ def _get_language_pair_name(self):
+ language_pair = self._settings.get_string(self.LANGUAGE_PAIR)
+ languages = language_pair.split('|')
+
+ apertium = Apertium()
+ return apertium.get_language_pair_name(languages[0], languages[1])
+
+ def populate_popup(self, view, popup):
+ if not isinstance(popup, Gtk.MenuShell):
+ return
+
+ item = Gtk.SeparatorMenuItem()
+ item.show()
+ popup.append(item)
+
+ language_pair_name = self._get_language_pair_name()
+ text = _("Translate selected text [{0}]").format(language_pair_name)
+
+ item = Gtk.MenuItem.new_with_mnemonic(text)
+ item.set_sensitive(self.is_enabled())
+ item.show()
+ item.connect('activate', lambda i: self.do_translate(view.get_buffer()))
+ popup.append(item)
+
+ def is_enabled(self):
+ document = self.view.get_buffer()
+ if document is None:
+ return False
+
+ start = None
+ end = None
+
+ try:
+ start, end = document.get_selection_bounds()
+
+ except:
+ pass
+
+ return start is not None and end is not None
+
+ def translate_text(self, document, start, end):
+ doc = self.view.get_buffer()
+ text = doc.get_text(start, end, False)
+ language_pair = self._settings.get_string(self.LANGUAGE_PAIR)
+
+ apertium = Apertium()
+ translated = apertium.translate_text(text, language_pair)
+
+ if self._settings.get_boolean(self.OUTPUT_TO_DOCUMENT):
+ doc.insert(start, translated)
+ else:
+ g_console.write(translated)
+
+ def do_translate(self, document, unindent=False):
+ start, end = document.get_selection_bounds()
+ self.translate_text(document, start, end)
+
+
diff --git a/plugins/translate/translate/apertium.py b/plugins/translate/translate/apertium.py
new file mode 100644
index 0000000..a15467e
--- /dev/null
+++ b/plugins/translate/translate/apertium.py
@@ -0,0 +1,189 @@
+# -*- coding: utf-8 -*-
+#
+# Copyrignt (C) 2017 Jordi Mas <jmas softcatala org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+import urllib.request, urllib.parse, urllib.error
+import json
+import locale
+
+class Apertium():
+
+ g_language_codes = []
+ g_language_names = []
+ g_locales_names = {}
+
+ DEFAULT_LANGUAGE_NAMES = ["Spanish -> English",
+ "English -> Spanish",
+ "Catalan -> English",
+ "English -> Catalan"]
+
+ DEFAULT_LANGUAGE_CODES = ["spa|eng",
+ "eng|spa",
+ "cat|eng",
+ "eng|cat",
+ ]
+
+ SERVER = "https://www.apertium.org/apy"
+
+ def __init__(self):
+ self._get_remote_language_names_and_pairs()
+
+ def get_language_names(self):
+ if len(Apertium.g_language_codes) > 0 and len(Apertium.g_language_names) > 0:
+ return Apertium.g_language_names
+
+ return self.DEFAULT_LANGUAGE_NAMES
+
+ def get_language_codes(self):
+ if len(Apertium.g_language_codes) > 0 and len(Apertium.g_language_names) > 0:
+ return Apertium.g_language_codes
+
+ return self.DEFAULT_LANGUAGE_CODES
+
+ def _get_lang_from_langcountry(self, language):
+ if language is not None:
+ index = language.find("_")
+ if index > 0:
+ language = language[:index]
+
+ return language
+
+ def _get_user_locale(self):
+ user_locale = locale.getdefaultlocale()[0]
+ user_locale = self._get_lang_from_langcountry(user_locale)
+ if user_locale is None:
+ user_locale = 'en'
+ print("User locale:" + user_locale)
+ return user_locale
+
+ def _get_language_name(self, langcode, locales_names):
+ if langcode in locales_names:
+ language_name = locales_names[langcode]
+ else:
+ locale_no_country = self._get_lang_from_langcountry(langcode)
+ country = langcode[len(locale_no_country) + 1:]
+
+ language_name = '{0} ({1})'.format(locales_names[locale_no_country],
+ country)
+ return language_name
+
+ def get_language_pair_name(self, source, target, locales_names=None):
+ if locales_names is None:
+ locales_names = Apertium.g_locales_names
+
+ source = self._get_language_name(source, locales_names)
+ target = self._get_language_name(target, locales_names)
+ return '{0} -> {1}'.format(source, target)
+
+ def _is_langcode_in_list(self, langcode, locales_names):
+ if langcode not in locales_names:
+ locale_no_country = self._get_lang_from_langcountry(langcode)
+ if locale_no_country not in locales_names:
+ return False
+ return True
+
+ def _add_missing_locale_names_in_english(self, locales, locales_names):
+ locales_names_en = self._get_remote_language_names(locales, 'en')
+ for l in locales_names_en:
+ if l not in locales_names:
+ print("Adding from EN: " + locales_names_en[l])
+ locales_names[l] = locales_names_en[l]
+
+ return locales_names
+
+
+ def _get_remote_language_names_and_pairs(self):
+ if len(Apertium.g_language_names) > 0:
+ return
+
+ try:
+ language_names = []
+ en_names_requested = False
+
+ user_locale = self._get_user_locale()
+ language_pair_source, language_pair_target, locales, language_codes =
self._get_remote_language_pairs()
+ locales_names = self._get_remote_language_names(locales, user_locale)
+
+ for i in range(len(language_pair_source)):
+ source = language_pair_source[i]
+ target = language_pair_target[i]
+
+ if en_names_requested is False and \
+ (self._is_langcode_in_list(source, locales_names) or\
+ self._is_langcode_in_list(target, locales_names)):
+ en_names_requested = True
+ locales_names = self._add_missing_locale_names_in_english(locales, locales_names)
+
+ language_pair = self.get_language_pair_name(source, target, locales_names)
+ language_names.append(language_pair)
+
+ Apertium.g_locales_names = locales_names
+ Apertium.g_language_names = language_names
+ Apertium.g_language_codes = language_codes
+
+ except Exception as e:
+ print("_get_remote_language_pairs exception {0}".format(e))
+
+
+ def _get_remote_language_pairs(self):
+ url = "{0}/listPairs".format(self.SERVER)
+ print("url->" + url)
+
+ response = urllib.request.urlopen(url)
+ data = json.loads(response.read().decode("utf-8"))
+ pairs = data['responseData']
+
+ locales = set()
+ language_pair_source = []
+ language_pair_target = []
+ language_codes = []
+
+ for pair in pairs:
+ source = pair['sourceLanguage']
+ target = pair['targetLanguage']
+ language_pair = '{0}|{1}'.format(source, target)
+ language_pair_source.append(source)
+ language_pair_target.append(target)
+ locales.add(source)
+ locales.add(target)
+ language_codes.append(language_pair)
+
+ return language_pair_source, language_pair_target, locales, language_codes
+
+ def _get_remote_language_names(self, locales, user_locale):
+ locales_string = ''
+ for locale_code in locales:
+ locales_string += locale_code + '+'
+
+ url = "{0}/listLanguageNames?locale={1}&languages={2}".format(self.SERVER,
+ user_locale, locales_string)
+ print("url->" + url)
+
+ response = urllib.request.urlopen(url)
+ return json.loads(response.read().decode("utf-8"))
+
+ def translate_text(self, text, language_pair):
+ url = "{0}/translate?langpair={1}&markUnknown=no".format(self.SERVER, language_pair)
+ url += "&q=" + urllib.parse.quote_plus(text.encode('utf-8'))
+ print("url->" + url)
+
+ response = urllib.request.urlopen(url)
+ data = json.loads(response.read().decode("utf-8"))
+ translated = data['responseData']['translatedText']
+ return translated
+
diff --git a/plugins/translate/translate/preferences.py b/plugins/translate/translate/preferences.py
new file mode 100644
index 0000000..d9fbb3a
--- /dev/null
+++ b/plugins/translate/translate/preferences.py
@@ -0,0 +1,112 @@
+# -*- coding: utf-8 -*-
+#
+# Copyrignt (C) 2017 Jordi Mas <jmas softcatala org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+import os
+from gi.repository import Gio, Gtk
+
+
+class Preferences(object):
+
+ TRANSLATE_KEY_BASE = 'org.gnome.gedit.plugins.translate'
+ OUTPUT_TO_DOCUMENT = 'output-to-document'
+ LANGUAGE_PAIR = 'language-pair'
+ LANG_NAME = 0
+ LANG_CODE = 1
+
+ def __init__(self, datadir, language_names, language_codes):
+ object.__init__(self)
+ self._language_codes = language_codes
+ self._language_names = language_names
+
+ self._settings = Gio.Settings.new(self.TRANSLATE_KEY_BASE)
+ self._ui_path = os.path.join(datadir, 'ui', 'preferences.ui')
+ self._ui = Gtk.Builder()
+ self._ui.add_from_file(self._ui_path)
+
+ self.init_radiobuttons()
+ self.init_combobox()
+
+ def init_radiobuttons(self):
+
+ self._radio_samedoc = self._ui.get_object('same_document')
+ self._output_window = self._ui.get_object('output_window')
+ active = self._settings.get_boolean(self.OUTPUT_TO_DOCUMENT)
+
+ if active:
+ self._radio_samedoc.set_active(active)
+ else:
+ self._output_window.set_active(active is False)
+
+ def init_combobox(self):
+ self._languages = self._ui.get_object('languages')
+
+ cell = Gtk.CellRendererText()
+ self._languages.pack_start(cell, 1)
+ self._languages.add_attribute(cell, 'text', 0)
+
+ self._model = self._get_stored_model()
+ self._languages.set_model(self._model)
+ self._languages.connect('changed', self.changed_cb)
+
+ selected = self._settings.get_string(self.LANGUAGE_PAIR)
+ index = self.get_index(selected)
+ self._languages.set_active(index)
+
+ def _get_stored_model(self):
+ sorted_language_names = set()
+
+ for i in range(len(self._language_names)):
+ sorted_language_names.add((self._language_names[i], self._language_codes[i]))
+
+ sorted_language_names = sorted(sorted_language_names,
+ key=lambda tup: tup[Preferences.LANG_NAME])
+
+ model = Gtk.ListStore(str, str)
+ for name_code in sorted_language_names:
+ model.append(name_code)
+
+ return model
+
+ def get_index(self, selected):
+ for i in range(len(self._model)):
+ if self._model[i][Preferences.LANG_CODE] == selected:
+ return i
+ return -1
+
+ def changed_cb(self, combobox):
+ model = combobox.get_model()
+ index = combobox.get_active()
+ if index > -1:
+ item = model[index]
+ self._settings.set_string(self.LANGUAGE_PAIR, item[Preferences.LANG_CODE])
+ return
+
+ def set_output_to_doc(self, active):
+ self._settings.set_boolean(self.OUTPUT_TO_DOCUMENT, active)
+
+ def radio_samedoc_callback(self, widget, data=None):
+ self.set_output_to_doc(widget.get_active())
+
+ def configure_widget(self):
+ self._ui.connect_signals(self)
+ self._radio_samedoc.connect("toggled", self.radio_samedoc_callback)
+
+ widget = self._ui.get_object('grid')
+ return widget
+
diff --git a/plugins/translate/translate/translateview.py b/plugins/translate/translate/translateview.py
new file mode 100644
index 0000000..9950485
--- /dev/null
+++ b/plugins/translate/translate/translateview.py
@@ -0,0 +1,55 @@
+# -*- coding: utf-8 -*-
+#
+# Copyrignt (C) 2017 Jordi Mas <jmas softcatala org>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+
+from gi.repository import GLib, Gtk
+
+class TranslateView(Gtk.ScrolledWindow):
+
+ def __init__(self, namespace = {}):
+ Gtk.ScrolledWindow.__init__(self)
+
+ self.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
+ self.set_shadow_type(Gtk.ShadowType.NONE)
+ self.view = Gtk.TextView()
+ self.view.set_editable(False)
+ self.view.set_wrap_mode(Gtk.WrapMode.WORD_CHAR)
+ self.add(self.view)
+ self.view.show()
+
+ def do_grab_focus(self):
+ self.view.grab_focus()
+
+ def stop(self):
+ self.namespace = None
+
+ def scroll_to_end(self):
+ i = self.view.get_buffer().get_end_iter()
+ self.view.scroll_to_iter(i, 0.0, False, 0.5, 0.5)
+ return False
+
+ def write(self, text):
+ text = text + "\n"
+ buf = self.view.get_buffer()
+ buf.insert(buf.get_end_iter(), text)
+ GLib.idle_add(self.scroll_to_end)
+
+ def destroy(self):
+ pass
+
diff --git a/plugins/translate/translate/ui/preferences.ui b/plugins/translate/translate/ui/preferences.ui
new file mode 100644
index 0000000..16bc0ed
--- /dev/null
+++ b/plugins/translate/translate/ui/preferences.ui
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.20.0 -->
+<interface>
+ <requires lib="gtk+" version="3.18"/>
+ <object class="GtkGrid" id="grid">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_right">3</property>
+ <property name="label" translatable="yes">Translation languages</property>
+ <property name="justify">right</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="languages">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="active">0</property>
+ <property name="has_entry">False</property>
+ <property name="id_column">0</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Where to output translation:</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkRadioButton" id="same_document">
+ <property name="label" translatable="yes">Same document window</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkRadioButton" id="output_window">
+ <property name="label" translatable="yes">Output translate window</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">same_document</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ </object>
+</interface>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index a83fd38..103ebb0 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -57,6 +57,10 @@ plugins/terminal/terminal.py
plugins/textsize/textsize/__init__.py
plugins/textsize/textsize.plugin.desktop.in.in
plugins/textsize/gedit-textsize.metainfo.xml.in
+[type: gettext/glade]plugins/translate/translate/preferences.ui
+plugins/translate/translate/translate.py
+plugins/translate/translate.plugin.desktop.in.in
+plugins/translate/gedit-translate.metainfo.xml.in
[type: gettext/glade]plugins/wordcompletion/gedit-word-completion-configure.ui
plugins/wordcompletion/gedit-word-completion-plugin.c
plugins/wordcompletion/org.gnome.gedit.plugins.wordcompletion.gschema.xml.in.in
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]