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.
This commit is contained in:
parent
1810b6b3ee
commit
3f5895145b
@ -174,6 +174,12 @@ class pluginclass( object ):
|
|||||||
self.toggleButton = toggleButton
|
self.toggleButton = toggleButton
|
||||||
self.de = de
|
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()
|
self.builder = Gtk.Builder()
|
||||||
# The Glade file for the plugin
|
# The Glade file for the plugin
|
||||||
self.builder.add_from_file (os.path.join( os.path.dirname( __file__ ), "applications.glade" ))
|
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):
|
def search_wikipedia(self, widget):
|
||||||
text = self.searchEntry.get_text()
|
text = self.searchEntry.get_text()
|
||||||
text = text.replace(" ", "+")
|
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()
|
self.mintMenuWin.hide()
|
||||||
|
|
||||||
def search_dictionary(self, widget):
|
def search_dictionary(self, widget):
|
||||||
|
Loading…
Reference in New Issue
Block a user