we now use wiktionary by defualt. dictionary and web search url accepts %s and checks if it exists before operating as expected
This commit is contained in:
parent
a0e7df5961
commit
f047663bf8
31
src/chat.py
31
src/chat.py
|
@ -714,20 +714,41 @@ class Chat:
|
|||
% self.selected_phrase
|
||||
else:
|
||||
link = 'http://%s.wikipedia.org/wiki/Special:Search?search=%s'\
|
||||
%(gajim.LANG, self.selected_phrase)
|
||||
% (gajim.LANG, self.selected_phrase)
|
||||
item = gtk.MenuItem(_('Read _Wikipedia Article'))
|
||||
item.connect('activate', self.visit_url_from_menuitem, link)
|
||||
submenu.append(item)
|
||||
|
||||
item = gtk.MenuItem(_('Look it up in _Dictionary'))
|
||||
link = gajim.config.get('dictionary_url') + self.selected_phrase
|
||||
dict_link = gajim.config.get('dictionary_url')
|
||||
if dict_link == 'WIKTIONARY':
|
||||
# special link (yeah undocumented but default)
|
||||
always_use_en = gajim.config.get('always_english_wiktionary')
|
||||
if always_use_en:
|
||||
link = 'http://en.wiktionary.org/wiki/Special:Search?search=%s'\
|
||||
% self.selected_phrase
|
||||
else:
|
||||
link = 'http://%s.wiktionary.org/wiki/Special:Search?search=%s'\
|
||||
% (gajim.LANG, self.selected_phrase)
|
||||
item.connect('activate', self.visit_url_from_menuitem, link)
|
||||
else:
|
||||
if dict_link.find('%s') == -1:
|
||||
# we must have %s in the url if not WIKTIONARY
|
||||
item = gtk.MenuItem(_('Dictionary url is not WIKTIONARY or is missing an "%s"'))
|
||||
item.set_property('sensitive', False)
|
||||
else:
|
||||
link = dict_link % self.selected_phrase
|
||||
item.connect('activate', self.visit_url_from_menuitem, link)
|
||||
submenu.append(item)
|
||||
|
||||
|
||||
search_link = gajim.config.get('search_engine')
|
||||
if search_link.find('%s') == -1: # we must have %s in the url
|
||||
item = gtk.MenuItem(_('Web Search URL is missing an "%s"'))
|
||||
item.set_property('sensitive', False)
|
||||
else:
|
||||
item = gtk.MenuItem(_('Web _Search for it'))
|
||||
gajim.config.get('search_engine')
|
||||
link = gajim.config.get('search_engine') + self.selected_phrase +\
|
||||
'&sourceid=gajim'
|
||||
link = search_link % self.selected_phrase
|
||||
item.connect('activate', self.visit_url_from_menuitem, link)
|
||||
submenu.append(item)
|
||||
|
||||
|
|
|
@ -113,9 +113,10 @@ class Config:
|
|||
'key_up_lines': [opt_int, 25], # how many lines to store for key up
|
||||
'version': [ opt_str, '0.8' ],
|
||||
'always_compact_view': [opt_bool, False], # initial compact view state
|
||||
'search_engine': [opt_str, 'http://www.google.com/search?&q='],
|
||||
'dictionary_url': [opt_str, 'http://dictionary.reference.com/search?q='],
|
||||
'search_engine': [opt_str, 'http://www.google.com/search?&q=%s&sourceid=gajim'],
|
||||
'dictionary_url': [opt_str, 'WIKTIONARY'], # by default use wiktionary
|
||||
'always_english_wikipedia': [opt_bool, False],
|
||||
'always_english_wiktionary': [opt_bool, False],
|
||||
'use_dbus': [opt_bool, True], # allow control via dbus service
|
||||
'send_receive_chat_state_notifications': [opt_bool, True],
|
||||
'autodetect_browser_mailer': [opt_bool, True],
|
||||
|
|
Loading…
Reference in New Issue