From 3f5895145b6d4128fce7d9d2172b069f086cf590 Mon Sep 17 00:00:00 2001 From: Clement Lefebvre Date: Wed, 23 Nov 2016 15:33:34 +0000 Subject: [PATCH] Search engines: Point to local version of Wikipedia Look at the locale and point at the appropriate version of Wikipedia. Before this commit, mintmenu always pointed at the English Wikipedia. Note: This commit might introduce regressions when a particular locale isn't supported by Wikipedia. If this becomes a problem, we can fix this based on feedback. --- usr/lib/linuxmint/mintMenu/plugins/applications.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/usr/lib/linuxmint/mintMenu/plugins/applications.py b/usr/lib/linuxmint/mintMenu/plugins/applications.py index ef2016d..1d9ce18 100755 --- a/usr/lib/linuxmint/mintMenu/plugins/applications.py +++ b/usr/lib/linuxmint/mintMenu/plugins/applications.py @@ -174,6 +174,12 @@ class pluginclass( object ): self.toggleButton = toggleButton self.de = de + # Detect the locale (this is used for the Wikipedia search) + self.lang = "en" + lang = os.getenv('LANG') + if lang is not None and lang != "": + self.lang = lang.split("_")[0] + self.builder = Gtk.Builder() # The Glade file for the plugin self.builder.add_from_file (os.path.join( os.path.dirname( __file__ ), "applications.glade" )) @@ -1113,7 +1119,7 @@ class pluginclass( object ): def search_wikipedia(self, widget): text = self.searchEntry.get_text() text = text.replace(" ", "+") - os.system("xdg-open \"http://en.wikipedia.org/wiki/Special:Search?search=" + text + "\" &") + os.system("xdg-open \"http://%s.wikipedia.org/wiki/Special:Search?search=%s\" &" % (self.lang, text)) self.mintMenuWin.hide() def search_dictionary(self, widget):